Unverified 提交 3d3246ab authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi 提交者: GitHub

Merge pull request #627 from fippo/sha-length

use openssl define for sha1 digest length
...@@ -11,7 +11,7 @@ namespace Utils ...@@ -11,7 +11,7 @@ namespace Utils
thread_local uint32_t Crypto::seed; thread_local uint32_t Crypto::seed;
thread_local HMAC_CTX* Crypto::hmacSha1Ctx{ nullptr }; thread_local HMAC_CTX* Crypto::hmacSha1Ctx{ nullptr };
thread_local uint8_t Crypto::hmacSha1Buffer[20]; // SHA-1 result is 20 bytes long. thread_local uint8_t Crypto::hmacSha1Buffer[SHA_DIGEST_LENGTH];
// clang-format off // clang-format off
const uint32_t Crypto::crc32Table[] = const uint32_t Crypto::crc32Table[] =
{ {
...@@ -96,7 +96,8 @@ namespace Utils ...@@ -96,7 +96,8 @@ namespace Utils
MS_ASSERT( MS_ASSERT(
ret == 1, "OpenSSL HMAC_Final() failed with key '%s' and data length %zu bytes", key.c_str(), len); ret == 1, "OpenSSL HMAC_Final() failed with key '%s' and data length %zu bytes", key.c_str(), len);
MS_ASSERT(resultLen == 20, "OpenSSL HMAC_Final() resultLen is %u instead of 20", resultLen); MS_ASSERT(
resultLen == SHA_DIGEST_LENGTH, "OpenSSL HMAC_Final() resultLen is %u instead of 20", resultLen);
return Crypto::hmacSha1Buffer; return Crypto::hmacSha1Buffer;
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论