winbind: Don't leak centry memory. Reviewed-by: Alexander Bokovoy <ab@samba.org>
[Samba.git] / lib / crypto / md5.h
blob388cdf83f093c3dd91cedcb234ca75be388cd6a3
1 #ifndef MD5_H
2 #define MD5_H
4 #ifndef HEADER_MD5_H
5 /* Try to avoid clashes with OpenSSL */
6 #define HEADER_MD5_H
7 #endif
9 #ifdef HAVE_BSD_MD5_H
10 /* Try to avoid clashes with BSD MD5 implementation */
11 #include <bsd/md5.h>
12 #else
13 /* Try to use CommonCrypto on Mac as otherwise we can get MD5Final twice */
14 #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H
15 #include <CommonCrypto/CommonDigest.h>
17 #define MD5Init(c) CC_MD5_Init(c)
18 #define MD5Update(c,d,l) CC_MD5_Update(c,d,l)
19 #define MD5Final(m, c) CC_MD5_Final((unsigned char *)m,c)
20 #define MD5Context CC_MD5state_st
22 #else
23 typedef struct MD5Context {
24 uint32_t buf[4];
25 uint32_t bits[2];
26 uint8_t in[64];
27 } MD5_CTX;
29 #define MD5_DIGEST_LENGTH 16
31 void MD5Init(MD5_CTX *context);
32 void MD5Update(MD5_CTX *context, const uint8_t *buf,
33 size_t len);
34 void MD5Final(uint8_t digest[MD5_DIGEST_LENGTH], MD5_CTX *context);
35 #endif /* HAVE_COMMONCRYPTO_COMMONDIGEST_H */
37 #endif /* HAVE_BSD_MD5_H */
39 #endif /* !MD5_H */