Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions IDE/MDK5-ARM/Conf/user_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions IDE/RISCV/SIFIVE-HIFIVE1/user_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ extern "C" {
#endif

/* Blake2B */
#undef HAVE_BLAKE2
#undef HAVE_BLAKE2B
#if 0
#define HAVE_BLAKE2
#define HAVE_BLAKE2B
#endif

/* Blake2S */
Expand Down
6 changes: 3 additions & 3 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down
21 changes: 13 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -4442,15 +4442,21 @@ fi


# BLAKE2
AC_ARG_ENABLE([blake2b],
[AS_HELP_STRING([--enable-blake2b],[Enable wolfSSL BLAKE2b support (default: disabled)])],
[ ENABLED_BLAKE2B=$enableval ],
[ ENABLED_BLAKE2B=no ]
)

# Backward-compat synonym for blake2b:
AC_ARG_ENABLE([blake2],
[AS_HELP_STRING([--enable-blake2],[Enable wolfSSL BLAKE2b support (default: disabled)])],
[ ENABLED_BLAKE2=$enableval ],
[ ENABLED_BLAKE2=no ]
[ ENABLED_BLAKE2B=$enableval ]
)

if test "$ENABLED_BLAKE2" = "yes"
if test "$ENABLED_BLAKE2B" = "yes"
then
AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2 -DHAVE_BLAKE2B"
AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2B"
fi


Expand All @@ -4463,7 +4469,6 @@ AC_ARG_ENABLE([blake2s],
if test "$ENABLED_BLAKE2S" = "yes"
then
AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2S"
ENABLED_BLAKE2="yes"
fi


Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion examples/configs/user_settings_all.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion examples/configs/user_settings_openssl_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ extern "C" {
#define WOLFSSL_SHA3
#define WOLFSSL_SHAKE256

#define HAVE_BLAKE2
#define HAVE_BLAKE2B
#define HAVE_BLAKE2S

Expand Down
1 change: 0 additions & 1 deletion examples/configs/user_settings_platformio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion linuxkm/module_exports.c.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions tests/api/test_blake2.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
int test_wc_InitBlake2b(void)
{
EXPECT_DECLS;
#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
Blake2b blake;

/* Test bad arg. */
Expand All @@ -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];
Expand Down Expand Up @@ -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);
Expand All @@ -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];

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions tests/api/test_evp_digest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions tests/api/test_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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. */
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions wolfcrypt/benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -8851,7 +8851,7 @@ void bench_ripemd(void)
#endif


#ifdef HAVE_BLAKE2
#ifdef HAVE_BLAKE2B
void bench_blake2b(void)
{
Blake2b b2b;
Expand Down
4 changes: 2 additions & 2 deletions wolfcrypt/src/blake2b.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -603,4 +603,4 @@ int wc_Blake2bHmac(const byte* in, size_t in_len,

/* end wolfCrypt API */

#endif /* HAVE_BLAKE2 */
#endif /* HAVE_BLAKE2B */
Loading
Loading