1 /* $NetBSD: crypto.h,v 1.1.1.3 2013/12/27 23:31:14 christos Exp $ */ 2 3 #ifndef CRYPTO_H 4 #define CRYPTO_H 5 6 #include <string.h> 7 #include <stdio.h> 8 #include <stdlib.h> 9 10 #include <ntp_fp.h> 11 #include <ntp.h> 12 #include <ntp_stdlib.h> 13 #include <ntp_md5.h> /* provides OpenSSL digest API */ 14 #include "utilities.h" 15 #include "sntp-opts.h" 16 17 #define LEN_PKT_MAC LEN_PKT_NOMAC + sizeof(u_int32) 18 19 /* #include "sntp-opts.h" */ 20 21 struct key { 22 struct key *next; 23 int key_id; 24 int key_len; 25 char type[10]; 26 char key_seq[64]; 27 }; 28 29 int auth_init(const char *keyfile, struct key **keys); 30 void get_key(int key_id, struct key **d_key); 31 int make_mac(char *pkt_data, int pkt_size, int mac_size, struct key *cmp_key, char *digest); 32 int auth_md5(char *pkt_data, int pkt_size, int mac_size, struct key *cmp_key); 33 34 #endif 35