]> git.ipfire.org Git - thirdparty/git.git/blob - sha256/nettle.h
Merge branch 'rs/bisect-start-leakfix' into maint-2.38
[thirdparty/git.git] / sha256 / nettle.h
1 #ifndef SHA256_NETTLE_H
2 #define SHA256_NETTLE_H
3
4 #include <nettle/sha2.h>
5
6 typedef struct sha256_ctx nettle_SHA256_CTX;
7
8 static inline void nettle_SHA256_Init(nettle_SHA256_CTX *ctx)
9 {
10 sha256_init(ctx);
11 }
12
13 static inline void nettle_SHA256_Update(nettle_SHA256_CTX *ctx,
14 const void *data,
15 size_t len)
16 {
17 sha256_update(ctx, len, data);
18 }
19
20 static inline void nettle_SHA256_Final(unsigned char *digest,
21 nettle_SHA256_CTX *ctx)
22 {
23 sha256_digest(ctx, SHA256_DIGEST_SIZE, digest);
24 }
25
26 #define platform_SHA256_CTX nettle_SHA256_CTX
27 #define platform_SHA256_Init nettle_SHA256_Init
28 #define platform_SHA256_Update nettle_SHA256_Update
29 #define platform_SHA256_Final nettle_SHA256_Final
30
31 #endif