sha256/gcrypt: fix build with SANITIZE=leak
Non-static functions cause `undefined reference' errors when building with `SANITIZE=leak' due to the lack of prototypes. Mark all these functions as `static inline' as we do in sha256/nettle.h to avoid the need to maintain prototypes. Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Wong committed
Jul 31, 2023 at 12:08 UTC
b4b85e41a74eaf61dfb490004541622e63df092b
1 file changed
+4
-4
sha256/gcrypt.h
+4
-4
@@ -7,22 +7,22 @@
7
8
typedef gcry_md_hd_t gcrypt_SHA256_CTX;
9
10
-inline void gcrypt_SHA256_Init(gcrypt_SHA256_CTX *ctx)
10
+static inline void gcrypt_SHA256_Init(gcrypt_SHA256_CTX *ctx)
11
{
12
gcry_md_open(ctx, GCRY_MD_SHA256, 0);
13
}
14
15
-inline void gcrypt_SHA256_Update(gcrypt_SHA256_CTX *ctx, const void *data, size_t len)
15
+static inline void gcrypt_SHA256_Update(gcrypt_SHA256_CTX *ctx, const void *data, size_t len)
16
{
17
gcry_md_write(*ctx, data, len);
18
}
19
20
-inline void gcrypt_SHA256_Final(unsigned char *digest, gcrypt_SHA256_CTX *ctx)
20
+static inline void gcrypt_SHA256_Final(unsigned char *digest, gcrypt_SHA256_CTX *ctx)
21
{
22
memcpy(digest, gcry_md_read(*ctx, GCRY_MD_SHA256), SHA256_DIGEST_SIZE);
23
}
24
25
-inline void gcrypt_SHA256_Clone(gcrypt_SHA256_CTX *dst, const gcrypt_SHA256_CTX *src)
25
+static inline void gcrypt_SHA256_Clone(gcrypt_SHA256_CTX *dst, const gcrypt_SHA256_CTX *src)
26
{
27
gcry_md_copy(dst, *src);
28
}