FreeTDS API: include/freetds/utils/md4.h Source File

FreeTDS API

Loading...
Searching...
No Matches
md4.h
1#ifndef _tdsguard_bJRBdagK4r9w58mnUbyvA0_
2#define _tdsguard_bJRBdagK4r9w58mnUbyvA0_
3
4#ifndef HAVE_NETTLE
5
6#include <freetds/pushvis.h>
7
8 struct MD4Context
9{
10 uint32_t buf[4];
11 uint64_t bytes;
12 uint32_t in[16];
13};
14
15void MD4Init(struct MD4Context *context);
16void MD4Update(struct MD4Context *context, const uint8_t *buf, size_t len);
17void MD4Final(struct MD4Context *context, uint8_t *digest);
18
19typedef struct MD4Context MD4_CTX;
20
21#include <freetds/popvis.h>
22
23#else
24
25#include <nettle/md4.h>
26#include <nettle/version.h>
27
28typedef struct md4_ctx MD4_CTX;
29
30static inline void MD4Init(MD4_CTX *ctx)
31{
32 nettle_md4_init(ctx);
33}
34
35static inline void MD4Update(MD4_CTX *ctx, const uint8_t *buf, size_t len)
36{
37 nettle_md4_update(ctx, len, buf);
38}
39
40static inline void MD4Final(MD4_CTX *ctx, uint8_t *digest)
41{
42#if defined(NETTLE_VERSION_MAJOR) && NETTLE_VERSION_MAJOR >= 4
43 nettle_md4_digest(ctx, digest);
44#else
45 nettle_md4_digest(ctx, 16, digest);
46#endif
47}
48
49
50#endif
51
52#endif /* !_tdsguard_bJRBdagK4r9w58mnUbyvA0_ */
MD4Context
Definition md4.h:9