diff --git a/.gitignore b/.gitignore index d8c0423d5..91b6af694 100644 --- a/.gitignore +++ b/.gitignore @@ -78,6 +78,7 @@ tests/unit testsuite/testsuite.test tests/unit.test tests/bio_write_test.txt +tests/test-log-dump-to-file.txt test-write-dhparams.pem testsuite/*.der testsuite/*.pem diff --git a/Makefile.am b/Makefile.am index 1ef320fc5..60a5a57ae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,6 +135,7 @@ EXTRA_DIST+= wolfssl-ntru.sln EXTRA_DIST+= wolfssl.sln EXTRA_DIST+= wolfssl64.sln EXTRA_DIST+= valgrind-error.sh +EXTRA_DIST+= valgrind-bash.supp EXTRA_DIST+= fips-hash.sh EXTRA_DIST+= gencertbuf.pl EXTRA_DIST+= README.md diff --git a/configure.ac b/configure.ac index e9bc085ff..0b54ebaf6 100644 --- a/configure.ac +++ b/configure.ac @@ -1029,6 +1029,8 @@ then *aarch64*) # +crypto needed for hardware acceleration AM_CPPFLAGS="$AM_CPPFLAGS -mcpu=generic+crypto" + # Include options.h + AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN" # Check for and set -mstrict-align compiler flag # Used to set assumption that Aarch64 systems will not handle @@ -1048,6 +1050,8 @@ then AC_MSG_NOTICE([64bit ARMv8 found, setting mcpu to generic+crypto]);; *) AM_CPPFLAGS="$AM_CPPFLAGS -mfpu=crypto-neon-fp-armv8" + # Include options.h + AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN" AC_MSG_NOTICE([32bit ARMv8 found, setting mfpu to crypto-neon-fp-armv8]);; esac esac diff --git a/tests/api.c b/tests/api.c index 3795aed27..ef0f1912d 100644 --- a/tests/api.c +++ b/tests/api.c @@ -19602,6 +19602,9 @@ static int test_wc_ecc_import_raw(void) } #ifdef WOLFSSL_VALIDATE_ECC_IMPORT if (ret == BAD_FUNC_ARG) { + #if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH) + wc_ecc_free(&key); + #endif ret = wc_ecc_import_raw(&key, kNullStr, kNullStr, kNullStr, curveName); if (ret == ECC_INF_E) ret = BAD_FUNC_ARG; /* This is expected by other tests */ @@ -19609,9 +19612,15 @@ static int test_wc_ecc_import_raw(void) #endif #if !defined(HAVE_SELFTEST) && !defined(HAVE_FIPS) if (ret == BAD_FUNC_ARG) { + #if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH) + wc_ecc_free(&key); + #endif ret = wc_ecc_import_raw(&key, "0", qy, d, curveName); } if (ret == BAD_FUNC_ARG) { + #if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH) + wc_ecc_free(&key); + #endif ret = wc_ecc_import_raw(&key, qx, "0", d, curveName); } #endif @@ -20667,8 +20676,9 @@ static int test_wc_ecc_is_valid_idx (void) static int test_ToTraditional (void) { int ret = 0; -#if defined(WOLFSSL_TEST_CERT) || defined(OPENSSL_EXTRA) || \ - defined(OPENSSL_EXTRA_X509_SMALL) +#if !defined(NO_ASN) && (defined(HAVE_PKCS8) || defined(HAVE_PKCS12)) && \ + (defined(WOLFSSL_TEST_CERT) || defined(OPENSSL_EXTRA) || \ + defined(OPENSSL_EXTRA_X509_SMALL)) XFILE f; byte input[TWOK_BUF]; @@ -20710,8 +20720,9 @@ static int test_ToTraditional (void) #endif return ret; }/* End test_ToTraditional*/ + /* - * Testing wc_Ed25519KeyToDer + * Testing wc_EccPrivateKeyToDer */ static int test_wc_EccPrivateKeyToDer (void) { @@ -20772,6 +20783,7 @@ static int test_wc_EccPrivateKeyToDer (void) #endif return ret; }/* End test_wc_EccPrivateKeyToDer*/ + /* * Testing wc_Ed25519KeyToDer */ diff --git a/valgrind-bash.supp b/valgrind-bash.supp new file mode 100644 index 000000000..87c9e499d --- /dev/null +++ b/valgrind-bash.supp @@ -0,0 +1,8 @@ +{ + linux_bash_locale_leak + Memcheck:Leak + fun:malloc + fun:xmalloc + fun:set_default_locale + fun:main +} diff --git a/valgrind-error.sh b/valgrind-error.sh index 7f7441c3e..4cb6be7ca 100755 --- a/valgrind-error.sh +++ b/valgrind-error.sh @@ -3,20 +3,22 @@ # # Our valgrind "error" wrapper. -valgrind --leak-check=full -q "$@" 2> valgrind.tmp +TMP="valgrind.tmp.$$" + +valgrind --suppressions=valgrind-bash.supp --leak-check=full -q "$@" 2> $TMP result="$?" # verify no errors -output="`cat valgrind.tmp`" +output="`cat $TMP`" if [ "$output" != "" ]; then - cat valgrind.tmp >&2 + cat $TMP >&2 result=1 fi -rm valgrind.tmp +rm $TMP exit $result diff --git a/wolfcrypt/src/port/arm/armv8-sha256.c b/wolfcrypt/src/port/arm/armv8-sha256.c index 7f214d47c..69b03dd60 100644 --- a/wolfcrypt/src/port/arm/armv8-sha256.c +++ b/wolfcrypt/src/port/arm/armv8-sha256.c @@ -1081,7 +1081,7 @@ static WC_INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) /* store lengths */ #if defined(LITTLE_ENDIAN_ORDER) { - word32* bufPt = sha256->buffer; + word32* bufPt = sha256->buffer; __asm__ volatile ( "VLD1.32 {q0}, [%[in]] \n" "VREV32.8 q0, q0 \n" @@ -1106,7 +1106,7 @@ static WC_INLINE int Sha256Final(wc_Sha256* sha256, byte* hash) XMEMCPY(&local[WC_SHA256_PAD_SIZE + sizeof(word32)], &sha256->loLen, sizeof(word32)); - bufPt = sha256->buffer; + word32* bufPt = sha256->buffer; word32* digPt = sha256->digest; __asm__ volatile ( "#load leftover data\n" diff --git a/wolfssl/wolfcrypt/poly1305.h b/wolfssl/wolfcrypt/poly1305.h index fc84b5187..790ed5db1 100644 --- a/wolfssl/wolfcrypt/poly1305.h +++ b/wolfssl/wolfcrypt/poly1305.h @@ -119,6 +119,12 @@ WOLFSSL_API int wc_Poly1305_EncodeSizes(Poly1305* ctx, word32 aadSz, word32 data WOLFSSL_API int wc_Poly1305_MAC(Poly1305* ctx, byte* additional, word32 addSz, byte* input, word32 sz, byte* tag, word32 tagSz); +#if defined(__aarch64__ ) && defined(WOLFSSL_ARMASM) +void poly1305_blocks(Poly1305* ctx, const unsigned char *m, + size_t bytes); +void poly1305_block(Poly1305* ctx, const unsigned char *m); +#endif + #ifdef __cplusplus } /* extern "C" */ #endif