2015-07-01 21:12:54 +03:00
|
|
|
/* unit.c API unit tests driver
|
|
|
|
*
|
2024-07-19 22:15:05 +03:00
|
|
|
* Copyright (C) 2006-2024 wolfSSL Inc.
|
2015-07-01 21:12:54 +03:00
|
|
|
*
|
2016-03-18 01:02:13 +03:00
|
|
|
* This file is part of wolfSSL.
|
2015-07-01 21:12:54 +03:00
|
|
|
*
|
|
|
|
* wolfSSL is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* wolfSSL is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2016-03-18 01:02:13 +03:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
2015-07-01 21:12:54 +03:00
|
|
|
*/
|
2014-12-29 20:27:03 +03:00
|
|
|
|
2016-03-18 01:02:13 +03:00
|
|
|
|
2015-02-18 00:20:10 +03:00
|
|
|
/* Name change compatibility layer no longer need to be included here */
|
2014-12-29 20:27:03 +03:00
|
|
|
|
2024-10-31 03:28:39 +03:00
|
|
|
#include <tests/unit.h>
|
2012-09-22 00:29:04 +04:00
|
|
|
|
2023-05-24 12:58:41 +03:00
|
|
|
#include <wolfssl/wolfcrypt/types.h>
|
2013-04-10 23:17:23 +04:00
|
|
|
|
2011-12-14 21:20:46 +04:00
|
|
|
#include <stdio.h>
|
2021-04-06 18:54:45 +03:00
|
|
|
#include <wolfssl/wolfcrypt/fips_test.h>
|
2011-12-14 21:20:46 +04:00
|
|
|
|
2012-08-03 00:41:40 +04:00
|
|
|
|
2022-11-29 04:11:59 +03:00
|
|
|
int allTesting = 1;
|
2023-05-26 08:49:14 +03:00
|
|
|
int apiTesting = 1;
|
2012-08-03 00:41:40 +04:00
|
|
|
int myoptind = 0;
|
|
|
|
char* myoptarg = NULL;
|
2014-05-09 02:52:20 +04:00
|
|
|
int unit_test(int argc, char** argv);
|
2012-08-03 00:41:40 +04:00
|
|
|
|
2014-05-09 02:52:20 +04:00
|
|
|
#ifndef NO_TESTSUITE_MAIN_DRIVER
|
2011-12-14 21:20:46 +04:00
|
|
|
int main(int argc, char** argv)
|
2014-05-09 02:52:20 +04:00
|
|
|
{
|
|
|
|
return unit_test(argc, argv);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-11-29 04:11:59 +03:00
|
|
|
/* Print usage options for unit test.
|
|
|
|
*/
|
|
|
|
static void UnitTest_Usage(void)
|
|
|
|
{
|
|
|
|
printf("Usage: ./tests/unit.test <options>\n");
|
|
|
|
printf(" -?, --help Display this usage information.\n");
|
|
|
|
printf(" --list List the API tests.\n");
|
|
|
|
printf(" --api Only perform API tests.\n");
|
|
|
|
printf(" -<number> Run the API test identified by number.\n");
|
|
|
|
printf(" Can be specified multiple times.\n");
|
|
|
|
printf(" -<string> Run the API test identified by name.\n");
|
|
|
|
printf(" Can be specified multiple times.\n");
|
|
|
|
printf(" <filename> Name of cipher suite testing file.\n");
|
|
|
|
}
|
|
|
|
|
2014-05-09 02:52:20 +04:00
|
|
|
int unit_test(int argc, char** argv)
|
2011-12-14 21:20:46 +04:00
|
|
|
{
|
Intel QuickAssist (QAT) support and async enhancements/fixes:
* Adds ./configure "--with-intelqa=../QAT1.6”, port files, memory management and README.md (see wolfcrypt/src/port/intel/).
* Added Intel QAT support for RSA public/private (CRT/non-CRT), AES CBC/GCM, ECDH/ECDSA, DH, DES3, SHA, SHA224, SHA256, SHA384, SHA512, MD5 and HMAC.
* wolfSSL async enabled all client and server: PKI, Encrypt/Decrypt, Hashing/HMAC and Certificate Sign/Verify.
* wolfSSL async support in functions: Encrypt, Decrypt, VerifyMAC, BuildMessage, ConfirmSignature, DoCertificate, ParseCertRelative, and MakeSignature.
* wolfCrypt test and benchmark async support added for all HW acceleration.
* wolfCrypt benchmark multi-threading support.
* Added QuickAssist memory overrides for XMALLOC, XFREE and XREALLOC. XREALLOC determines if existing pointer needs reallocated for NUMA.
* Refactor to make sure “heap” is available for async dev init.
* Added async support for all examples for connect, accept, read and write.
* Added new WC_BIGINT (in wolfmath.c) for async hardware support.
* Added async simulator tests for DES3 CBC, AES CBC/GCM.
* Added QAT standalone build for unit testing.
* Added int return code to SHA and MD5 functions.
* Refactor of the async stack variable handling, so async operations have generic args buffer area and cleanup function pointer.
* Combined duplicate code for async push/pop handling.
* Refactor internal.c to add AllocKey / FreeKey.
* Refactor of hash init/free in TLS to use InitHashes and FreeHashes.
* Refactor of the async event->context to use WOLF_EVENT_TYPE_ASYNC_WOLFSSL for WOLFSSL* and WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT for WC_ASYNC_DEV*.
* Suppress error message for WC_PENDING_E.
* Implemented "wolfSSL_EVP_MD_CTX_init" to do memset.
* Cleanup of the openssl compat CTX sizes when async is enabled.
* Cleanup of AES, DES3, DH, SHA, MD5, DES3, DH, HMAC, MD5 for consistency and readability.
* Cleanup of the OPAQUE_LEN.
* Cleanup to use ENCRYPT_LEN instead of sizeof(ssl->arrays.preMasterSecret).
* Changed ssl->arrays.preMasterSecret to use XMALLOC (accelerates HW operations)
* Reduce verbosity with debug enabled for "GetMyVersion", "wolfSSL Using RSA OAEP padding" and "wolfSSL Using RSA PKCSV15 padding".
* Updated RSA un-padding error message so its different than one above it for better debugging.
* Added QAT async enables for each algorithm.
* Refactor of the async init to use _ex.
* Added WC_ASYNC_THRESH_NONE to allow bypass of the async thresholds for testing.
* Reformatted the benchmark results:
PKI: "RSA 2048 private HW 18522 ops took 1.003 sec, avg 0.054 ms, 18467.763 ops/sec"
Crypto/Hashing: SHA-256 SW 350 megs took 1.009 seconds, 346.946 MB/s Cycles per byte = 9.87
* Added min execution time for all benchmarks.
* Moved wc_*GetHash and wc_*RestorePos to appropriate files so use of isCopy flag is local.
* Fix for ECC sign status sometimes being invalid due to uninitialized ECC digest in benchmark.
* Added new DECLARE_VAR/FREE_VAR and DECLARE_ARRAY/FREE_ARRAY macros for helping setup test/benchmark variables to accelerate async.
* Added NO_SW_BENCH option to only run HW bench.
* Added support for PRNG to use hardware SHA256 if _wc devId provided.
* Fix to prevent curve tests from running against wrong curve sizes. Changed wc_ecc_set_curve to match on exact size.
* Added the wc_*GetHash calls to the wolfCrypt tests.
* Added async hardware start/stop to wolfSSL init/cleanup.
* Refactor to add wc_*Copy for hashing context (for async), which replaces wc_*RestorePos.
* Fixes for building with TI hashing (including: SHA224, missing new API’s and building with dummy build for non hw testing). Note: We need to add build test for this `./configure CFLAGS="-DWOLFSSL_TI_HASH -DTI_DUMMY_BUILD”`.
* Added arg checks on wc_*GetHash and wc_*Copy.
* Cleanup of the BuildMD5, BuildSHA, BuildMD5_CertVerify and BuildSHA_CertVerify functions.
* Added new ./configure --enable-asyncthreads, to allow enable/disable of the async threading support. If --enable-asynccrypt set this will be enabled by default if pthread is supported. Allows multi-threaded benchmarks with async simulator.
* Added checks for all hashing to verify valid ->buffLen.
* Fix for SHA512 scan-build warning about un-initialized “W_X”.
* Fix for valgrind un-initialized use of buffer in AllocDer (der->buffer) and BuildTlsFinished handshake_hash.
* Refactor of the benchmarking to use common function for start, check and finish of the stats.
* Fixed issue with ECC cache loading in multi-threading.
* Fix bug with AESNI not aligned code that assumes XMALLOC is 16-byte aligned.
* Added new WC_ASYNC_NO_… options to allow disabling of individual async algorithms. New defines are: WC_ASYNC_NO_CRYPT, WC_ASYNC_NO_PKI and WC_ASYNC_NO_HASH. Additionally each algorithm has a WC_ASYNC_NO_[ALGO] define.
* Added “wolfSSL_GetAllocators” API and fixed the wolfCrypt memcb_test so it restores callback pointers after test is complete (fixes issue with using custom allocators and test breaking it).
2017-04-08 01:46:32 +03:00
|
|
|
int ret = 0;
|
2011-12-14 21:20:46 +04:00
|
|
|
|
2012-09-21 02:39:15 +04:00
|
|
|
(void)argc;
|
|
|
|
(void)argv;
|
2018-07-27 20:16:14 +03:00
|
|
|
#ifdef WOLFSSL_FORCE_MALLOC_FAIL_TEST
|
|
|
|
if (argc > 1) {
|
2021-09-14 08:58:14 +03:00
|
|
|
int memFailCount = atoi(argv[1]);
|
2022-07-12 06:27:43 +03:00
|
|
|
fprintf(stderr, "\n--- SET RNG MALLOC FAIL AT %d---\n", memFailCount);
|
2018-07-27 20:16:14 +03:00
|
|
|
wolfSSL_SetMemFailCount(memFailCount);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-10-30 02:39:42 +04:00
|
|
|
printf("starting unit tests...\n");
|
2022-07-12 06:27:43 +03:00
|
|
|
fflush(stdout);
|
2011-12-14 22:02:05 +04:00
|
|
|
|
2015-09-24 00:42:48 +03:00
|
|
|
#if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND)
|
|
|
|
wolfSSL_Debugging_ON();
|
|
|
|
#endif
|
2013-02-02 00:21:38 +04:00
|
|
|
|
2021-03-25 02:45:19 +03:00
|
|
|
#ifdef WC_RNG_SEED_CB
|
|
|
|
wc_SetSeed_Cb(wc_GenerateSeed);
|
|
|
|
#endif
|
2016-05-06 00:31:25 +03:00
|
|
|
#ifdef HAVE_WNR
|
|
|
|
if (wc_InitNetRandom(wnrConfig, NULL, 5000) != 0)
|
|
|
|
err_sys("Whitewood netRandom global config failed");
|
|
|
|
#endif /* HAVE_WNR */
|
|
|
|
|
2015-01-07 23:33:10 +03:00
|
|
|
#ifndef WOLFSSL_TIRTOS
|
2015-10-29 09:54:08 +03:00
|
|
|
ChangeToWolfRoot();
|
2014-05-09 02:52:20 +04:00
|
|
|
#endif
|
2012-12-06 22:01:01 +04:00
|
|
|
|
2021-04-06 18:54:45 +03:00
|
|
|
#if defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION == 5)
|
2021-12-11 00:44:20 +03:00
|
|
|
#if !defined(NO_AES) && !defined(NO_AES_CBC)
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_AES_CBC) != 0) {
|
|
|
|
err_sys("AES-CBC CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_AESGCM
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_AES_GCM) != 0) {
|
|
|
|
err_sys("AES-GCM CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#ifndef NO_SHA
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_HMAC_SHA1) != 0) {
|
|
|
|
err_sys("HMAC-SHA1 CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
/* the only non-optional CAST */
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_HMAC_SHA2_256) != 0) {
|
|
|
|
err_sys("HMAC-SHA2-256 CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#ifdef WOLFSSL_SHA512
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_HMAC_SHA2_512) != 0) {
|
|
|
|
err_sys("HMAC-SHA2-512 CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WOLFSSL_SHA3
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_HMAC_SHA3_256) != 0) {
|
|
|
|
err_sys("HMAC-SHA3-256 CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_HASHDRBG
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_DRBG) != 0) {
|
|
|
|
err_sys("Hash_DRBG CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#ifndef NO_RSA
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_RSA_SIGN_PKCS1v15) != 0) {
|
|
|
|
err_sys("RSA sign CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#if defined(HAVE_ECC_CDH) && defined(HAVE_ECC_CDH_CAST)
|
|
|
|
if (wc_RunCast_fips(FIPS_CAST_ECC_CDH) != 0) {
|
|
|
|
err_sys("RSA sign CAST failed");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ECC_DHE
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_ECC_PRIMITIVE_Z) != 0) {
|
|
|
|
err_sys("ECC Primitive Z CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ECC
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_ECDSA) != 0) {
|
|
|
|
err_sys("ECDSA CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#ifndef NO_DH
|
|
|
|
if (wc_RunCast_fips(FIPS_CAST_DH_PRIMITIVE_Z) != 0) {
|
|
|
|
err_sys("DH Primitive Z CAST failed");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef WOLFSSL_HAVE_PRF
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_KDF_TLS12) != 0) {
|
|
|
|
err_sys("KDF TLSv1.2 CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
2024-05-20 23:35:50 +03:00
|
|
|
#if defined(HAVE_HKDF) && !defined(NO_HMAC)
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_KDF_TLS13) != 0) {
|
|
|
|
err_sys("KDF TLSv1.3 CAST failed");
|
|
|
|
}
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif
|
|
|
|
#ifdef WOLFSSL_WOLFSSH
|
2021-04-06 18:54:45 +03:00
|
|
|
if (wc_RunCast_fips(FIPS_CAST_KDF_SSH) != 0) {
|
|
|
|
err_sys("KDF SSHv2.0 CAST failed");
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-11 00:44:20 +03:00
|
|
|
#endif /* HAVE_FIPS && HAVE_FIPS_VERSION == 5 */
|
2024-05-20 23:35:50 +03:00
|
|
|
#if FIPS_VERSION3_GT(5,2,0)
|
|
|
|
if (wc_RunAllCast_fips() != 0) {
|
|
|
|
err_sys("wc_RunAllCast_fips() failed\n");
|
|
|
|
}
|
|
|
|
#endif
|
2022-11-29 04:11:59 +03:00
|
|
|
|
|
|
|
while (argc > 1) {
|
|
|
|
if (argv[1][0] != '-') {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (XSTRCMP(argv[1], "-?") == 0 || XSTRCMP(argv[1], "--help") == 0) {
|
|
|
|
UnitTest_Usage();
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
else if (XSTRCMP(argv[1], "--list") == 0) {
|
|
|
|
ApiTest_PrintTestCases();
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
else if (XSTRCMP(argv[1], "--api") == 0) {
|
2023-05-26 08:49:14 +03:00
|
|
|
allTesting = 0;
|
|
|
|
}
|
|
|
|
else if (XSTRCMP(argv[1], "--no-api") == 0) {
|
|
|
|
apiTesting = 0;
|
2022-11-29 04:11:59 +03:00
|
|
|
}
|
|
|
|
else if (argv[1][1] >= '0' && argv[1][1] <= '9') {
|
|
|
|
ret = ApiTest_RunIdx(atoi(argv[1] + 1));
|
|
|
|
if (ret != 0) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2023-05-26 08:49:14 +03:00
|
|
|
allTesting = 0;
|
2022-11-29 04:11:59 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = ApiTest_RunName(argv[1] + 1);
|
|
|
|
if (ret != 0) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2023-05-26 08:49:14 +03:00
|
|
|
allTesting = 0;
|
2022-11-29 04:11:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
argc--;
|
|
|
|
argv++;
|
|
|
|
}
|
|
|
|
|
2021-10-28 15:46:15 +03:00
|
|
|
#ifdef WOLFSSL_ALLOW_SKIP_UNIT_TESTS
|
|
|
|
if (argc == 1)
|
|
|
|
#endif
|
|
|
|
{
|
2023-05-26 08:49:14 +03:00
|
|
|
if (apiTesting) {
|
|
|
|
ret = ApiTest();
|
|
|
|
if (ret != 0)
|
|
|
|
goto exit;
|
|
|
|
}
|
2012-08-07 04:14:31 +04:00
|
|
|
|
2022-11-29 04:11:59 +03:00
|
|
|
if (!allTesting) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ret = HashTest()) != 0) {
|
2022-07-12 06:27:43 +03:00
|
|
|
fprintf(stderr, "hash test failed with %d\n", ret);
|
2021-10-28 15:46:15 +03:00
|
|
|
goto exit;
|
|
|
|
}
|
2022-05-30 12:17:03 +03:00
|
|
|
|
2022-11-29 04:11:59 +03:00
|
|
|
#ifdef WOLFSSL_W64_WRAPPER
|
2022-05-30 12:17:03 +03:00
|
|
|
if ((ret = w64wrapper_test()) != 0) {
|
2022-07-12 06:27:43 +03:00
|
|
|
fprintf(stderr, "w64wrapper test failed with %d\n", ret);
|
2022-05-30 12:17:03 +03:00
|
|
|
goto exit;
|
|
|
|
}
|
2022-11-29 04:11:59 +03:00
|
|
|
#endif /* WOLFSSL_W64_WRAPPER */
|
2022-05-30 12:17:03 +03:00
|
|
|
|
2022-11-29 04:11:59 +03:00
|
|
|
#ifdef WOLFSSL_QUIC
|
|
|
|
if ((ret = QuicTest()) != 0) {
|
|
|
|
printf("quic test failed with %d\n", ret);
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
#endif
|
2012-08-07 04:14:31 +04:00
|
|
|
|
2022-11-29 04:11:59 +03:00
|
|
|
SrpTest();
|
2022-08-17 22:25:38 +03:00
|
|
|
}
|
|
|
|
|
2024-08-01 20:27:22 +03:00
|
|
|
#if !defined(NO_WOLFSSL_CIPHER_SUITE_TEST) && \
|
|
|
|
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) && \
|
|
|
|
!defined(SINGLE_THREADED)
|
2022-11-29 04:11:59 +03:00
|
|
|
if ((ret = SuiteTest(argc, argv)) != 0) {
|
2022-07-12 06:27:43 +03:00
|
|
|
fprintf(stderr, "suite test failed with %d\n", ret);
|
Intel QuickAssist (QAT) support and async enhancements/fixes:
* Adds ./configure "--with-intelqa=../QAT1.6”, port files, memory management and README.md (see wolfcrypt/src/port/intel/).
* Added Intel QAT support for RSA public/private (CRT/non-CRT), AES CBC/GCM, ECDH/ECDSA, DH, DES3, SHA, SHA224, SHA256, SHA384, SHA512, MD5 and HMAC.
* wolfSSL async enabled all client and server: PKI, Encrypt/Decrypt, Hashing/HMAC and Certificate Sign/Verify.
* wolfSSL async support in functions: Encrypt, Decrypt, VerifyMAC, BuildMessage, ConfirmSignature, DoCertificate, ParseCertRelative, and MakeSignature.
* wolfCrypt test and benchmark async support added for all HW acceleration.
* wolfCrypt benchmark multi-threading support.
* Added QuickAssist memory overrides for XMALLOC, XFREE and XREALLOC. XREALLOC determines if existing pointer needs reallocated for NUMA.
* Refactor to make sure “heap” is available for async dev init.
* Added async support for all examples for connect, accept, read and write.
* Added new WC_BIGINT (in wolfmath.c) for async hardware support.
* Added async simulator tests for DES3 CBC, AES CBC/GCM.
* Added QAT standalone build for unit testing.
* Added int return code to SHA and MD5 functions.
* Refactor of the async stack variable handling, so async operations have generic args buffer area and cleanup function pointer.
* Combined duplicate code for async push/pop handling.
* Refactor internal.c to add AllocKey / FreeKey.
* Refactor of hash init/free in TLS to use InitHashes and FreeHashes.
* Refactor of the async event->context to use WOLF_EVENT_TYPE_ASYNC_WOLFSSL for WOLFSSL* and WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT for WC_ASYNC_DEV*.
* Suppress error message for WC_PENDING_E.
* Implemented "wolfSSL_EVP_MD_CTX_init" to do memset.
* Cleanup of the openssl compat CTX sizes when async is enabled.
* Cleanup of AES, DES3, DH, SHA, MD5, DES3, DH, HMAC, MD5 for consistency and readability.
* Cleanup of the OPAQUE_LEN.
* Cleanup to use ENCRYPT_LEN instead of sizeof(ssl->arrays.preMasterSecret).
* Changed ssl->arrays.preMasterSecret to use XMALLOC (accelerates HW operations)
* Reduce verbosity with debug enabled for "GetMyVersion", "wolfSSL Using RSA OAEP padding" and "wolfSSL Using RSA PKCSV15 padding".
* Updated RSA un-padding error message so its different than one above it for better debugging.
* Added QAT async enables for each algorithm.
* Refactor of the async init to use _ex.
* Added WC_ASYNC_THRESH_NONE to allow bypass of the async thresholds for testing.
* Reformatted the benchmark results:
PKI: "RSA 2048 private HW 18522 ops took 1.003 sec, avg 0.054 ms, 18467.763 ops/sec"
Crypto/Hashing: SHA-256 SW 350 megs took 1.009 seconds, 346.946 MB/s Cycles per byte = 9.87
* Added min execution time for all benchmarks.
* Moved wc_*GetHash and wc_*RestorePos to appropriate files so use of isCopy flag is local.
* Fix for ECC sign status sometimes being invalid due to uninitialized ECC digest in benchmark.
* Added new DECLARE_VAR/FREE_VAR and DECLARE_ARRAY/FREE_ARRAY macros for helping setup test/benchmark variables to accelerate async.
* Added NO_SW_BENCH option to only run HW bench.
* Added support for PRNG to use hardware SHA256 if _wc devId provided.
* Fix to prevent curve tests from running against wrong curve sizes. Changed wc_ecc_set_curve to match on exact size.
* Added the wc_*GetHash calls to the wolfCrypt tests.
* Added async hardware start/stop to wolfSSL init/cleanup.
* Refactor to add wc_*Copy for hashing context (for async), which replaces wc_*RestorePos.
* Fixes for building with TI hashing (including: SHA224, missing new API’s and building with dummy build for non hw testing). Note: We need to add build test for this `./configure CFLAGS="-DWOLFSSL_TI_HASH -DTI_DUMMY_BUILD”`.
* Added arg checks on wc_*GetHash and wc_*Copy.
* Cleanup of the BuildMD5, BuildSHA, BuildMD5_CertVerify and BuildSHA_CertVerify functions.
* Added new ./configure --enable-asyncthreads, to allow enable/disable of the async threading support. If --enable-asynccrypt set this will be enabled by default if pthread is supported. Allows multi-threaded benchmarks with async simulator.
* Added checks for all hashing to verify valid ->buffLen.
* Fix for SHA512 scan-build warning about un-initialized “W_X”.
* Fix for valgrind un-initialized use of buffer in AllocDer (der->buffer) and BuildTlsFinished handshake_hash.
* Refactor of the benchmarking to use common function for start, check and finish of the stats.
* Fixed issue with ECC cache loading in multi-threading.
* Fix bug with AESNI not aligned code that assumes XMALLOC is 16-byte aligned.
* Added new WC_ASYNC_NO_… options to allow disabling of individual async algorithms. New defines are: WC_ASYNC_NO_CRYPT, WC_ASYNC_NO_PKI and WC_ASYNC_NO_HASH. Additionally each algorithm has a WC_ASYNC_NO_[ALGO] define.
* Added “wolfSSL_GetAllocators” API and fixed the wolfCrypt memcb_test so it restores callback pointers after test is complete (fixes issue with using custom allocators and test breaking it).
2017-04-08 01:46:32 +03:00
|
|
|
goto exit;
|
2012-08-07 04:14:31 +04:00
|
|
|
}
|
2018-06-13 04:42:16 +03:00
|
|
|
#endif
|
2011-12-14 22:55:19 +04:00
|
|
|
|
Intel QuickAssist (QAT) support and async enhancements/fixes:
* Adds ./configure "--with-intelqa=../QAT1.6”, port files, memory management and README.md (see wolfcrypt/src/port/intel/).
* Added Intel QAT support for RSA public/private (CRT/non-CRT), AES CBC/GCM, ECDH/ECDSA, DH, DES3, SHA, SHA224, SHA256, SHA384, SHA512, MD5 and HMAC.
* wolfSSL async enabled all client and server: PKI, Encrypt/Decrypt, Hashing/HMAC and Certificate Sign/Verify.
* wolfSSL async support in functions: Encrypt, Decrypt, VerifyMAC, BuildMessage, ConfirmSignature, DoCertificate, ParseCertRelative, and MakeSignature.
* wolfCrypt test and benchmark async support added for all HW acceleration.
* wolfCrypt benchmark multi-threading support.
* Added QuickAssist memory overrides for XMALLOC, XFREE and XREALLOC. XREALLOC determines if existing pointer needs reallocated for NUMA.
* Refactor to make sure “heap” is available for async dev init.
* Added async support for all examples for connect, accept, read and write.
* Added new WC_BIGINT (in wolfmath.c) for async hardware support.
* Added async simulator tests for DES3 CBC, AES CBC/GCM.
* Added QAT standalone build for unit testing.
* Added int return code to SHA and MD5 functions.
* Refactor of the async stack variable handling, so async operations have generic args buffer area and cleanup function pointer.
* Combined duplicate code for async push/pop handling.
* Refactor internal.c to add AllocKey / FreeKey.
* Refactor of hash init/free in TLS to use InitHashes and FreeHashes.
* Refactor of the async event->context to use WOLF_EVENT_TYPE_ASYNC_WOLFSSL for WOLFSSL* and WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT for WC_ASYNC_DEV*.
* Suppress error message for WC_PENDING_E.
* Implemented "wolfSSL_EVP_MD_CTX_init" to do memset.
* Cleanup of the openssl compat CTX sizes when async is enabled.
* Cleanup of AES, DES3, DH, SHA, MD5, DES3, DH, HMAC, MD5 for consistency and readability.
* Cleanup of the OPAQUE_LEN.
* Cleanup to use ENCRYPT_LEN instead of sizeof(ssl->arrays.preMasterSecret).
* Changed ssl->arrays.preMasterSecret to use XMALLOC (accelerates HW operations)
* Reduce verbosity with debug enabled for "GetMyVersion", "wolfSSL Using RSA OAEP padding" and "wolfSSL Using RSA PKCSV15 padding".
* Updated RSA un-padding error message so its different than one above it for better debugging.
* Added QAT async enables for each algorithm.
* Refactor of the async init to use _ex.
* Added WC_ASYNC_THRESH_NONE to allow bypass of the async thresholds for testing.
* Reformatted the benchmark results:
PKI: "RSA 2048 private HW 18522 ops took 1.003 sec, avg 0.054 ms, 18467.763 ops/sec"
Crypto/Hashing: SHA-256 SW 350 megs took 1.009 seconds, 346.946 MB/s Cycles per byte = 9.87
* Added min execution time for all benchmarks.
* Moved wc_*GetHash and wc_*RestorePos to appropriate files so use of isCopy flag is local.
* Fix for ECC sign status sometimes being invalid due to uninitialized ECC digest in benchmark.
* Added new DECLARE_VAR/FREE_VAR and DECLARE_ARRAY/FREE_ARRAY macros for helping setup test/benchmark variables to accelerate async.
* Added NO_SW_BENCH option to only run HW bench.
* Added support for PRNG to use hardware SHA256 if _wc devId provided.
* Fix to prevent curve tests from running against wrong curve sizes. Changed wc_ecc_set_curve to match on exact size.
* Added the wc_*GetHash calls to the wolfCrypt tests.
* Added async hardware start/stop to wolfSSL init/cleanup.
* Refactor to add wc_*Copy for hashing context (for async), which replaces wc_*RestorePos.
* Fixes for building with TI hashing (including: SHA224, missing new API’s and building with dummy build for non hw testing). Note: We need to add build test for this `./configure CFLAGS="-DWOLFSSL_TI_HASH -DTI_DUMMY_BUILD”`.
* Added arg checks on wc_*GetHash and wc_*Copy.
* Cleanup of the BuildMD5, BuildSHA, BuildMD5_CertVerify and BuildSHA_CertVerify functions.
* Added new ./configure --enable-asyncthreads, to allow enable/disable of the async threading support. If --enable-asynccrypt set this will be enabled by default if pthread is supported. Allows multi-threaded benchmarks with async simulator.
* Added checks for all hashing to verify valid ->buffLen.
* Fix for SHA512 scan-build warning about un-initialized “W_X”.
* Fix for valgrind un-initialized use of buffer in AllocDer (der->buffer) and BuildTlsFinished handshake_hash.
* Refactor of the benchmarking to use common function for start, check and finish of the stats.
* Fixed issue with ECC cache loading in multi-threading.
* Fix bug with AESNI not aligned code that assumes XMALLOC is 16-byte aligned.
* Added new WC_ASYNC_NO_… options to allow disabling of individual async algorithms. New defines are: WC_ASYNC_NO_CRYPT, WC_ASYNC_NO_PKI and WC_ASYNC_NO_HASH. Additionally each algorithm has a WC_ASYNC_NO_[ALGO] define.
* Added “wolfSSL_GetAllocators” API and fixed the wolfCrypt memcb_test so it restores callback pointers after test is complete (fixes issue with using custom allocators and test breaking it).
2017-04-08 01:46:32 +03:00
|
|
|
exit:
|
2016-05-06 00:31:25 +03:00
|
|
|
#ifdef HAVE_WNR
|
|
|
|
if (wc_FreeNetRandom() < 0)
|
|
|
|
err_sys("Failed to free netRandom context");
|
|
|
|
#endif /* HAVE_WNR */
|
|
|
|
|
2022-07-12 06:27:43 +03:00
|
|
|
if (ret == 0) {
|
|
|
|
puts("\nunit_test: Success for all configured tests.");
|
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
|
Intel QuickAssist (QAT) support and async enhancements/fixes:
* Adds ./configure "--with-intelqa=../QAT1.6”, port files, memory management and README.md (see wolfcrypt/src/port/intel/).
* Added Intel QAT support for RSA public/private (CRT/non-CRT), AES CBC/GCM, ECDH/ECDSA, DH, DES3, SHA, SHA224, SHA256, SHA384, SHA512, MD5 and HMAC.
* wolfSSL async enabled all client and server: PKI, Encrypt/Decrypt, Hashing/HMAC and Certificate Sign/Verify.
* wolfSSL async support in functions: Encrypt, Decrypt, VerifyMAC, BuildMessage, ConfirmSignature, DoCertificate, ParseCertRelative, and MakeSignature.
* wolfCrypt test and benchmark async support added for all HW acceleration.
* wolfCrypt benchmark multi-threading support.
* Added QuickAssist memory overrides for XMALLOC, XFREE and XREALLOC. XREALLOC determines if existing pointer needs reallocated for NUMA.
* Refactor to make sure “heap” is available for async dev init.
* Added async support for all examples for connect, accept, read and write.
* Added new WC_BIGINT (in wolfmath.c) for async hardware support.
* Added async simulator tests for DES3 CBC, AES CBC/GCM.
* Added QAT standalone build for unit testing.
* Added int return code to SHA and MD5 functions.
* Refactor of the async stack variable handling, so async operations have generic args buffer area and cleanup function pointer.
* Combined duplicate code for async push/pop handling.
* Refactor internal.c to add AllocKey / FreeKey.
* Refactor of hash init/free in TLS to use InitHashes and FreeHashes.
* Refactor of the async event->context to use WOLF_EVENT_TYPE_ASYNC_WOLFSSL for WOLFSSL* and WOLF_EVENT_TYPE_ASYNC_WOLFCRYPT for WC_ASYNC_DEV*.
* Suppress error message for WC_PENDING_E.
* Implemented "wolfSSL_EVP_MD_CTX_init" to do memset.
* Cleanup of the openssl compat CTX sizes when async is enabled.
* Cleanup of AES, DES3, DH, SHA, MD5, DES3, DH, HMAC, MD5 for consistency and readability.
* Cleanup of the OPAQUE_LEN.
* Cleanup to use ENCRYPT_LEN instead of sizeof(ssl->arrays.preMasterSecret).
* Changed ssl->arrays.preMasterSecret to use XMALLOC (accelerates HW operations)
* Reduce verbosity with debug enabled for "GetMyVersion", "wolfSSL Using RSA OAEP padding" and "wolfSSL Using RSA PKCSV15 padding".
* Updated RSA un-padding error message so its different than one above it for better debugging.
* Added QAT async enables for each algorithm.
* Refactor of the async init to use _ex.
* Added WC_ASYNC_THRESH_NONE to allow bypass of the async thresholds for testing.
* Reformatted the benchmark results:
PKI: "RSA 2048 private HW 18522 ops took 1.003 sec, avg 0.054 ms, 18467.763 ops/sec"
Crypto/Hashing: SHA-256 SW 350 megs took 1.009 seconds, 346.946 MB/s Cycles per byte = 9.87
* Added min execution time for all benchmarks.
* Moved wc_*GetHash and wc_*RestorePos to appropriate files so use of isCopy flag is local.
* Fix for ECC sign status sometimes being invalid due to uninitialized ECC digest in benchmark.
* Added new DECLARE_VAR/FREE_VAR and DECLARE_ARRAY/FREE_ARRAY macros for helping setup test/benchmark variables to accelerate async.
* Added NO_SW_BENCH option to only run HW bench.
* Added support for PRNG to use hardware SHA256 if _wc devId provided.
* Fix to prevent curve tests from running against wrong curve sizes. Changed wc_ecc_set_curve to match on exact size.
* Added the wc_*GetHash calls to the wolfCrypt tests.
* Added async hardware start/stop to wolfSSL init/cleanup.
* Refactor to add wc_*Copy for hashing context (for async), which replaces wc_*RestorePos.
* Fixes for building with TI hashing (including: SHA224, missing new API’s and building with dummy build for non hw testing). Note: We need to add build test for this `./configure CFLAGS="-DWOLFSSL_TI_HASH -DTI_DUMMY_BUILD”`.
* Added arg checks on wc_*GetHash and wc_*Copy.
* Cleanup of the BuildMD5, BuildSHA, BuildMD5_CertVerify and BuildSHA_CertVerify functions.
* Added new ./configure --enable-asyncthreads, to allow enable/disable of the async threading support. If --enable-asynccrypt set this will be enabled by default if pthread is supported. Allows multi-threaded benchmarks with async simulator.
* Added checks for all hashing to verify valid ->buffLen.
* Fix for SHA512 scan-build warning about un-initialized “W_X”.
* Fix for valgrind un-initialized use of buffer in AllocDer (der->buffer) and BuildTlsFinished handshake_hash.
* Refactor of the benchmarking to use common function for start, check and finish of the stats.
* Fixed issue with ECC cache loading in multi-threading.
* Fix bug with AESNI not aligned code that assumes XMALLOC is 16-byte aligned.
* Added new WC_ASYNC_NO_… options to allow disabling of individual async algorithms. New defines are: WC_ASYNC_NO_CRYPT, WC_ASYNC_NO_PKI and WC_ASYNC_NO_HASH. Additionally each algorithm has a WC_ASYNC_NO_[ALGO] define.
* Added “wolfSSL_GetAllocators” API and fixed the wolfCrypt memcb_test so it restores callback pointers after test is complete (fixes issue with using custom allocators and test breaking it).
2017-04-08 01:46:32 +03:00
|
|
|
return ret;
|
2011-12-14 21:20:46 +04:00
|
|
|
}
|