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