globally fix all "BLAKE2" references (implicit BLAKE2B) to explicit "BLAKE2B":

* implement legacy compatibility in settings.h and configure.ac (adds --enable-blake2b while retaining --enable-blake2);
* fix incorrect Blake2 gates in wolfcrypt/src/hash.c wc_HashGetDigestSize() and wc_HashGetBlockSize();
* in wolfcrypt/test/test.c hash_test(), backfill missing Blake2 test coverage and separate blake2b from blake2s in typesHashBad[];
* in tests/api/test_hash.c, separate blake2b from blake2s in notCompiledHash[], sizeSupportedHash[], and sizeNotCompiledHash[].
This commit is contained in:
Daniel Pouzzner
2026-04-07 13:18:53 -05:00
parent 7aac9e5766
commit 60d1e222b2
25 changed files with 123 additions and 74 deletions
+3 -3
View File
@@ -208,9 +208,9 @@
#endif
// </e>
// <e>BLAKE2
#define MDK_CONF_BLAKE2 0
#if MDK_CONF_BLAKE2 == 1
#define HAVE_BLAKE2
#define MDK_CONF_BLAKE2B 0
#if MDK_CONF_BLAKE2B == 1
#define HAVE_BLAKE2B
#endif
// </e>
// <e>HMAC
+2 -2
View File
@@ -330,9 +330,9 @@ extern "C" {
#endif
/* Blake2B */
#undef HAVE_BLAKE2
#undef HAVE_BLAKE2B
#if 0
#define HAVE_BLAKE2
#define HAVE_BLAKE2B
#endif
/* Blake2S */
+3 -3
View File
@@ -93,8 +93,8 @@ function(generate_build_flags)
if(WOLFSSL_RIPEMD OR WOLFSSL_USER_SETTINGS)
set(BUILD_RIPEMD "yes" PARENT_SCOPE)
endif()
if(WOLFSSL_BLAKE2 OR WOLFSSL_USER_SETTINGS)
set(BUILD_BLAKE2 "yes" PARENT_SCOPE)
if(WOLFSSL_BLAKE2B OR WOLFSSL_USER_SETTINGS)
set(BUILD_BLAKE2B "yes" PARENT_SCOPE)
endif()
if(WOLFSSL_BLAKE2S OR WOLFSSL_USER_SETTINGS)
set(BUILD_BLAKE2S "yes" PARENT_SCOPE)
@@ -869,7 +869,7 @@ function(generate_lib_src_list LIB_SOURCES)
list(APPEND LIB_SOURCES wolfcrypt/src/ripemd.c)
endif()
if(BUILD_BLAKE2)
if(BUILD_BLAKE2B)
list(APPEND LIB_SOURCES wolfcrypt/src/blake2b.c)
endif()
+15 -10
View File
@@ -1502,7 +1502,7 @@ then
test "$enable_base64encode" = "" && enable_base64encode=yes
test "$enable_base16" = "" && enable_base16=yes
test "$enable_arc4" = "" && enable_arc4=yes
test "$enable_blake2" = "" && enable_blake2=yes
test "$enable_blake2b" = "" && enable_blake2b=yes
test "$enable_blake2s" = "" && enable_blake2s=yes
test "$enable_md2" = "" && enable_md2=yes
test "$enable_md4" = "" && enable_md4=yes
@@ -4442,15 +4442,21 @@ fi
# BLAKE2
AC_ARG_ENABLE([blake2],
[AS_HELP_STRING([--enable-blake2],[Enable wolfSSL BLAKE2b support (default: disabled)])],
[ ENABLED_BLAKE2=$enableval ],
[ ENABLED_BLAKE2=no ]
AC_ARG_ENABLE([blake2b],
[AS_HELP_STRING([--enable-blake2b],[Enable wolfSSL BLAKE2b support (default: disabled)])],
[ ENABLED_BLAKE2B=$enableval ],
[ ENABLED_BLAKE2B=no ]
)
if test "$ENABLED_BLAKE2" = "yes"
# Backward-compat synonym for blake2b:
AC_ARG_ENABLE([blake2],
[AS_HELP_STRING([--enable-blake2],[Enable wolfSSL BLAKE2b support (default: disabled)])],
[ ENABLED_BLAKE2B=$enableval ]
)
if test "$ENABLED_BLAKE2B" = "yes"
then
AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2 -DHAVE_BLAKE2B"
AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2B"
fi
@@ -4463,7 +4469,6 @@ AC_ARG_ENABLE([blake2s],
if test "$ENABLED_BLAKE2S" = "yes"
then
AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2S"
ENABLED_BLAKE2="yes"
fi
@@ -11492,7 +11497,7 @@ AM_CONDITIONAL([BUILD_DEVCRYPTO],[test "x$ENABLED_DEVCRYPTO" = "xyes"])
AM_CONDITIONAL([BUILD_CAMELLIA],[test "x$ENABLED_CAMELLIA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
AM_CONDITIONAL([BUILD_MD2],[test "x$ENABLED_MD2" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
AM_CONDITIONAL([BUILD_RIPEMD],[test "x$ENABLED_RIPEMD" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
AM_CONDITIONAL([BUILD_BLAKE2],[test "x$ENABLED_BLAKE2" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
AM_CONDITIONAL([BUILD_BLAKE2B],[test "x$ENABLED_BLAKE2B" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
AM_CONDITIONAL([BUILD_BLAKE2S],[test "x$ENABLED_BLAKE2S" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
AM_CONDITIONAL([BUILD_SHA512],[test "x$ENABLED_SHA512" = "xyes" || test "x$ENABLED_SHA384" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
AM_CONDITIONAL([BUILD_DSA],[test "x$ENABLED_DSA" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
@@ -12013,7 +12018,7 @@ echo " * SHA3: $ENABLED_SHA3"
echo " * SHAKE128: $ENABLED_SHAKE128"
echo " * SHAKE256: $ENABLED_SHAKE256"
echo " * SM3: $ENABLED_SM3"
echo " * BLAKE2: $ENABLED_BLAKE2"
echo " * BLAKE2B: $ENABLED_BLAKE2B"
echo " * BLAKE2S: $ENABLED_BLAKE2S"
echo " * SipHash: $ENABLED_SIPHASH"
echo " * CMAC: $ENABLED_CMAC"
-1
View File
@@ -228,7 +228,6 @@ extern "C" {
#define HAVE_X963_KDF
#define WOLFSSL_CMAC
#define WOLFSSL_DES_ECB
#define HAVE_BLAKE2
#define HAVE_BLAKE2B
#define HAVE_BLAKE2S
#define WOLFSSL_SIPHASH
@@ -199,7 +199,6 @@ extern "C" {
#define WOLFSSL_SHA3
#define WOLFSSL_SHAKE256
#define HAVE_BLAKE2
#define HAVE_BLAKE2B
#define HAVE_BLAKE2S
@@ -103,7 +103,6 @@
#define TEST_ESPIDF_ALL_WOLFSSL
#ifdef TEST_ESPIDF_ALL_WOLFSSL
#define WOLFSSL_MD2
#define HAVE_BLAKE2
#define HAVE_BLAKE2B
#define HAVE_BLAKE2S
+1 -1
View File
@@ -106,7 +106,7 @@
#ifdef HAVE_ED448
#include <wolfssl/wolfcrypt/ed448.h>
#endif
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2B) || defined(HAVE_BLAKE2S)
#include <wolfssl/wolfcrypt/blake2.h>
#endif
#ifdef WOLFSSL_SHA3
+1 -1
View File
@@ -1304,7 +1304,7 @@ if BUILD_RIPEMD
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/ripemd.c
endif
if BUILD_BLAKE2
if BUILD_BLAKE2B
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/blake2b.c
endif
if BUILD_BLAKE2S
+5 -5
View File
@@ -1188,7 +1188,7 @@ static int Hmac_UpdateFinal_CT(Hmac* hmac, byte* digest, const byte* in,
#endif
#if defined(WOLFSSL_NO_HASH_RAW) || defined(HAVE_FIPS) || \
defined(HAVE_SELFTEST) || defined(HAVE_BLAKE2)
defined(HAVE_SELFTEST) || defined(HAVE_BLAKE2B)
/* Calculate the HMAC of the header + message data.
* Constant time implementation using normal hashing operations.
@@ -1249,14 +1249,14 @@ static int Hmac_UpdateFinal(Hmac* hmac, byte* digest, const byte* in,
break;
#endif /* WOLFSSL_SHA512 */
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
case WC_HASH_TYPE_BLAKE2B:
blockSz = BLAKE2B_BLOCKBYTES;
blockBits = 7;
macSz = BLAKE2B_256;
padSz = 0;
break;
#endif /* HAVE_BLAKE2 */
#endif /* HAVE_BLAKE2B */
#ifdef WOLFSSL_SM3
case WC_SM3:
@@ -1450,7 +1450,7 @@ int TLS_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz, int padSz,
if (verify && padSz >= 0) {
#if !defined(WOLFSSL_NO_HASH_RAW) && !defined(HAVE_FIPS) && \
!defined(HAVE_SELFTEST)
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
if (wolfSSL_GetHmacType(ssl) == WC_HASH_TYPE_BLAKE2B) {
ret = Hmac_UpdateFinal(&hmac, digest, in,
totalSz, myInner, innerSz);
@@ -1521,7 +1521,7 @@ int wolfSSL_GetHmacType_ex(CipherSpecs* specs)
return WC_SHA;
}
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
case blake2b_mac:
{
return BLAKE2B_ID;
+6 -6
View File
@@ -40,7 +40,7 @@
int test_wc_InitBlake2b(void)
{
EXPECT_DECLS;
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
Blake2b blake;
/* Test bad arg. */
@@ -66,7 +66,7 @@ int test_wc_InitBlake2b(void)
int test_wc_InitBlake2b_WithKey(void)
{
EXPECT_DECLS;
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
Blake2b blake;
word32 digestSz = BLAKE2B_KEYBYTES;
byte key[BLAKE2B_KEYBYTES];
@@ -104,7 +104,7 @@ int test_wc_InitBlake2b_WithKey(void)
int test_wc_Blake2bUpdate(void)
{
EXPECT_DECLS;
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
Blake2b blake;
ExpectIntEQ(wc_InitBlake2b(&blake, WC_BLAKE2B_DIGEST_SIZE), 0);
@@ -127,7 +127,7 @@ int test_wc_Blake2bUpdate(void)
int test_wc_Blake2bFinal(void)
{
EXPECT_DECLS;
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
Blake2b blake;
byte hash[WC_BLAKE2B_DIGEST_SIZE];
@@ -156,7 +156,7 @@ int test_wc_Blake2bFinal(void)
int test_wc_Blake2b_KATs(void)
{
EXPECT_DECLS;
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
Blake2b blake;
testVector blake2b_kat[BLAKE2B_KAT_CNT];
@@ -272,7 +272,7 @@ int test_wc_Blake2b_KATs(void)
int test_wc_Blake2b_other(void)
{
EXPECT_DECLS;
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
Blake2b blake;
byte hash[WC_BLAKE2B_DIGEST_SIZE + 1];
byte data[WC_BLAKE2B_DIGEST_SIZE * 8 + 1];
+2 -2
View File
@@ -165,11 +165,11 @@ int test_wolfSSL_EVP_sm3(void)
int test_EVP_blake2(void)
{
EXPECT_DECLS;
#if defined(OPENSSL_EXTRA) && (defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S))
#if defined(OPENSSL_EXTRA) && (defined(HAVE_BLAKE2B) || defined(HAVE_BLAKE2S))
const EVP_MD* md = NULL;
(void)md;
#if defined(HAVE_BLAKE2)
#if defined(HAVE_BLAKE2B)
ExpectNotNull(md = EVP_blake2b512());
ExpectIntEQ(XSTRNCMP(md, "BLAKE2b512", XSTRLEN("BLAKE2b512")), 0);
#endif
+8 -4
View File
@@ -117,10 +117,10 @@ static const enum wc_HashType notCompiledHash[] = {
#ifdef NO_MD4
WC_HASH_TYPE_MD4,
#endif
#if !defined(HAVE_BLAKE2) && !defined(HAVE_BLAKE2S)
#ifndef HAVE_BLAKE2B
WC_HASH_TYPE_BLAKE2B,
#endif
#if !defined(HAVE_BLAKE2) && !defined(HAVE_BLAKE2B)
#ifndef HAVE_BLAKE2S
WC_HASH_TYPE_BLAKE2S,
#endif
WC_HASH_TYPE_NONE /* Dummy value to ensure list is non-zero. */
@@ -145,8 +145,10 @@ static const enum wc_HashType sizeSupportedHash[] = {
#ifndef NO_MD4
WC_HASH_TYPE_MD4,
#endif
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#ifdef HAVE_BLAKE2B
WC_HASH_TYPE_BLAKE2B,
#endif
#ifdef HAVE_BLAKE2S
WC_HASH_TYPE_BLAKE2S,
#endif
WC_HASH_TYPE_NONE /* Dummy value to ensure list is non-zero. */
@@ -163,8 +165,10 @@ static const enum wc_HashType sizeNotCompiledHash[] = {
#ifdef NO_MD4
WC_HASH_TYPE_MD4,
#endif
#if !defined(HAVE_BLAKE2) && !defined(HAVE_BLAKE2S)
#ifndef HAVE_BLAKE2B
WC_HASH_TYPE_BLAKE2B,
#endif
#ifndef HAVE_BLAKE2S
WC_HASH_TYPE_BLAKE2S,
#endif
WC_HASH_TYPE_SHAKE128,
+4 -4
View File
@@ -1168,7 +1168,7 @@ static const bench_alg bench_digest_opt[] = {
#ifdef WOLFSSL_RIPEMD
{ "-ripemd", BENCH_RIPEMD },
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
{ "-blake2b", BENCH_BLAKE2B },
#endif
#ifdef HAVE_BLAKE2S
@@ -2014,7 +2014,7 @@ static const char* bench_result_words3[][5] = {
#include <wolfssl/certs_test.h>
#endif
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2B) || defined(HAVE_BLAKE2S)
#include <wolfssl/wolfcrypt/blake2.h>
#endif
@@ -4133,7 +4133,7 @@ static void* benchmarks_do(void* args)
if (bench_all || (bench_digest_algs & BENCH_RIPEMD))
bench_ripemd();
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
if (bench_all || (bench_digest_algs & BENCH_BLAKE2B))
bench_blake2b();
#endif
@@ -8851,7 +8851,7 @@ void bench_ripemd(void)
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
void bench_blake2b(void)
{
Blake2b b2b;
+2 -2
View File
@@ -33,7 +33,7 @@
#include <wolfssl/wolfcrypt/libwolfssl_sources.h>
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
#include <wolfssl/wolfcrypt/blake2.h>
#include <wolfssl/wolfcrypt/blake2-impl.h>
@@ -603,4 +603,4 @@ int wc_Blake2bHmac(const byte* in, size_t in_len,
/* end wolfCrypt API */
#endif /* HAVE_BLAKE2 */
#endif /* HAVE_BLAKE2B */
+8 -8
View File
@@ -98,7 +98,7 @@ static const struct s_ent {
#ifdef WOLFSSL_SM3
{WC_HASH_TYPE_SM3, WC_NID_sm3, WC_SN_sm3},
#endif /* WOLFSSL_SHA512 */
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
{WC_HASH_TYPE_BLAKE2B, WC_NID_blake2b512, WC_SN_blake2b512},
#endif
#ifdef HAVE_BLAKE2S
@@ -4780,11 +4780,11 @@ static unsigned int wolfssl_mac_len(unsigned char macType)
break;
#endif /* WOLFSSL_SHA512 */
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
case BLAKE2B_ID:
hashLen = BLAKE2B_OUTBYTES;
break;
#endif /* HAVE_BLAKE2 */
#endif /* HAVE_BLAKE2B */
#ifdef WOLFSSL_SHA3
#ifndef WOLFSSL_NOSHA3_224
@@ -10339,7 +10339,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
#endif /* !NO_MD5 */
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
/* return EVP_MD
* @param none
* @return "blake2b512"
@@ -10927,7 +10927,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
}
} else
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
if (XSTRCMP(md, WC_SN_blake2b512) == 0) {
if (wc_InitBlake2b(&ctx->hash.digest.blake2b,
WC_BLAKE2B_DIGEST_SIZE) != 0) {
@@ -11084,7 +11084,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
ret = NOT_COMPILED_IN;
#endif
break;
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
case WC_HASH_TYPE_BLAKE2B:
if (wc_Blake2bUpdate(&ctx->hash.digest.blake2b,
(const byte*)data, (word32)sz) == 0) {
@@ -11103,7 +11103,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
case WC_HASH_TYPE_NONE:
case WC_HASH_TYPE_MD2:
case WC_HASH_TYPE_MD5_SHA:
#ifndef HAVE_BLAKE2
#ifndef HAVE_BLAKE2B
case WC_HASH_TYPE_BLAKE2B:
#endif
#ifndef HAVE_BLAKE2S
@@ -11241,7 +11241,7 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
#endif
break;
case WC_HASH_TYPE_BLAKE2B:
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
if (wc_Blake2bFinal(&ctx->hash.digest.blake2b, md,
WC_BLAKE2B_DIGEST_SIZE) == 0) {
if (s) *s = WC_BLAKE2B_DIGEST_SIZE;
+2 -2
View File
@@ -483,7 +483,7 @@ int wc_HashGetDigestSize(enum wc_HashType hash_type)
#endif
break;
case WC_HASH_TYPE_BLAKE2S:
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2S)
dig_size = BLAKE2S_OUTBYTES;
#else
dig_size = HASH_TYPE_E;
@@ -639,7 +639,7 @@ int wc_HashGetBlockSize(enum wc_HashType hash_type)
#endif
break;
case WC_HASH_TYPE_BLAKE2S:
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2S)
block_size = BLAKE2S_BLOCKBYTES;
#else
block_size = HASH_TYPE_E;
+1 -1
View File
@@ -3431,7 +3431,7 @@ int IntelQaSymSha3(WC_ASYNC_DEV* dev, byte* out, const byte* in, word32 sz)
}
break;
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
case BLAKE2B_ID:
#endif
#ifdef WOLFSSL_SHA3
+45 -8
View File
@@ -422,7 +422,7 @@ static const byte const_byte_array[] = "A+Gd\0\0\0";
#ifdef WOLFCRYPT_HAVE_SAKKE
#include <wolfssl/wolfcrypt/sakke.h>
#endif
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2B) || defined(HAVE_BLAKE2S)
#include <wolfssl/wolfcrypt/blake2.h>
#endif
#ifdef WOLFSSL_SHA3
@@ -795,7 +795,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t scrypt_test(void);
#ifdef WOLFCRYPT_HAVE_SAKKE
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sakke_test(void);
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_test(void);
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_hmac_test(void);
#endif
@@ -2237,7 +2237,7 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
TEST_PASS("RIPEMD test passed!\n");
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
if ( (ret = blake2b_test()) != 0)
TEST_FAIL("BLAKE2b test failed!\n", ret);
else
@@ -4706,7 +4706,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ripemd_test(void)
#endif /* WOLFSSL_RIPEMD */
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
#define BLAKE2B_TESTS 3
@@ -4864,7 +4864,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_hmac_test(void)
return 0;
}
#endif /* HAVE_BLAKE2 */
#endif /* HAVE_BLAKE2B */
#ifdef HAVE_BLAKE2S
@@ -7659,8 +7659,11 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void)
#if defined(NO_MD5) || defined(NO_SHA)
WC_HASH_TYPE_MD5_SHA,
#endif
#if !defined(HAVE_BLAKE2) && !defined(HAVE_BLAKE2S)
#if !defined(HAVE_BLAKE2B)
WC_HASH_TYPE_BLAKE2B,
#endif
#if !defined(HAVE_BLAKE2S)
WC_HASH_TYPE_BLAKE2S,
#endif
WC_HASH_TYPE_NONE };
@@ -7941,9 +7944,43 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void)
if (ret != WC_NO_ERR_TRACE(HASH_TYPE_E))
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
#endif
ret = wc_HashGetDigestSize(WC_HASH_TYPE_MD5_SHA);
#if !defined(NO_MD5) && !defined(NO_SHA)
if (ret == WC_NO_ERR_TRACE(HASH_TYPE_E) ||
ret == WC_NO_ERR_TRACE(BAD_FUNC_ARG))
{
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
}
#else
if (ret != WC_NO_ERR_TRACE(HASH_TYPE_E))
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
#endif
ret = wc_HashGetBlockSize(WC_HASH_TYPE_BLAKE2S);
#if defined(HAVE_BLAKE2S)
if (ret == WC_NO_ERR_TRACE(HASH_TYPE_E) ||
ret == WC_NO_ERR_TRACE(BAD_FUNC_ARG))
{
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
}
#else
if (ret != WC_NO_ERR_TRACE(HASH_TYPE_E))
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
#endif
ret = wc_HashGetDigestSize(WC_HASH_TYPE_BLAKE2S);
#if defined(HAVE_BLAKE2S)
if (ret == WC_NO_ERR_TRACE(HASH_TYPE_E) ||
ret == WC_NO_ERR_TRACE(BAD_FUNC_ARG))
{
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
}
#else
if (ret != WC_NO_ERR_TRACE(HASH_TYPE_E))
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
#endif
ret = wc_HashGetBlockSize(WC_HASH_TYPE_BLAKE2B);
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2B)
if (ret == WC_NO_ERR_TRACE(HASH_TYPE_E) ||
ret == WC_NO_ERR_TRACE(BAD_FUNC_ARG))
{
@@ -7954,7 +7991,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hash_test(void)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
#endif
ret = wc_HashGetDigestSize(WC_HASH_TYPE_BLAKE2B);
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2B)
if (ret == WC_NO_ERR_TRACE(HASH_TYPE_E) ||
ret == WC_NO_ERR_TRACE(BAD_FUNC_ARG))
{
+1 -1
View File
@@ -328,7 +328,7 @@ extern WOLFSSL_TEST_SUBROUTINE wc_test_ret_t scrypt_test(void);
#ifdef WOLFCRYPT_HAVE_SAKKE
extern WOLFSSL_TEST_SUBROUTINE wc_test_ret_t sakke_test(void);
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
extern WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_test(void);
extern WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_hmac_test(void);
#endif
+2 -2
View File
@@ -61,7 +61,7 @@
#ifdef WOLFSSL_SM3
#include <wolfssl/wolfcrypt/sm3.h>
#endif
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2B) || defined(HAVE_BLAKE2S)
#include <wolfssl/wolfcrypt/blake2.h>
#endif
#ifdef WOLFSSL_SM4
@@ -227,7 +227,7 @@ typedef union {
#if defined(WOLFSSL_SHAKE128) || defined(WOLFSSL_SHAKE256)
wc_Shake shake;
#endif
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
Blake2b blake2b;
#endif
#ifdef HAVE_BLAKE2S
+2 -2
View File
@@ -28,7 +28,7 @@
#include <wolfssl/wolfcrypt/settings.h>
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2B) || defined(HAVE_BLAKE2S)
#include <wolfssl/wolfcrypt/blake2-int.h>
@@ -121,6 +121,6 @@ WOLFSSL_API int wc_Blake2sHmac(const byte* in, size_t in_len,
}
#endif
#endif /* HAVE_BLAKE2 || HAVE_BLAKE2S */
#endif /* HAVE_BLAKE2B || HAVE_BLAKE2S */
#endif /* WOLF_CRYPT_BLAKE2_H */
+2 -2
View File
@@ -40,7 +40,7 @@
#if defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512)
#include <wolfssl/wolfcrypt/sha512.h>
#endif
#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S)
#if defined(HAVE_BLAKE2B) || defined(HAVE_BLAKE2S)
#include <wolfssl/wolfcrypt/blake2.h>
#endif
#ifdef WOLFSSL_SHA3
@@ -131,7 +131,7 @@ typedef struct {
#elif defined(WOLFSSL_SHA512)
#define WC_MAX_DIGEST_SIZE WC_SHA512_DIGEST_SIZE
#define WC_MAX_BLOCK_SIZE WC_SHA512_BLOCK_SIZE
#elif defined(HAVE_BLAKE2)
#elif defined(HAVE_BLAKE2B)
#define WC_MAX_DIGEST_SIZE BLAKE2B_OUTBYTES
#define WC_MAX_BLOCK_SIZE BLAKE2B_BLOCKBYTES
#elif defined(WOLFSSL_SHA384)
+8 -1
View File
@@ -769,7 +769,6 @@
* the "enable all" feature: */
#if defined(TEST_ESPIDF_ALL_WOLFSSL)
#define WOLFSSL_MD2
#define HAVE_BLAKE2
#define HAVE_BLAKE2B
#define HAVE_BLAKE2S
@@ -5058,6 +5057,14 @@ extern void uITRON4_free(void *p) ;
" requires ED448 (HAVE_ED448)"
#endif
/* Accommodate legacy BLAKE gate. */
#ifdef HAVE_BLAKE2
#ifndef HAVE_BLAKE2B
#define HAVE_BLAKE2B
#endif
#undef HAVE_BLAKE2
#endif
/* QUIC Rules */
#if !defined(WOLFCRYPT_ONLY) && defined(WOLFSSL_QUIC) && \
!defined(WOLFSSL_TLS13)
-1
View File
@@ -236,7 +236,6 @@ extern "C" {
#define HAVE_X963_KDF
#define WOLFSSL_CMAC
#define WOLFSSL_DES_ECB
#define HAVE_BLAKE2
#define HAVE_BLAKE2B
#define HAVE_BLAKE2S
#define WOLFSSL_SIPHASH