From e4aaf2ca353da8b5a9d85fb439daf7e0a758012e Mon Sep 17 00:00:00 2001 From: Stanislav Yaglo Date: Wed, 27 Sep 2023 10:46:26 +0100 Subject: [PATCH] Update CNIOSHA1.h to support C++ mode (#2523) --- Sources/CNIOSHA1/include/CNIOSHA1.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/CNIOSHA1/include/CNIOSHA1.h b/Sources/CNIOSHA1/include/CNIOSHA1.h index 6ed17f79f..b5c057565 100644 --- a/Sources/CNIOSHA1/include/CNIOSHA1.h +++ b/Sources/CNIOSHA1/include/CNIOSHA1.h @@ -49,6 +49,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct sha1_ctxt { union { uint8_t b8[20]; @@ -68,7 +72,12 @@ typedef struct sha1_ctxt SHA1_CTX; #define SHA1_RESULTLEN (160/8) +#ifdef __cplusplus +#define __min_size(x) (x) +#else #define __min_size(x) static (x) +#endif + extern void c_nio_sha1_init(struct sha1_ctxt *); extern void c_nio_sha1_pad(struct sha1_ctxt *); extern void c_nio_sha1_loop(struct sha1_ctxt *, const uint8_t *, size_t); @@ -79,5 +88,8 @@ extern void c_nio_sha1_result(struct sha1_ctxt *, char[__min_size(SHA1_RESULTLEN #define SHA1Update(x, y, z) c_nio_sha1_loop((x), (y), (z)) #define SHA1Final(x, y) c_nio_sha1_result((y), (x)) +#ifdef __cplusplus +} /* extern "C" */ +#endif #endif /*_CRYPTO_SHA1_H_*/