FreeTDS API
md5.h
1 #ifndef _tdsguard_d0MZPmUZs0d3gpgxVUiFES_
2 #define _tdsguard_d0MZPmUZs0d3gpgxVUiFES_
3 
4 #ifndef HAVE_NETTLE
5 
6 #include <freetds/pushvis.h>
7 
8 struct MD5Context {
9  uint32_t buf[4];
10  uint64_t bytes;
11  uint32_t in[16];
12 };
13 
14 void MD5Init(struct MD5Context *context);
15 void MD5Update(struct MD5Context *context, const uint8_t *buf, size_t len);
16 void MD5Final(struct MD5Context *context, uint8_t *digest);
17 
18 /*
19  * This is needed to make RSAREF happy on some MS-DOS compilers.
20  */
21 typedef struct MD5Context MD5_CTX;
22 
23 #include <freetds/popvis.h>
24 
25 #else
26 
27 #include <nettle/md5.h>
28 #include <nettle/version.h>
29 
30 typedef struct md5_ctx MD5_CTX;
31 
32 static inline void MD5Init(MD5_CTX *ctx)
33 {
34  nettle_md5_init(ctx);
35 }
36 
37 static inline void MD5Update(MD5_CTX *ctx, const uint8_t *buf, size_t len)
38 {
39  nettle_md5_update(ctx, len, buf);
40 }
41 
42 static inline void MD5Final(MD5_CTX *ctx, uint8_t *digest)
43 {
44 #if defined(NETTLE_VERSION_MAJOR) && NETTLE_VERSION_MAJOR >= 4
45  nettle_md5_digest(ctx, digest);
46 #else
47  nettle_md5_digest(ctx, 16, digest);
48 #endif
49 }
50 
51 #endif
52 
53 #endif /* !_tdsguard_d0MZPmUZs0d3gpgxVUiFES_ */
Definition: md5.h:8