xref: /freebsd/contrib/ntp/sntp/crypto.h (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
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 "utilities.h"
122b15cb3dSCy Schubert #include "sntp-opts.h"
132b15cb3dSCy Schubert 
142b15cb3dSCy Schubert #define LEN_PKT_MAC	LEN_PKT_NOMAC + sizeof(u_int32)
152b15cb3dSCy Schubert 
162b15cb3dSCy Schubert /* #include "sntp-opts.h" */
172b15cb3dSCy Schubert 
182b15cb3dSCy Schubert struct key {
192b15cb3dSCy Schubert 	struct key *	next;
20*f5f40dd6SCy Schubert 	keyid_t		key_id;
21*f5f40dd6SCy Schubert 	size_t		key_len;
2209100258SXin LI 	int		typei;
2309100258SXin LI 	char		typen[20];
242b15cb3dSCy Schubert 	char		key_seq[64];
252b15cb3dSCy Schubert };
262b15cb3dSCy Schubert 
2768ba7e87SXin LI extern	int	auth_init(const char *keyfile, struct key **keys);
28*f5f40dd6SCy Schubert extern	void	get_key(keyid_t key_id, struct key **d_key);
29*f5f40dd6SCy Schubert extern	size_t	make_mac(const void *pkt_data, size_t pkt_len,
30*f5f40dd6SCy Schubert 			 const struct key *cmp_key, void *digest,
31*f5f40dd6SCy Schubert 			 size_t dig_sz);
32*f5f40dd6SCy Schubert extern	int	auth_md5(const void *pkt_data, size_t pkt_len,
33*f5f40dd6SCy Schubert 			 size_t dig_len, const struct key *cmp_key);
342b15cb3dSCy Schubert 
352b15cb3dSCy Schubert #endif
36