xref: /freebsd/contrib/ntp/sntp/crypto.h (revision cd0d51baaa4509a1db83251a601d34404d20c990)
1 #ifndef CRYPTO_H
2 #define CRYPTO_H
3 
4 #include <string.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 
8 #include <ntp_fp.h>
9 #include <ntp.h>
10 #include <ntp_stdlib.h>
11 #include <ntp_md5.h>	/* provides OpenSSL digest API */
12 #include "utilities.h"
13 #include "sntp-opts.h"
14 
15 #define LEN_PKT_MAC	LEN_PKT_NOMAC + sizeof(u_int32)
16 
17 /* #include "sntp-opts.h" */
18 
19 struct key {
20 	struct key *	next;
21 	int		key_id;
22 	int		key_len;
23 	int		typei;
24 	char		typen[20];
25 	char		key_seq[64];
26 };
27 
28 extern	int	auth_init(const char *keyfile, struct key **keys);
29 extern	void	get_key(int key_id, struct key **d_key);
30 extern	int	make_mac(const void *pkt_data, int pkt_size, int mac_size,
31 			 const struct key *cmp_key, void *digest);
32 extern	int	auth_md5(const void *pkt_data, int pkt_size, int mac_size,
33 			 const struct key *cmp_key);
34 
35 #endif
36