xref: /netbsd-src/external/bsd/ntp/dist/sntp/crypto.h (revision eabc0478de71e4e011a5b4e0392741e01d491794)
1 /*	$NetBSD: crypto.h,v 1.8 2024/08/18 20:47:20 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 "utilities.h"
14 #include "sntp-opts.h"
15 
16 #define LEN_PKT_MAC	LEN_PKT_NOMAC + sizeof(u_int32)
17 
18 /* #include "sntp-opts.h" */
19 
20 struct key {
21 	struct key *	next;
22 	keyid_t		key_id;
23 	size_t		key_len;
24 	int		typei;
25 	char		typen[20];
26 	char		key_seq[64];
27 };
28 
29 extern	int	auth_init(const char *keyfile, struct key **keys);
30 extern	void	get_key(keyid_t key_id, struct key **d_key);
31 extern	size_t	make_mac(const void *pkt_data, size_t pkt_len,
32 			 const struct key *cmp_key, void *digest,
33 			 size_t dig_sz);
34 extern	int	auth_md5(const void *pkt_data, size_t pkt_len,
35 			 size_t dig_len, const struct key *cmp_key);
36 
37 #endif
38