1 /* $NetBSD: crypto.h,v 1.5 2016/05/01 23:32:01 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 extern int auth_init(const char *keyfile, struct key **keys); 30 extern void get_key(int key_id, struct key **d_key); 31 extern int make_mac(const void *pkt_data, int pkt_size, int mac_size, 32 const struct key *cmp_key, void *digest); 33 extern int auth_md5(const void *pkt_data, int pkt_size, int mac_size, 34 const struct key *cmp_key); 35 36 #endif 37