12b15cb3dSCy Schubert #ifndef CRYPTO_H 22b15cb3dSCy Schubert #define CRYPTO_H 32b15cb3dSCy Schubert 42b15cb3dSCy Schubert #include <string.h> 52b15cb3dSCy Schubert #include <stdio.h> 62b15cb3dSCy Schubert #include <stdlib.h> 72b15cb3dSCy Schubert 82b15cb3dSCy Schubert #include <ntp_fp.h> 92b15cb3dSCy Schubert #include <ntp.h> 102b15cb3dSCy Schubert #include <ntp_stdlib.h> 112b15cb3dSCy Schubert #include <ntp_md5.h> /* provides OpenSSL digest API */ 122b15cb3dSCy Schubert #include "utilities.h" 132b15cb3dSCy Schubert #include "sntp-opts.h" 142b15cb3dSCy Schubert 152b15cb3dSCy Schubert #define LEN_PKT_MAC LEN_PKT_NOMAC + sizeof(u_int32) 162b15cb3dSCy Schubert 172b15cb3dSCy Schubert /* #include "sntp-opts.h" */ 182b15cb3dSCy Schubert 192b15cb3dSCy Schubert struct key { 202b15cb3dSCy Schubert struct key * next; 212b15cb3dSCy Schubert int key_id; 222b15cb3dSCy Schubert int key_len; 23*09100258SXin LI int typei; 24*09100258SXin LI char typen[20]; 252b15cb3dSCy Schubert char key_seq[64]; 262b15cb3dSCy Schubert }; 272b15cb3dSCy Schubert 2868ba7e87SXin LI extern int auth_init(const char *keyfile, struct key **keys); 2968ba7e87SXin LI extern void get_key(int key_id, struct key **d_key); 3068ba7e87SXin LI extern int make_mac(const void *pkt_data, int pkt_size, int mac_size, 3168ba7e87SXin LI const struct key *cmp_key, void *digest); 3268ba7e87SXin LI extern int auth_md5(const void *pkt_data, int pkt_size, int mac_size, 3368ba7e87SXin LI const struct key *cmp_key); 342b15cb3dSCy Schubert 352b15cb3dSCy Schubert #endif 36