1 /* $NetBSD: crypto.h,v 1.7 2020/05/25 20:47:32 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 int typei; 26 char typen[20]; 27 char key_seq[64]; 28 }; 29 30 extern int auth_init(const char *keyfile, struct key **keys); 31 extern void get_key(int key_id, struct key **d_key); 32 extern int make_mac(const void *pkt_data, int pkt_size, int mac_size, 33 const struct key *cmp_key, void *digest); 34 extern int auth_md5(const void *pkt_data, int pkt_size, int mac_size, 35 const struct key *cmp_key); 36 37 #endif 38