1 #ifndef CRYPTO_H 2 #define CRYPTO_H 3 4 #include <string.h> 5 #include <stdio.h> 6 #include <stdlib.h> 7 8 #include <ntp_fp.h> 9 #include <ntp.h> 10 #include <ntp_stdlib.h> 11 #include "utilities.h" 12 #include "sntp-opts.h" 13 14 #define LEN_PKT_MAC LEN_PKT_NOMAC + sizeof(u_int32) 15 16 /* #include "sntp-opts.h" */ 17 18 struct key { 19 struct key * next; 20 keyid_t key_id; 21 size_t key_len; 22 int typei; 23 char typen[20]; 24 char key_seq[64]; 25 }; 26 27 extern int auth_init(const char *keyfile, struct key **keys); 28 extern void get_key(keyid_t key_id, struct key **d_key); 29 extern size_t make_mac(const void *pkt_data, size_t pkt_len, 30 const struct key *cmp_key, void *digest, 31 size_t dig_sz); 32 extern int auth_md5(const void *pkt_data, size_t pkt_len, 33 size_t dig_len, const struct key *cmp_key); 34 35 #endif 36