xref: /netbsd-src/external/bsd/ntp/dist/include/ntp_md5.h (revision 9ddb6ab554e70fb9bbd90c3d96b812bc57755a14)
1 /*	$NetBSD: ntp_md5.h,v 1.1.1.2 2012/01/31 21:23:26 kardel Exp $	*/
2 
3 /*
4  * ntp_md5.h: deal with md5.h headers
5  *
6  * Use the system MD5 if available, otherwise libisc's.
7  */
8 #if defined HAVE_MD5_H && defined HAVE_MD5INIT
9 # include <md5.h>
10 #else
11 # include "isc/md5.h"
12   typedef isc_md5_t		MD5_CTX;
13 # define MD5Init(c)		isc_md5_init(c)
14 # define MD5Update(c, p, s)	isc_md5_update(c, p, s)
15 # define MD5Final(d, c)		isc_md5_final((c), (d))	/* swapped */
16 #endif
17 
18 /*
19  * Provide OpenSSL-alike MD5 API if we're not using OpenSSL
20  */
21 #ifndef OPENSSL
22   typedef MD5_CTX			EVP_MD_CTX;
23 # define EVP_get_digestbynid(t)		NULL
24 # define EVP_DigestInit(c, dt)		MD5Init(c)
25 # define EVP_DigestUpdate(c, p, s)	MD5Update(c, p, s)
26 # define EVP_DigestFinal(c, d, pdl)	\
27 	do {				\
28 		MD5Final((d), (c));	\
29 		*(pdl) = 16;		\
30 	} while (0)
31 #endif
32