FreeTDS API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
md5.h
1 #ifndef MD5_H
2 #define MD5_H
3 
4 #ifndef HAVE_NETTLE
5 
6 #include <freetds/pushvis.h>
7 
8 struct MD5Context {
9  TDS_UINT buf[4];
10  TDS_UINT8 bytes;
11  unsigned char in[64];
12 };
13 
14 void MD5Init(struct MD5Context *context);
15 void MD5Update(struct MD5Context *context, unsigned char const *buf, size_t len);
16 void MD5Final(struct MD5Context *context, unsigned char *digest);
17 void MD5Transform(TDS_UINT buf[4], TDS_UINT const in[16]);
18 
19 /*
20  * This is needed to make RSAREF happy on some MS-DOS compilers.
21  */
22 typedef struct MD5Context MD5_CTX;
23 
24 #include <freetds/popvis.h>
25 
26 #else
27 
28 #include <nettle/md5.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, unsigned char const *buf, size_t len)
38 {
39  nettle_md5_update(ctx, len, buf);
40 }
41 
42 static inline void MD5Final(MD5_CTX *ctx, unsigned char *digest)
43 {
44  nettle_md5_digest(ctx, 16, digest);
45 }
46 
47 #endif
48 
49 #endif /* !MD5_H */
Definition: md5.h:8