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; 232b15cb3dSCy Schubert char type[10]; 242b15cb3dSCy Schubert char key_seq[64]; 252b15cb3dSCy Schubert }; 262b15cb3dSCy Schubert 27*68ba7e87SXin LI extern int auth_init(const char *keyfile, struct key **keys); 28*68ba7e87SXin LI extern void get_key(int key_id, struct key **d_key); 29*68ba7e87SXin LI extern int make_mac(const void *pkt_data, int pkt_size, int mac_size, 30*68ba7e87SXin LI const struct key *cmp_key, void *digest); 31*68ba7e87SXin LI extern int auth_md5(const void *pkt_data, int pkt_size, int mac_size, 32*68ba7e87SXin LI const struct key *cmp_key); 332b15cb3dSCy Schubert 342b15cb3dSCy Schubert #endif 35