2011-07-26 13:27:22 -07:00
|
|
|
/* client.c
|
|
|
|
*
|
2016-03-17 16:02:13 -06:00
|
|
|
* Copyright (C) 2006-2016 wolfSSL Inc.
|
2011-07-26 13:27:22 -07:00
|
|
|
*
|
2016-03-17 16:02:13 -06:00
|
|
|
* This file is part of wolfSSL.
|
2011-07-26 13:27:22 -07:00
|
|
|
*
|
2015-01-05 14:48:43 -07:00
|
|
|
* wolfSSL is free software; you can redistribute it and/or modify
|
2011-07-26 13:27:22 -07:00
|
|
|
* 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.
|
|
|
|
*
|
2015-01-05 14:48:43 -07:00
|
|
|
* wolfSSL is distributed in the hope that it will be useful,
|
2011-07-26 13:27:22 -07:00
|
|
|
* 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-17 16:02:13 -06:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
2011-07-26 13:27:22 -07:00
|
|
|
*/
|
|
|
|
|
2016-03-17 16:02:13 -06:00
|
|
|
|
2011-08-24 16:37:16 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2014-04-11 16:20:12 +09:00
|
|
|
#include <config.h>
|
2011-08-24 16:37:16 -07:00
|
|
|
#endif
|
2014-04-11 16:20:12 +09:00
|
|
|
|
2015-01-08 10:02:07 -07:00
|
|
|
#include <wolfssl/ssl.h>
|
2014-12-19 15:30:07 -07:00
|
|
|
|
2015-11-27 11:31:12 +09:00
|
|
|
#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)
|
2014-04-11 16:20:12 +09:00
|
|
|
#include <stdio.h>
|
2013-05-19 10:02:13 +09:00
|
|
|
#include <string.h>
|
2014-04-11 16:20:12 +09:00
|
|
|
|
2015-11-27 11:31:12 +09:00
|
|
|
#if !defined(WOLFSSL_MDK_ARM)
|
2014-04-11 16:20:12 +09:00
|
|
|
#include "cmsis_os.h"
|
2015-10-14 19:13:45 -07:00
|
|
|
#include "rl_fs.h"
|
|
|
|
#include "rl_net.h"
|
2014-04-11 16:20:12 +09:00
|
|
|
#else
|
|
|
|
#include "rtl.h"
|
2015-11-27 11:31:12 +09:00
|
|
|
#include "wolfssl_MDK_ARM.h"
|
2014-04-11 16:20:12 +09:00
|
|
|
#endif
|
2013-05-19 10:02:13 +09:00
|
|
|
#endif
|
2011-08-04 16:42:55 -06:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#include <wolfssl/wolfcrypt/settings.h>
|
2013-04-10 12:17:23 -07:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#include <wolfssl/ssl.h>
|
2014-04-11 16:20:12 +09:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#include <wolfssl/test.h>
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2012-09-19 23:38:41 -07:00
|
|
|
#include "examples/client/client.h"
|
|
|
|
|
2017-04-10 14:19:20 -07:00
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
2016-08-15 13:59:41 -06:00
|
|
|
static int devId = INVALID_DEVID;
|
|
|
|
#endif
|
|
|
|
|
2017-03-06 09:49:05 -08:00
|
|
|
#define DEFAULT_TIMEOUT_SEC 2
|
|
|
|
|
2015-12-24 15:42:52 -08:00
|
|
|
/* Note on using port 0: the client standalone example doesn't utilize the
|
|
|
|
* port 0 port sharing; that is used by (1) the server in external control
|
|
|
|
* test mode and (2) the testsuite which uses this code and sets up the correct
|
|
|
|
* port numbers when the internal thread using the server code using port 0. */
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#ifdef WOLFSSL_CALLBACKS
|
2011-02-05 11:14:47 -08:00
|
|
|
int handShakeCB(HandShakeInfo*);
|
|
|
|
int timeoutCB(TimeoutInfo*);
|
|
|
|
Timeval timeout;
|
|
|
|
#endif
|
|
|
|
|
2014-10-20 09:25:14 -07:00
|
|
|
#ifdef HAVE_SESSION_TICKET
|
2015-01-05 14:48:43 -07:00
|
|
|
int sessionTicketCB(WOLFSSL*, const unsigned char*, int, void*);
|
2014-10-20 09:25:14 -07:00
|
|
|
#endif
|
|
|
|
|
2013-03-15 13:17:05 -07: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-07 15:46:32 -07:00
|
|
|
static int NonBlockingSSL_Connect(WOLFSSL* ssl)
|
2012-10-17 13:13:58 -07:00
|
|
|
{
|
2015-01-05 14:48:43 -07:00
|
|
|
#ifndef WOLFSSL_CALLBACKS
|
|
|
|
int ret = wolfSSL_connect(ssl);
|
2011-02-05 11:14:47 -08:00
|
|
|
#else
|
2015-01-05 14:48:43 -07:00
|
|
|
int ret = wolfSSL_connect_ex(ssl, handShakeCB, timeoutCB, timeout);
|
2011-02-05 11:14:47 -08:00
|
|
|
#endif
|
2015-01-05 14:48:43 -07:00
|
|
|
int error = wolfSSL_get_error(ssl, 0);
|
|
|
|
SOCKET_T sockfd = (SOCKET_T)wolfSSL_get_fd(ssl);
|
2016-08-15 13:59:41 -06:00
|
|
|
int select_ret = 0;
|
2012-10-17 13:13:58 -07:00
|
|
|
|
|
|
|
while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
|
2016-03-04 10:05:22 -08:00
|
|
|
error == SSL_ERROR_WANT_WRITE ||
|
|
|
|
error == WC_PENDING_E)) {
|
2013-05-08 12:49:55 -07:00
|
|
|
int currTimeout = 1;
|
|
|
|
|
2012-10-17 13:13:58 -07:00
|
|
|
if (error == SSL_ERROR_WANT_READ)
|
|
|
|
printf("... client would read block\n");
|
2016-03-04 10:05:22 -08:00
|
|
|
else if (error == SSL_ERROR_WANT_WRITE)
|
2012-10-17 13:13:58 -07:00
|
|
|
printf("... client would write block\n");
|
2016-03-04 10:05:22 -08:00
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
else if (error == WC_PENDING_E) {
|
2016-08-15 13:59:41 -06:00
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
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-07 15:46:32 -07:00
|
|
|
if (ret < 0) break;
|
2016-03-04 10:05:22 -08:00
|
|
|
}
|
|
|
|
#endif
|
2012-10-17 13:13:58 -07:00
|
|
|
|
2016-08-15 13:59:41 -06:00
|
|
|
if (error != WC_PENDING_E) {
|
|
|
|
#ifdef WOLFSSL_DTLS
|
|
|
|
currTimeout = wolfSSL_dtls_get_current_timeout(ssl);
|
|
|
|
#endif
|
|
|
|
select_ret = tcp_select(sockfd, currTimeout);
|
|
|
|
}
|
2012-10-17 13:13:58 -07:00
|
|
|
|
|
|
|
if ((select_ret == TEST_RECV_READY) ||
|
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-07 15:46:32 -07:00
|
|
|
(select_ret == TEST_ERROR_READY) || error == WC_PENDING_E) {
|
2016-03-04 10:05:22 -08:00
|
|
|
#ifndef WOLFSSL_CALLBACKS
|
|
|
|
ret = wolfSSL_connect(ssl);
|
|
|
|
#else
|
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-07 15:46:32 -07:00
|
|
|
ret = wolfSSL_connect_ex(ssl, handShakeCB, timeoutCB, timeout);
|
2016-03-04 10:05:22 -08:00
|
|
|
#endif
|
2015-01-05 14:48:43 -07:00
|
|
|
error = wolfSSL_get_error(ssl, 0);
|
2012-10-17 13:13:58 -07:00
|
|
|
}
|
2015-01-05 14:48:43 -07:00
|
|
|
else if (select_ret == TEST_TIMEOUT && !wolfSSL_dtls(ssl)) {
|
2012-10-17 13:13:58 -07:00
|
|
|
error = SSL_ERROR_WANT_READ;
|
|
|
|
}
|
2015-01-05 14:48:43 -07:00
|
|
|
#ifdef WOLFSSL_DTLS
|
|
|
|
else if (select_ret == TEST_TIMEOUT && wolfSSL_dtls(ssl) &&
|
2016-03-04 10:05:22 -08:00
|
|
|
wolfSSL_dtls_got_timeout(ssl) >= 0) {
|
2013-05-08 12:49:55 -07:00
|
|
|
error = SSL_ERROR_WANT_READ;
|
|
|
|
}
|
|
|
|
#endif
|
2012-10-17 13:13:58 -07:00
|
|
|
else {
|
|
|
|
error = SSL_FATAL_ERROR;
|
2011-02-05 11:14:47 -08: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-07 15:46:32 -07:00
|
|
|
|
|
|
|
return ret;
|
2012-10-17 13:13:58 -07:00
|
|
|
}
|
2011-02-05 11:14:47 -08:00
|
|
|
|
|
|
|
|
2015-10-02 16:25:17 -07:00
|
|
|
static void ShowCiphers(void)
|
|
|
|
{
|
|
|
|
char ciphers[4096];
|
|
|
|
|
|
|
|
int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers));
|
|
|
|
|
|
|
|
if (ret == SSL_SUCCESS)
|
|
|
|
printf("%s\n", ciphers);
|
|
|
|
}
|
|
|
|
|
2015-11-02 13:26:46 -08:00
|
|
|
/* Shows which versions are valid */
|
|
|
|
static void ShowVersions(void)
|
|
|
|
{
|
2015-12-23 12:12:41 -08:00
|
|
|
#ifndef NO_OLD_TLS
|
2015-11-02 13:26:46 -08:00
|
|
|
#ifdef WOLFSSL_ALLOW_SSLV3
|
|
|
|
printf("0:");
|
2015-12-23 12:12:41 -08:00
|
|
|
#endif /* WOLFSSL_ALLOW_SSLV3 */
|
|
|
|
printf("1:2:");
|
|
|
|
#endif /* NO_OLD_TLS */
|
|
|
|
printf("3\n");
|
2015-11-02 13:26:46 -08:00
|
|
|
}
|
|
|
|
|
2016-08-25 22:20:35 -07:00
|
|
|
/* Measures average time to create, connect and disconnect a connection (TPS).
|
|
|
|
Benchmark = number of connections. */
|
|
|
|
static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
|
|
|
|
int dtlsUDP, int dtlsSCTP, int benchmark, int resumeSession)
|
2015-10-14 19:13:45 -07:00
|
|
|
{
|
|
|
|
/* time passed in number of connects give average */
|
|
|
|
int times = benchmark;
|
|
|
|
int loops = resumeSession ? 2 : 1;
|
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-07 15:46:32 -07:00
|
|
|
int i = 0, err, ret;
|
2016-02-22 10:11:41 +01:00
|
|
|
#ifndef NO_SESSION_CACHE
|
2015-10-14 19:13:45 -07:00
|
|
|
WOLFSSL_SESSION* benchSession = NULL;
|
2016-02-22 10:11:41 +01:00
|
|
|
#endif
|
2016-11-24 01:31:07 +10:00
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
byte* reply[80];
|
|
|
|
char msg[] = "hello wolfssl!";
|
|
|
|
#endif
|
|
|
|
|
2016-02-22 10:11:41 +01:00
|
|
|
(void)resumeSession;
|
2015-10-14 19:13:45 -07:00
|
|
|
|
|
|
|
while (loops--) {
|
2016-02-22 10:11:41 +01:00
|
|
|
#ifndef NO_SESSION_CACHE
|
2015-10-14 19:13:45 -07:00
|
|
|
int benchResume = resumeSession && loops == 0;
|
2016-02-22 10:11:41 +01:00
|
|
|
#endif
|
2016-04-14 16:26:51 +09:00
|
|
|
double start = current_time(1), avg;
|
2015-10-14 19:13:45 -07:00
|
|
|
|
|
|
|
for (i = 0; i < times; i++) {
|
|
|
|
SOCKET_T sockfd;
|
|
|
|
WOLFSSL* ssl = wolfSSL_new(ctx);
|
2015-10-16 14:12:38 -07:00
|
|
|
if (ssl == NULL)
|
|
|
|
err_sys("unable to get SSL object");
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2016-11-24 01:31:07 +10:00
|
|
|
|
2016-08-25 22:20:35 -07:00
|
|
|
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, ssl);
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2016-02-22 10:11:41 +01:00
|
|
|
#ifndef NO_SESSION_CACHE
|
2015-10-14 19:13:45 -07:00
|
|
|
if (benchResume)
|
|
|
|
wolfSSL_set_session(ssl, benchSession);
|
2016-02-22 10:11:41 +01:00
|
|
|
#endif
|
2016-03-25 13:59:04 -06:00
|
|
|
if (wolfSSL_set_fd(ssl, sockfd) != SSL_SUCCESS) {
|
|
|
|
err_sys("error in setting fd");
|
|
|
|
}
|
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-07 15:46:32 -07:00
|
|
|
|
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_connect(ssl);
|
|
|
|
if (ret != SSL_SUCCESS) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret != SSL_SUCCESS) {
|
2015-10-14 19:13:45 -07:00
|
|
|
err_sys("SSL_connect failed");
|
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-07 15:46:32 -07:00
|
|
|
}
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2016-11-24 01:31:07 +10:00
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
if (resumeSession) {
|
|
|
|
if (wolfSSL_write(ssl, msg, sizeof(msg)-1) <= 0)
|
|
|
|
err_sys("SSL_write failed");
|
|
|
|
|
|
|
|
if (wolfSSL_read(ssl, reply, sizeof(reply)-1) <= 0)
|
|
|
|
err_sys("SSL_read failed");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-10-14 19:13:45 -07:00
|
|
|
wolfSSL_shutdown(ssl);
|
2016-02-22 10:11:41 +01:00
|
|
|
#ifndef NO_SESSION_CACHE
|
2015-10-14 19:13:45 -07:00
|
|
|
if (i == (times-1) && resumeSession) {
|
|
|
|
benchSession = wolfSSL_get_session(ssl);
|
|
|
|
}
|
2016-02-22 10:11:41 +01:00
|
|
|
#endif
|
2015-10-14 19:13:45 -07:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
CloseSocket(sockfd);
|
|
|
|
}
|
2016-04-14 16:26:51 +09:00
|
|
|
avg = current_time(0) - start;
|
2015-10-14 19:13:45 -07:00
|
|
|
avg /= times;
|
|
|
|
avg *= 1000; /* milliseconds */
|
2016-02-22 10:11:41 +01:00
|
|
|
#ifndef NO_SESSION_CACHE
|
2015-10-14 19:13:45 -07:00
|
|
|
if (benchResume)
|
|
|
|
printf("wolfSSL_resume avg took: %8.3f milliseconds\n", avg);
|
|
|
|
else
|
2016-02-22 10:11:41 +01:00
|
|
|
#endif
|
2015-10-14 19:13:45 -07:00
|
|
|
printf("wolfSSL_connect avg took: %8.3f milliseconds\n", avg);
|
|
|
|
}
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-08-25 22:20:35 -07:00
|
|
|
/* Measures throughput in kbps. Throughput = number of bytes */
|
|
|
|
static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
|
|
|
int dtlsUDP, int dtlsSCTP, int throughput)
|
2015-10-14 19:13:45 -07:00
|
|
|
{
|
|
|
|
double start, conn_time = 0, tx_time = 0, rx_time = 0;
|
|
|
|
SOCKET_T sockfd;
|
|
|
|
WOLFSSL* ssl;
|
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-07 15:46:32 -07:00
|
|
|
int ret = 0, err = 0;
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2016-04-14 16:26:51 +09:00
|
|
|
start = current_time(1);
|
2015-10-14 19:13:45 -07:00
|
|
|
ssl = wolfSSL_new(ctx);
|
2015-10-16 14:12:38 -07:00
|
|
|
if (ssl == NULL)
|
|
|
|
err_sys("unable to get SSL object");
|
2016-11-24 01:31:07 +10:00
|
|
|
|
2016-08-25 22:20:35 -07:00
|
|
|
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, ssl);
|
2016-03-25 13:59:04 -06:00
|
|
|
if (wolfSSL_set_fd(ssl, sockfd) != SSL_SUCCESS) {
|
|
|
|
err_sys("error in setting fd");
|
|
|
|
}
|
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-07 15:46:32 -07:00
|
|
|
|
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_connect(ssl);
|
|
|
|
if (ret != SSL_SUCCESS) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret == SSL_SUCCESS) {
|
2015-10-14 19:13:45 -07:00
|
|
|
/* Perform throughput test */
|
|
|
|
char *tx_buffer, *rx_buffer;
|
|
|
|
|
|
|
|
/* Record connection time */
|
2016-04-14 16:26:51 +09:00
|
|
|
conn_time = current_time(0) - start;
|
2015-10-14 19:13:45 -07:00
|
|
|
|
|
|
|
/* Allocate TX/RX buffers */
|
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-07 15:46:32 -07:00
|
|
|
tx_buffer = (char*)XMALLOC(TEST_BUFFER_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
|
|
|
rx_buffer = (char*)XMALLOC(TEST_BUFFER_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
|
|
|
if (tx_buffer && rx_buffer) {
|
2015-10-14 19:13:45 -07:00
|
|
|
WC_RNG rng;
|
|
|
|
|
|
|
|
/* Startup the RNG */
|
2017-04-10 14:19:20 -07:00
|
|
|
#if !defined(HAVE_FIPS) && defined(WOLFSSL_ASYNC_CRYPT)
|
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-07 15:46:32 -07:00
|
|
|
ret = wc_InitRng_ex(&rng, NULL, devId);
|
|
|
|
#else
|
2015-10-14 19:13:45 -07:00
|
|
|
ret = wc_InitRng(&rng);
|
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-07 15:46:32 -07:00
|
|
|
#endif
|
|
|
|
if (ret == 0) {
|
2015-10-14 19:13:45 -07:00
|
|
|
int xfer_bytes;
|
|
|
|
|
|
|
|
/* Generate random data to send */
|
|
|
|
ret = wc_RNG_GenerateBlock(&rng, (byte*)tx_buffer, TEST_BUFFER_SIZE);
|
|
|
|
wc_FreeRng(&rng);
|
|
|
|
if(ret != 0) {
|
|
|
|
err_sys("wc_RNG_GenerateBlock failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Perform TX and RX of bytes */
|
|
|
|
xfer_bytes = 0;
|
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-07 15:46:32 -07:00
|
|
|
while (throughput > xfer_bytes) {
|
2015-10-15 13:42:41 -07:00
|
|
|
int len, rx_pos, select_ret;
|
2015-10-14 19:13:45 -07:00
|
|
|
|
|
|
|
/* Determine packet size */
|
|
|
|
len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes);
|
|
|
|
|
|
|
|
/* Perform TX */
|
2016-04-14 16:26:51 +09:00
|
|
|
start = current_time(1);
|
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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_write(ssl, tx_buffer, len);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret != len) {
|
|
|
|
printf("SSL_write bench error %d!\n", err);
|
|
|
|
err_sys("SSL_write failed");
|
2015-10-14 19:13:45 -07:00
|
|
|
}
|
2016-04-14 16:26:51 +09:00
|
|
|
tx_time += current_time(0) - start;
|
2015-10-14 19:13:45 -07:00
|
|
|
|
|
|
|
/* Perform RX */
|
2017-03-06 09:49:05 -08:00
|
|
|
select_ret = tcp_select(sockfd, DEFAULT_TIMEOUT_SEC);
|
2015-10-14 19:13:45 -07:00
|
|
|
if (select_ret == TEST_RECV_READY) {
|
2016-04-14 16:26:51 +09:00
|
|
|
start = current_time(1);
|
2015-10-14 19:13:45 -07:00
|
|
|
rx_pos = 0;
|
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-07 15:46:32 -07:00
|
|
|
while (rx_pos < len) {
|
|
|
|
ret = wolfSSL_read(ssl, &rx_buffer[rx_pos],
|
|
|
|
len - rx_pos);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (err != SSL_ERROR_WANT_READ) {
|
|
|
|
printf("SSL_read bench error %d\n", err);
|
|
|
|
err_sys("SSL_read failed");
|
2015-10-14 19:13:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
rx_pos += ret;
|
|
|
|
}
|
|
|
|
}
|
2016-04-14 16:26:51 +09:00
|
|
|
rx_time += current_time(0) - start;
|
2015-10-14 19:13:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Compare TX and RX buffers */
|
|
|
|
if(XMEMCMP(tx_buffer, rx_buffer, len) != 0) {
|
2017-03-15 09:38:53 +10:00
|
|
|
free(tx_buffer);
|
|
|
|
tx_buffer = NULL;
|
|
|
|
free(rx_buffer);
|
|
|
|
rx_buffer = NULL;
|
2015-10-14 19:13:45 -07:00
|
|
|
err_sys("Compare TX and RX buffers failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update overall position */
|
|
|
|
xfer_bytes += len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
err_sys("wc_InitRng failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2015-10-15 13:42:41 -07:00
|
|
|
err_sys("Client buffer malloc failed");
|
2015-10-14 19:13:45 -07: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-07 15:46:32 -07:00
|
|
|
if(tx_buffer) XFREE(tx_buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
|
|
|
if(rx_buffer) XFREE(rx_buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
2015-10-14 19:13:45 -07:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
err_sys("wolfSSL_connect failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
wolfSSL_shutdown(ssl);
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
CloseSocket(sockfd);
|
|
|
|
|
|
|
|
printf("wolfSSL Client Benchmark %d bytes\n"
|
|
|
|
"\tConnect %8.3f ms\n"
|
|
|
|
"\tTX %8.3f ms (%8.3f MBps)\n"
|
|
|
|
"\tRX %8.3f ms (%8.3f MBps)\n",
|
|
|
|
throughput,
|
|
|
|
conn_time * 1000,
|
|
|
|
tx_time * 1000, throughput / tx_time / 1024 / 1024,
|
|
|
|
rx_time * 1000, throughput / rx_time / 1024 / 1024
|
|
|
|
);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-04-28 14:21:33 -06:00
|
|
|
const char* starttlsCmd[6] = {
|
|
|
|
"220",
|
|
|
|
"EHLO mail.example.com\r\n",
|
|
|
|
"250",
|
|
|
|
"STARTTLS\r\n",
|
|
|
|
"220",
|
|
|
|
"QUIT\r\n",
|
|
|
|
};
|
|
|
|
|
2016-08-25 22:20:35 -07:00
|
|
|
/* Initiates the STARTTLS command sequence over TCP */
|
|
|
|
static int StartTLS_Init(SOCKET_T* sockfd)
|
2016-04-28 14:21:33 -06:00
|
|
|
{
|
|
|
|
char tmpBuf[256];
|
|
|
|
|
|
|
|
if (sockfd == NULL)
|
|
|
|
return BAD_FUNC_ARG;
|
|
|
|
|
|
|
|
/* S: 220 <host> SMTP service ready */
|
2017-04-28 14:59:45 -07:00
|
|
|
XMEMSET(tmpBuf, 0, sizeof(tmpBuf));
|
|
|
|
if (recv(*sockfd, tmpBuf, sizeof(tmpBuf)-1, 0) < 0)
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("failed to read STARTTLS command\n");
|
|
|
|
|
|
|
|
if (!XSTRNCMP(tmpBuf, starttlsCmd[0], XSTRLEN(starttlsCmd[0]))) {
|
|
|
|
printf("%s\n", tmpBuf);
|
|
|
|
} else {
|
|
|
|
err_sys("incorrect STARTTLS command received");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* C: EHLO mail.example.com */
|
2016-05-02 10:10:25 -06:00
|
|
|
if (send(*sockfd, starttlsCmd[1], (int)XSTRLEN(starttlsCmd[1]), 0) !=
|
2016-05-03 13:52:04 -06:00
|
|
|
(int)XSTRLEN(starttlsCmd[1]))
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("failed to send STARTTLS EHLO command\n");
|
|
|
|
|
|
|
|
/* S: 250 <host> offers a warm hug of welcome */
|
2017-04-28 14:59:45 -07:00
|
|
|
XMEMSET(tmpBuf, 0, sizeof(tmpBuf));
|
|
|
|
if (recv(*sockfd, tmpBuf, sizeof(tmpBuf)-1, 0) < 0)
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("failed to read STARTTLS command\n");
|
|
|
|
|
|
|
|
if (!XSTRNCMP(tmpBuf, starttlsCmd[2], XSTRLEN(starttlsCmd[2]))) {
|
|
|
|
printf("%s\n", tmpBuf);
|
|
|
|
} else {
|
|
|
|
err_sys("incorrect STARTTLS command received");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* C: STARTTLS */
|
2016-05-02 10:10:25 -06:00
|
|
|
if (send(*sockfd, starttlsCmd[3], (int)XSTRLEN(starttlsCmd[3]), 0) !=
|
2016-05-03 13:52:04 -06:00
|
|
|
(int)XSTRLEN(starttlsCmd[3])) {
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("failed to send STARTTLS command\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* S: 220 Go ahead */
|
2017-04-28 14:59:45 -07:00
|
|
|
XMEMSET(tmpBuf, 0, sizeof(tmpBuf));
|
|
|
|
if (recv(*sockfd, tmpBuf, sizeof(tmpBuf)-1, 0) < 0)
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("failed to read STARTTLS command\n");
|
|
|
|
|
|
|
|
if (!XSTRNCMP(tmpBuf, starttlsCmd[4], XSTRLEN(starttlsCmd[4]))) {
|
|
|
|
printf("%s\n", tmpBuf);
|
|
|
|
} else {
|
|
|
|
err_sys("incorrect STARTTLS command received, expected 220");
|
|
|
|
}
|
|
|
|
|
|
|
|
return SSL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-08-25 22:20:35 -07:00
|
|
|
/* Closes down the SMTP connection */
|
|
|
|
static int SMTP_Shutdown(WOLFSSL* ssl, int wc_shutdown)
|
2016-04-28 14:21:33 -06: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-07 15:46:32 -07:00
|
|
|
int ret, err = 0;
|
2016-04-28 14:21:33 -06:00
|
|
|
char tmpBuf[256];
|
|
|
|
|
|
|
|
if (ssl == NULL)
|
|
|
|
return BAD_FUNC_ARG;
|
|
|
|
|
|
|
|
printf("\nwolfSSL client shutting down SMTP connection\n");
|
|
|
|
|
|
|
|
XMEMSET(tmpBuf, 0, sizeof(tmpBuf));
|
|
|
|
|
|
|
|
/* C: QUIT */
|
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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
ret = wolfSSL_write(ssl, starttlsCmd[5], (int)XSTRLEN(starttlsCmd[5]));
|
|
|
|
if (ret < 0) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret != (int)XSTRLEN(starttlsCmd[5])) {
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("failed to send SMTP QUIT command\n");
|
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-07 15:46:32 -07:00
|
|
|
}
|
2016-04-28 14:21:33 -06:00
|
|
|
|
|
|
|
/* S: 221 2.0.0 Service closing transmission channel */
|
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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
ret = wolfSSL_read(ssl, tmpBuf, sizeof(tmpBuf));
|
|
|
|
if (ret < 0) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret < 0) {
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("failed to read SMTP closing down response\n");
|
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-07 15:46:32 -07:00
|
|
|
}
|
2016-04-28 14:21:33 -06:00
|
|
|
|
|
|
|
printf("%s\n", tmpBuf);
|
|
|
|
|
|
|
|
ret = wolfSSL_shutdown(ssl);
|
|
|
|
if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE)
|
|
|
|
wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
|
|
|
|
|
|
|
return SSL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2015-10-02 16:25:17 -07:00
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
static void Usage(void)
|
|
|
|
{
|
2015-01-05 14:48:43 -07:00
|
|
|
printf("client " LIBWOLFSSL_VERSION_STRING
|
|
|
|
" NOTE: All files relative to wolfSSL home dir\n");
|
2012-08-01 12:55:13 -07:00
|
|
|
printf("-? Help, print this usage\n");
|
2015-02-25 13:34:29 -08:00
|
|
|
printf("-h <host> Host to connect to, default %s\n", wolfSSLIP);
|
|
|
|
printf("-p <num> Port to connect on, not 0, default %d\n", wolfSSLPort);
|
2012-08-01 12:55:13 -07:00
|
|
|
printf("-v <num> SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n",
|
|
|
|
CLIENT_DEFAULT_VERSION);
|
2015-11-02 13:26:46 -08:00
|
|
|
printf("-V Prints valid ssl version numbers, SSLv3(0) - TLS1.2(3)\n");
|
2015-10-14 19:13:45 -07:00
|
|
|
printf("-l <str> Cipher suite list (: delimited)\n");
|
2017-04-06 15:54:59 -07:00
|
|
|
printf("-c <file> Certificate file, default %s\n", cliCertFile);
|
|
|
|
printf("-k <file> Key file, default %s\n", cliKeyFile);
|
|
|
|
printf("-A <file> Certificate Authority file, default %s\n", caCertFile);
|
2015-05-21 10:11:21 -07:00
|
|
|
#ifndef NO_DH
|
|
|
|
printf("-Z <num> Minimum DH key bits, default %d\n",
|
|
|
|
DEFAULT_MIN_DHKEY_BITS);
|
|
|
|
#endif
|
2012-08-01 12:55:13 -07:00
|
|
|
printf("-b <num> Benchmark <num> connections and print stats\n");
|
2015-10-13 15:00:53 -07:00
|
|
|
#ifdef HAVE_ALPN
|
2015-11-02 15:51:01 -03:00
|
|
|
printf("-L <str> Application-Layer Protocol Negotiation ({C,F}:<list>)\n");
|
2015-10-13 15:00:53 -07:00
|
|
|
#endif
|
2015-10-14 19:13:45 -07:00
|
|
|
printf("-B <num> Benchmark throughput using <num> bytes and print stats\n");
|
2012-08-01 12:55:13 -07:00
|
|
|
printf("-s Use pre Shared keys\n");
|
|
|
|
printf("-d Disable peer checks\n");
|
2014-07-02 12:07:25 -07:00
|
|
|
printf("-D Override Date Errors example\n");
|
2015-10-02 16:25:17 -07:00
|
|
|
printf("-e List Every cipher suite available, \n");
|
2012-08-01 12:55:13 -07:00
|
|
|
printf("-g Send server HTTP GET\n");
|
2013-03-07 22:52:51 -08:00
|
|
|
printf("-u Use UDP DTLS,"
|
2015-10-14 19:13:45 -07:00
|
|
|
" add -v 2 for DTLSv1, -v 3 for DTLSv1.2 (default)\n");
|
2016-08-25 22:20:35 -07:00
|
|
|
#ifdef WOLFSSL_SCTP
|
|
|
|
printf("-G Use SCTP DTLS,"
|
|
|
|
" add -v 2 for DTLSv1, -v 3 for DTLSv1.2 (default)\n");
|
|
|
|
#endif
|
2012-08-10 10:15:37 -07:00
|
|
|
printf("-m Match domain name in cert\n");
|
2012-10-17 14:06:50 -07:00
|
|
|
printf("-N Use Non-blocking sockets\n");
|
2012-10-17 13:13:58 -07:00
|
|
|
printf("-r Resume session\n");
|
2015-01-30 08:41:34 -07:00
|
|
|
printf("-w Wait for bidirectional shutdown\n");
|
2016-04-22 13:46:54 -06:00
|
|
|
printf("-M <prot> Use STARTTLS, using <prot> protocol (smtp)\n");
|
2014-09-24 18:48:23 -07:00
|
|
|
#ifdef HAVE_SECURE_RENEGOTIATION
|
2014-09-29 15:32:41 -07:00
|
|
|
printf("-R Allow Secure Renegotiation\n");
|
|
|
|
printf("-i Force client Initiated Secure Renegotiation\n");
|
2014-09-24 18:48:23 -07:00
|
|
|
#endif
|
2013-04-19 13:10:19 -07:00
|
|
|
printf("-f Fewer packets/group messages\n");
|
|
|
|
printf("-x Disable client cert/key loading\n");
|
2015-05-07 12:50:27 -07:00
|
|
|
printf("-X Driven by eXternal test case\n");
|
2013-04-08 16:01:52 -07:00
|
|
|
#ifdef SHOW_SIZES
|
|
|
|
printf("-z Print structure sizes\n");
|
|
|
|
#endif
|
2013-07-23 15:42:43 -03:00
|
|
|
#ifdef HAVE_SNI
|
2013-05-21 14:37:50 -07:00
|
|
|
printf("-S <str> Use Host Name Indication\n");
|
2013-07-23 15:42:43 -03:00
|
|
|
#endif
|
2014-02-16 10:19:40 -03:00
|
|
|
#ifdef HAVE_MAX_FRAGMENT
|
2015-10-13 14:13:12 -07:00
|
|
|
printf("-F <num> Use Maximum Fragment Length [1-5]\n");
|
2013-07-23 15:42:43 -03:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_TRUNCATED_HMAC
|
|
|
|
printf("-T Use Truncated HMAC\n");
|
|
|
|
#endif
|
2016-09-01 15:17:46 -06:00
|
|
|
#ifdef HAVE_EXTENDED_MASTER
|
2016-09-09 23:16:52 -07:00
|
|
|
printf("-n Disable Extended Master Secret\n");
|
2016-09-01 15:17:46 -06:00
|
|
|
#endif
|
2013-06-20 11:07:54 -07:00
|
|
|
#ifdef HAVE_OCSP
|
|
|
|
printf("-o Perform OCSP lookup on peer certificate\n");
|
|
|
|
printf("-O <url> Perform OCSP lookup using <url> as responder\n");
|
|
|
|
#endif
|
2015-12-28 19:38:04 -03:00
|
|
|
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
|
|
|
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
2015-11-02 15:51:01 -03:00
|
|
|
printf("-W Use OCSP Stapling\n");
|
|
|
|
#endif
|
2013-08-09 17:27:15 -07:00
|
|
|
#ifdef ATOMIC_USER
|
|
|
|
printf("-U Atomic User Record Layer Callbacks\n");
|
|
|
|
#endif
|
2015-10-14 19:13:45 -07:00
|
|
|
#ifdef HAVE_PK_CALLBACKS
|
2013-08-22 18:19:39 -07:00
|
|
|
printf("-P Public Key Callbacks\n");
|
|
|
|
#endif
|
2014-12-01 11:44:32 -08:00
|
|
|
#ifdef HAVE_ANON
|
|
|
|
printf("-a Anonymous client\n");
|
|
|
|
#endif
|
2015-05-07 10:02:43 -07:00
|
|
|
#ifdef HAVE_CRL
|
|
|
|
printf("-C Disable CRL\n");
|
|
|
|
#endif
|
2016-03-01 16:35:32 -07:00
|
|
|
#ifdef WOLFSSL_TRUST_PEER_CERT
|
2016-03-02 16:51:57 -07:00
|
|
|
printf("-E <file> Path to load trusted peer cert\n");
|
2016-03-01 16:35:32 -07:00
|
|
|
#endif
|
2016-05-05 15:31:25 -06:00
|
|
|
#ifdef HAVE_WNR
|
|
|
|
printf("-q <file> Whitewood config file, default %s\n", wnrConfig);
|
2016-11-24 01:31:07 +10:00
|
|
|
#endif
|
|
|
|
printf("-H Force use of the default cipher suite list\n");
|
|
|
|
#ifdef WOLFSSL_TLS13
|
2017-04-14 16:39:21 -07:00
|
|
|
printf("-J Use HelloRetryRequest to choose group for KE\n");
|
2016-11-24 01:31:07 +10:00
|
|
|
printf("-K Key Exchange for PSK not using (EC)DHE\n");
|
|
|
|
printf("-I Update keys and IVs before sending data\n");
|
|
|
|
#ifndef NO_DH
|
|
|
|
printf("-y Key Share with FFDHE named groups only\n");
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ECC
|
|
|
|
printf("-Y Key Share with ECC named groups only\n");
|
|
|
|
#endif
|
2016-05-05 15:31:25 -06:00
|
|
|
#endif
|
2012-08-01 12:55:13 -07:00
|
|
|
}
|
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
2011-02-05 11:14:47 -08:00
|
|
|
{
|
2015-10-14 19:13:45 -07:00
|
|
|
SOCKET_T sockfd = WOLFSSL_SOCKET_INVALID;
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
WOLFSSL_METHOD* method = 0;
|
|
|
|
WOLFSSL_CTX* ctx = 0;
|
|
|
|
WOLFSSL* ssl = 0;
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
WOLFSSL* sslResume = 0;
|
|
|
|
WOLFSSL_SESSION* session = 0;
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2016-06-13 14:39:41 -07:00
|
|
|
#ifndef WOLFSSL_ALT_TEST_STRINGS
|
2015-01-05 14:48:43 -07:00
|
|
|
char msg[32] = "hello wolfssl!"; /* GET may make bigger */
|
2016-06-13 14:39:41 -07:00
|
|
|
char resumeMsg[32] = "resuming wolfssl!";
|
|
|
|
#else
|
|
|
|
char msg[32] = "hello wolfssl!\n";
|
|
|
|
char resumeMsg[32] = "resuming wolfssl!\n";
|
|
|
|
#endif
|
|
|
|
|
2013-03-29 14:06:36 -07:00
|
|
|
char reply[80];
|
2016-06-29 11:11:25 -07:00
|
|
|
int msgSz = (int)XSTRLEN(msg);
|
|
|
|
int resumeSz = (int)XSTRLEN(resumeMsg);
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2015-02-25 13:34:29 -08:00
|
|
|
word16 port = wolfSSLPort;
|
|
|
|
char* host = (char*)wolfSSLIP;
|
2015-09-24 12:13:01 -07:00
|
|
|
const char* domain = "localhost"; /* can't default to www.wolfssl.com
|
|
|
|
because can't tell if we're really
|
|
|
|
going there to detect old chacha-poly
|
|
|
|
*/
|
2012-08-01 12:55:13 -07:00
|
|
|
int ch;
|
2013-03-07 22:52:51 -08:00
|
|
|
int version = CLIENT_INVALID_VERSION;
|
2012-08-01 12:55:13 -07:00
|
|
|
int usePsk = 0;
|
2014-12-01 11:44:32 -08:00
|
|
|
int useAnon = 0;
|
2012-08-01 12:55:13 -07:00
|
|
|
int sendGET = 0;
|
|
|
|
int benchmark = 0;
|
2015-10-14 19:13:45 -07:00
|
|
|
int throughput = 0;
|
2012-08-02 11:54:49 -07:00
|
|
|
int doDTLS = 0;
|
2016-08-25 22:20:35 -07:00
|
|
|
int dtlsUDP = 0;
|
|
|
|
int dtlsSCTP = 0;
|
2012-08-10 10:15:37 -07:00
|
|
|
int matchName = 0;
|
2012-08-01 12:55:13 -07:00
|
|
|
int doPeerCheck = 1;
|
2012-10-17 13:13:58 -07:00
|
|
|
int nonBlocking = 0;
|
|
|
|
int resumeSession = 0;
|
2015-05-07 10:02:43 -07:00
|
|
|
int wc_shutdown = 0;
|
|
|
|
int disableCRL = 0;
|
2015-05-07 12:50:27 -07:00
|
|
|
int externalTest = 0;
|
2015-02-16 14:23:33 -08:00
|
|
|
int ret;
|
2016-08-05 14:06:58 -07:00
|
|
|
#ifndef WOLFSSL_CALLBACKS
|
2016-03-04 10:05:22 -08:00
|
|
|
int err = 0;
|
2016-08-05 14:06:58 -07:00
|
|
|
#endif
|
2014-09-29 15:32:41 -07:00
|
|
|
int scr = 0; /* allow secure renegotiation */
|
|
|
|
int forceScr = 0; /* force client initiaed scr */
|
2013-04-19 13:10:19 -07:00
|
|
|
int useClientCert = 1;
|
|
|
|
int fewerPackets = 0;
|
2013-08-09 17:27:15 -07:00
|
|
|
int atomicUser = 0;
|
2013-08-22 18:19:39 -07:00
|
|
|
int pkCallbacks = 0;
|
2014-07-02 12:07:25 -07:00
|
|
|
int overrideDateErrors = 0;
|
2015-05-21 10:11:21 -07:00
|
|
|
int minDhKeyBits = DEFAULT_MIN_DHKEY_BITS;
|
2015-10-13 15:00:53 -07:00
|
|
|
char* alpnList = NULL;
|
|
|
|
unsigned char alpn_opt = 0;
|
2012-08-01 12:55:13 -07:00
|
|
|
char* cipherList = NULL;
|
2017-04-05 11:21:11 -07:00
|
|
|
int useDefCipherList = 0;
|
2017-04-06 15:54:59 -07:00
|
|
|
const char* verifyCert = caCertFile;
|
|
|
|
const char* ourCert = cliCertFile;
|
|
|
|
const char* ourKey = cliKeyFile;
|
2012-08-01 12:55:13 -07:00
|
|
|
|
2016-04-22 13:46:54 -06:00
|
|
|
int doSTARTTLS = 0;
|
|
|
|
char* starttlsProt = NULL;
|
|
|
|
|
2016-03-01 16:35:32 -07:00
|
|
|
#ifdef WOLFSSL_TRUST_PEER_CERT
|
|
|
|
const char* trustCert = NULL;
|
|
|
|
#endif
|
|
|
|
|
2013-05-21 14:37:50 -07:00
|
|
|
#ifdef HAVE_SNI
|
|
|
|
char* sniHostName = NULL;
|
|
|
|
#endif
|
2013-07-23 15:42:43 -03:00
|
|
|
#ifdef HAVE_MAX_FRAGMENT
|
|
|
|
byte maxFragment = 0;
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_TRUNCATED_HMAC
|
2015-11-02 15:51:01 -03:00
|
|
|
byte truncatedHMAC = 0;
|
|
|
|
#endif
|
2015-12-28 19:38:04 -03:00
|
|
|
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
|
|
|
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
2015-11-02 15:51:01 -03:00
|
|
|
byte statusRequest = 0;
|
2013-07-23 15:42:43 -03:00
|
|
|
#endif
|
2016-09-01 15:17:46 -06:00
|
|
|
#ifdef HAVE_EXTENDED_MASTER
|
2016-09-09 23:16:52 -07:00
|
|
|
byte disableExtMasterSecret = 0;
|
2016-09-01 15:17:46 -06:00
|
|
|
#endif
|
2016-11-24 01:31:07 +10:00
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
int helloRetry = 0;
|
|
|
|
int onlyKeyShare = 0;
|
|
|
|
int noPskDheKe = 0;
|
|
|
|
#endif
|
|
|
|
int updateKeysIVs = 0;
|
2013-07-23 15:42:43 -03:00
|
|
|
|
2013-06-20 11:07:54 -07:00
|
|
|
#ifdef HAVE_OCSP
|
|
|
|
int useOcsp = 0;
|
|
|
|
char* ocspUrl = NULL;
|
|
|
|
#endif
|
|
|
|
|
2016-05-05 15:31:25 -06:00
|
|
|
#ifdef HAVE_WNR
|
|
|
|
const char* wnrConfigFile = wnrConfig;
|
|
|
|
#endif
|
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-07 15:46:32 -07:00
|
|
|
char buffer[WOLFSSL_MAX_ERROR_SZ];
|
2016-05-05 15:31:25 -06:00
|
|
|
|
2011-02-05 11:14:47 -08:00
|
|
|
int argc = ((func_args*)args)->argc;
|
|
|
|
char** argv = ((func_args*)args)->argv;
|
|
|
|
|
|
|
|
((func_args*)args)->return_code = -1; /* error state */
|
|
|
|
|
2013-03-07 18:20:29 -08:00
|
|
|
#ifdef NO_RSA
|
2017-04-06 15:54:59 -07:00
|
|
|
verifyCert = (char*)eccCertFile;
|
|
|
|
ourCert = (char*)cliEccCertFile;
|
|
|
|
ourKey = (char*)cliEccKeyFile;
|
2013-03-07 18:20:29 -08:00
|
|
|
#endif
|
2013-03-11 16:07:46 -07:00
|
|
|
(void)resumeSz;
|
|
|
|
(void)session;
|
|
|
|
(void)sslResume;
|
2013-08-09 17:27:15 -07:00
|
|
|
(void)atomicUser;
|
2013-08-22 18:19:39 -07:00
|
|
|
(void)pkCallbacks;
|
2014-09-24 18:48:23 -07:00
|
|
|
(void)scr;
|
2014-09-29 15:32:41 -07:00
|
|
|
(void)forceScr;
|
2015-03-27 19:20:31 -07:00
|
|
|
(void)ourKey;
|
|
|
|
(void)ourCert;
|
|
|
|
(void)verifyCert;
|
|
|
|
(void)useClientCert;
|
|
|
|
(void)overrideDateErrors;
|
2015-05-07 10:02:43 -07:00
|
|
|
(void)disableCRL;
|
2015-05-21 10:11:21 -07:00
|
|
|
(void)minDhKeyBits;
|
2015-10-13 15:00:53 -07:00
|
|
|
(void)alpnList;
|
|
|
|
(void)alpn_opt;
|
2016-11-24 01:31:07 +10:00
|
|
|
(void)updateKeysIVs;
|
2013-03-07 18:20:29 -08:00
|
|
|
|
2013-06-03 14:56:37 -07:00
|
|
|
StackTrap();
|
|
|
|
|
2015-10-29 13:39:02 -06:00
|
|
|
#ifndef WOLFSSL_VXWORKS
|
2017-04-14 16:39:21 -07:00
|
|
|
/* Not used: j, t, Q */
|
2017-04-05 11:21:11 -07:00
|
|
|
while ((ch = mygetopt(argc, argv, "?"
|
2017-04-14 16:39:21 -07:00
|
|
|
"ab:c:defgh:ik:l:mnop:q:rsuv:wxyz"
|
|
|
|
"A:B:CDE:F:GHIJKL:M:NO:PRS:TUVW:XYZ:")) != -1) {
|
2012-08-01 12:55:13 -07:00
|
|
|
switch (ch) {
|
|
|
|
case '?' :
|
|
|
|
Usage();
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
|
|
|
|
case 'g' :
|
|
|
|
sendGET = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'd' :
|
|
|
|
doPeerCheck = 0;
|
|
|
|
break;
|
|
|
|
|
2015-10-02 16:25:17 -07:00
|
|
|
case 'e' :
|
|
|
|
ShowCiphers();
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
|
2014-07-02 12:07:25 -07:00
|
|
|
case 'D' :
|
|
|
|
overrideDateErrors = 1;
|
|
|
|
break;
|
|
|
|
|
2015-05-07 10:02:43 -07:00
|
|
|
case 'C' :
|
2015-06-10 15:24:24 -07:00
|
|
|
#ifdef HAVE_CRL
|
|
|
|
disableCRL = 1;
|
|
|
|
#endif
|
2015-05-07 10:02:43 -07:00
|
|
|
break;
|
|
|
|
|
2012-08-02 11:54:49 -07:00
|
|
|
case 'u' :
|
2016-08-25 22:20:35 -07:00
|
|
|
doDTLS = 1;
|
|
|
|
dtlsUDP = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'G' :
|
|
|
|
#ifdef WOLFSSL_SCTP
|
|
|
|
doDTLS = 1;
|
|
|
|
dtlsSCTP = 1;
|
|
|
|
#endif
|
2012-08-02 11:54:49 -07:00
|
|
|
break;
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
case 's' :
|
|
|
|
usePsk = 1;
|
|
|
|
break;
|
|
|
|
|
2016-03-01 16:35:32 -07:00
|
|
|
#ifdef WOLFSSL_TRUST_PEER_CERT
|
|
|
|
case 'E' :
|
|
|
|
trustCert = myoptarg;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2012-08-10 10:15:37 -07:00
|
|
|
case 'm' :
|
|
|
|
matchName = 1;
|
|
|
|
break;
|
|
|
|
|
2013-04-19 13:10:19 -07:00
|
|
|
case 'x' :
|
|
|
|
useClientCert = 0;
|
|
|
|
break;
|
|
|
|
|
2015-05-07 12:50:27 -07:00
|
|
|
case 'X' :
|
|
|
|
externalTest = 1;
|
|
|
|
break;
|
|
|
|
|
2013-04-19 13:10:19 -07:00
|
|
|
case 'f' :
|
|
|
|
fewerPackets = 1;
|
|
|
|
break;
|
|
|
|
|
2013-08-09 17:27:15 -07:00
|
|
|
case 'U' :
|
|
|
|
#ifdef ATOMIC_USER
|
|
|
|
atomicUser = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2013-08-22 18:19:39 -07:00
|
|
|
case 'P' :
|
2015-10-14 19:13:45 -07:00
|
|
|
#ifdef HAVE_PK_CALLBACKS
|
2013-08-22 18:19:39 -07:00
|
|
|
pkCallbacks = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
case 'h' :
|
2012-08-01 17:33:49 -07:00
|
|
|
host = myoptarg;
|
|
|
|
domain = myoptarg;
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'p' :
|
2014-03-03 16:46:48 -08:00
|
|
|
port = (word16)atoi(myoptarg);
|
2013-03-26 22:00:39 -07:00
|
|
|
#if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
|
|
|
|
if (port == 0)
|
|
|
|
err_sys("port number cannot be 0");
|
|
|
|
#endif
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'v' :
|
2012-08-01 17:33:49 -07:00
|
|
|
version = atoi(myoptarg);
|
2016-11-24 01:31:07 +10:00
|
|
|
if (version < 0 || version > 4) {
|
2012-08-01 12:55:13 -07:00
|
|
|
Usage();
|
2012-08-01 17:33:49 -07:00
|
|
|
exit(MY_EX_USAGE);
|
2012-08-01 12:55:13 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2015-11-02 13:26:46 -08:00
|
|
|
case 'V' :
|
|
|
|
ShowVersions();
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
case 'l' :
|
2012-08-01 17:33:49 -07:00
|
|
|
cipherList = myoptarg;
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
|
|
|
|
2017-04-05 11:21:11 -07:00
|
|
|
case 'H' :
|
|
|
|
useDefCipherList = 1;
|
|
|
|
break;
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
case 'A' :
|
2012-08-01 17:33:49 -07:00
|
|
|
verifyCert = myoptarg;
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'c' :
|
2012-08-01 17:33:49 -07:00
|
|
|
ourCert = myoptarg;
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'k' :
|
2012-08-01 17:33:49 -07:00
|
|
|
ourKey = myoptarg;
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
|
|
|
|
2015-05-21 10:11:21 -07:00
|
|
|
case 'Z' :
|
|
|
|
#ifndef NO_DH
|
|
|
|
minDhKeyBits = atoi(myoptarg);
|
|
|
|
if (minDhKeyBits <= 0 || minDhKeyBits > 16000) {
|
|
|
|
Usage();
|
|
|
|
exit(MY_EX_USAGE);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
case 'b' :
|
2012-08-01 17:33:49 -07:00
|
|
|
benchmark = atoi(myoptarg);
|
2012-08-01 12:55:13 -07:00
|
|
|
if (benchmark < 0 || benchmark > 1000000) {
|
|
|
|
Usage();
|
2012-08-01 17:33:49 -07:00
|
|
|
exit(MY_EX_USAGE);
|
2012-08-01 12:55:13 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2015-10-14 19:13:45 -07:00
|
|
|
case 'B' :
|
|
|
|
throughput = atoi(myoptarg);
|
|
|
|
if (throughput <= 0) {
|
|
|
|
Usage();
|
|
|
|
exit(MY_EX_USAGE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-10-17 13:13:58 -07:00
|
|
|
case 'N' :
|
|
|
|
nonBlocking = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'r' :
|
|
|
|
resumeSession = 1;
|
|
|
|
break;
|
|
|
|
|
2015-01-30 08:41:34 -07:00
|
|
|
case 'w' :
|
2015-02-18 08:00:25 -07:00
|
|
|
wc_shutdown = 1;
|
2015-01-30 08:41:34 -07:00
|
|
|
break;
|
|
|
|
|
2014-09-24 18:48:23 -07:00
|
|
|
case 'R' :
|
|
|
|
#ifdef HAVE_SECURE_RENEGOTIATION
|
|
|
|
scr = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2014-09-29 15:32:41 -07:00
|
|
|
case 'i' :
|
|
|
|
#ifdef HAVE_SECURE_RENEGOTIATION
|
|
|
|
scr = 1;
|
|
|
|
forceScr = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2013-04-08 16:01:52 -07:00
|
|
|
case 'z' :
|
2015-01-05 14:48:43 -07:00
|
|
|
#ifndef WOLFSSL_LEANPSK
|
|
|
|
wolfSSL_GetObjectSize();
|
2013-04-08 16:01:52 -07:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2013-05-21 14:37:50 -07:00
|
|
|
case 'S' :
|
|
|
|
#ifdef HAVE_SNI
|
|
|
|
sniHostName = myoptarg;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2015-10-13 14:13:12 -07:00
|
|
|
case 'F' :
|
2013-07-23 15:42:43 -03:00
|
|
|
#ifdef HAVE_MAX_FRAGMENT
|
|
|
|
maxFragment = atoi(myoptarg);
|
2015-01-05 14:48:43 -07:00
|
|
|
if (maxFragment < WOLFSSL_MFL_2_9 ||
|
|
|
|
maxFragment > WOLFSSL_MFL_2_13) {
|
2013-07-23 15:42:43 -03:00
|
|
|
Usage();
|
|
|
|
exit(MY_EX_USAGE);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'T' :
|
|
|
|
#ifdef HAVE_TRUNCATED_HMAC
|
|
|
|
truncatedHMAC = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2016-09-01 15:17:46 -06:00
|
|
|
case 'n' :
|
|
|
|
#ifdef HAVE_EXTENDED_MASTER
|
2016-09-09 23:16:52 -07:00
|
|
|
disableExtMasterSecret = 1;
|
2016-09-01 15:17:46 -06:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2015-11-02 15:51:01 -03:00
|
|
|
case 'W' :
|
2015-12-28 19:38:04 -03:00
|
|
|
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
|
|
|
|| defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
|
|
|
|
statusRequest = atoi(myoptarg);
|
2015-11-02 15:51:01 -03:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2013-06-20 11:07:54 -07:00
|
|
|
case 'o' :
|
|
|
|
#ifdef HAVE_OCSP
|
|
|
|
useOcsp = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'O' :
|
|
|
|
#ifdef HAVE_OCSP
|
|
|
|
useOcsp = 1;
|
|
|
|
ocspUrl = myoptarg;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2014-12-01 11:44:32 -08:00
|
|
|
case 'a' :
|
|
|
|
#ifdef HAVE_ANON
|
|
|
|
useAnon = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2015-10-15 09:48:07 -07:00
|
|
|
case 'L' :
|
2015-10-13 15:00:53 -07:00
|
|
|
#ifdef HAVE_ALPN
|
|
|
|
alpnList = myoptarg;
|
|
|
|
|
|
|
|
if (alpnList[0] == 'C' && alpnList[1] == ':')
|
|
|
|
alpn_opt = WOLFSSL_ALPN_CONTINUE_ON_MISMATCH;
|
|
|
|
else if (alpnList[0] == 'F' && alpnList[1] == ':')
|
|
|
|
alpn_opt = WOLFSSL_ALPN_FAILED_ON_MISMATCH;
|
|
|
|
else {
|
|
|
|
Usage();
|
|
|
|
exit(MY_EX_USAGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
alpnList += 2;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2016-04-22 13:46:54 -06:00
|
|
|
case 'M' :
|
|
|
|
doSTARTTLS = 1;
|
|
|
|
starttlsProt = myoptarg;
|
|
|
|
|
|
|
|
if (XSTRNCMP(starttlsProt, "smtp", 4) != 0) {
|
|
|
|
Usage();
|
|
|
|
exit(MY_EX_USAGE);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2016-05-05 15:31:25 -06:00
|
|
|
case 'q' :
|
|
|
|
#ifdef HAVE_WNR
|
|
|
|
wnrConfigFile = myoptarg;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2017-04-14 16:39:21 -07:00
|
|
|
case 'J' :
|
2016-11-24 01:31:07 +10:00
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
helloRetry = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'K' :
|
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
noPskDheKe = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'I' :
|
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
updateKeysIVs = 1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case 'y' :
|
|
|
|
#if defined(WOLFSSL_TLS13) && !defined(NO_DH)
|
|
|
|
onlyKeyShare = 1;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Y' :
|
|
|
|
#if defined(WOLFSSL_TLS13) && defined(HAVE_ECC)
|
|
|
|
onlyKeyShare = 2;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
default:
|
|
|
|
Usage();
|
2012-08-01 17:33:49 -07:00
|
|
|
exit(MY_EX_USAGE);
|
2012-08-01 12:55:13 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-01 17:33:49 -07:00
|
|
|
myoptind = 0; /* reset for test cases */
|
2015-10-29 13:39:02 -06:00
|
|
|
#endif /* !WOLFSSL_VXWORKS */
|
2012-08-01 12:55:13 -07:00
|
|
|
|
2015-05-07 12:50:27 -07:00
|
|
|
if (externalTest) {
|
|
|
|
/* detect build cases that wouldn't allow test against wolfssl.com */
|
|
|
|
int done = 0;
|
|
|
|
|
|
|
|
#ifdef NO_RSA
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1;
|
2015-05-07 12:50:27 -07:00
|
|
|
#endif
|
|
|
|
|
2015-12-29 17:05:51 -07:00
|
|
|
/* www.globalsign.com does not respond to ipv6 ocsp requests */
|
|
|
|
#if defined(TEST_IPV6) && defined(HAVE_OCSP)
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1;
|
2015-12-29 17:05:51 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* www.globalsign.com has limited supported cipher suites */
|
|
|
|
#if defined(NO_AES) && defined(HAVE_OCSP)
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1;
|
2015-12-29 17:05:51 -07:00
|
|
|
#endif
|
|
|
|
|
2015-12-31 12:05:45 -07:00
|
|
|
/* www.globalsign.com only supports static RSA or ECDHE with AES */
|
|
|
|
/* We cannot expect users to have on static RSA so test for ECC only
|
|
|
|
* as some users will most likely be on 32-bit systems where ECC
|
|
|
|
* is not enabled by default */
|
|
|
|
#if defined(HAVE_OCSP) && !defined(HAVE_ECC)
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1;
|
2015-12-31 12:05:45 -07:00
|
|
|
#endif
|
|
|
|
|
2015-05-07 12:50:27 -07:00
|
|
|
#ifndef NO_PSK
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1;
|
2015-05-07 12:50:27 -07:00
|
|
|
#endif
|
|
|
|
|
2015-06-18 11:12:35 -07:00
|
|
|
#ifdef NO_SHA
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1; /* external cert chain most likely has SHA */
|
2015-06-18 11:12:35 -07:00
|
|
|
#endif
|
|
|
|
|
2016-02-09 17:06:06 -07:00
|
|
|
#if !defined(HAVE_ECC) && !defined(WOLFSSL_STATIC_RSA) \
|
2016-02-10 13:28:31 -07:00
|
|
|
|| ( defined(HAVE_ECC) && !defined(HAVE_SUPPORTED_CURVES) \
|
|
|
|
&& !defined(WOLFSSL_STATIC_RSA) )
|
2016-02-15 13:30:11 -07:00
|
|
|
/* google needs ECDHE+Supported Curves or static RSA */
|
|
|
|
if (!XSTRNCMP(domain, "www.google.com", 14))
|
|
|
|
done += 1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_ECC) && !defined(WOLFSSL_STATIC_RSA)
|
|
|
|
/* wolfssl needs ECDHE or static RSA */
|
|
|
|
if (!XSTRNCMP(domain, "www.wolfssl.com", 15))
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1;
|
2015-08-14 12:58:00 -07:00
|
|
|
#endif
|
|
|
|
|
2016-01-14 20:25:50 -08:00
|
|
|
#if !defined(WOLFSSL_SHA384)
|
|
|
|
if (!XSTRNCMP(domain, "www.wolfssl.com", 15)) {
|
2016-02-07 08:27:01 -07:00
|
|
|
/* wolfssl need sha384 for cert chain verify */
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1;
|
2016-01-14 20:25:50 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-09-28 09:47:59 -07:00
|
|
|
#if !defined(HAVE_AESGCM) && defined(NO_AES) && \
|
|
|
|
!(defined(HAVE_CHACHA) && defined(HAVE_POLY1305))
|
2016-02-07 08:27:01 -07:00
|
|
|
/* need at least on of these for external tests */
|
2016-02-08 19:54:22 -08:00
|
|
|
done += 1;
|
2015-09-28 09:47:59 -07:00
|
|
|
#endif
|
|
|
|
|
2015-05-07 12:50:27 -07:00
|
|
|
if (done) {
|
|
|
|
printf("external test can't be run in this mode");
|
|
|
|
|
|
|
|
((func_args*)args)->return_code = 0;
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-07 22:52:51 -08:00
|
|
|
/* sort out DTLS versus TLS versions */
|
|
|
|
if (version == CLIENT_INVALID_VERSION) {
|
|
|
|
if (doDTLS)
|
|
|
|
version = CLIENT_DTLS_DEFAULT_VERSION;
|
|
|
|
else
|
|
|
|
version = CLIENT_DEFAULT_VERSION;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (doDTLS) {
|
|
|
|
if (version == 3)
|
|
|
|
version = -2;
|
|
|
|
else
|
|
|
|
version = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-05 15:31:25 -06:00
|
|
|
#ifdef HAVE_WNR
|
|
|
|
if (wc_InitNetRandom(wnrConfigFile, NULL, 5000) != 0)
|
|
|
|
err_sys("can't load whitewood net random config file");
|
|
|
|
#endif
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
switch (version) {
|
2012-11-26 18:40:43 -08:00
|
|
|
#ifndef NO_OLD_TLS
|
2015-08-12 16:39:13 -07:00
|
|
|
#ifdef WOLFSSL_ALLOW_SSLV3
|
2012-08-01 12:55:13 -07:00
|
|
|
case 0:
|
2015-01-05 14:48:43 -07:00
|
|
|
method = wolfSSLv3_client_method();
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
2015-08-12 16:39:13 -07:00
|
|
|
#endif
|
|
|
|
|
2013-05-19 10:02:13 +09:00
|
|
|
#ifndef NO_TLS
|
2012-08-01 12:55:13 -07:00
|
|
|
case 1:
|
2015-01-05 14:48:43 -07:00
|
|
|
method = wolfTLSv1_client_method();
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2015-01-05 14:48:43 -07:00
|
|
|
method = wolfTLSv1_1_client_method();
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
2013-05-19 10:02:13 +09:00
|
|
|
#endif /* NO_TLS */
|
2015-08-12 16:39:13 -07:00
|
|
|
|
2013-05-19 10:02:13 +09:00
|
|
|
#endif /* NO_OLD_TLS */
|
2015-08-12 16:39:13 -07:00
|
|
|
|
2013-05-19 10:02:13 +09:00
|
|
|
#ifndef NO_TLS
|
2012-08-01 12:55:13 -07:00
|
|
|
case 3:
|
2015-01-05 14:48:43 -07:00
|
|
|
method = wolfTLSv1_2_client_method();
|
2012-08-01 12:55:13 -07:00
|
|
|
break;
|
2016-11-24 01:31:07 +10:00
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
case 4:
|
|
|
|
method = wolfTLSv1_3_client_method();
|
|
|
|
break;
|
|
|
|
#endif
|
2013-05-19 10:02:13 +09:00
|
|
|
#endif
|
2012-08-01 12:55:13 -07:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#ifdef WOLFSSL_DTLS
|
2015-04-08 13:29:25 -07:00
|
|
|
#ifndef NO_OLD_TLS
|
2012-08-02 11:54:49 -07:00
|
|
|
case -1:
|
2015-01-05 14:48:43 -07:00
|
|
|
method = wolfDTLSv1_client_method();
|
2012-08-02 11:54:49 -07:00
|
|
|
break;
|
2015-04-08 13:29:25 -07:00
|
|
|
#endif
|
2013-03-07 22:52:51 -08:00
|
|
|
|
|
|
|
case -2:
|
2015-01-05 14:48:43 -07:00
|
|
|
method = wolfDTLSv1_2_client_method();
|
2013-03-07 22:52:51 -08:00
|
|
|
break;
|
2012-08-02 11:54:49 -07:00
|
|
|
#endif
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
default:
|
|
|
|
err_sys("Bad SSL version");
|
2013-05-21 14:37:50 -07:00
|
|
|
break;
|
2012-08-01 12:55:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (method == NULL)
|
|
|
|
err_sys("unable to get method");
|
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
ctx = wolfSSL_CTX_new(method);
|
2012-08-01 12:55:13 -07:00
|
|
|
if (ctx == NULL)
|
|
|
|
err_sys("unable to get ctx");
|
|
|
|
|
2016-09-16 13:35:29 -07:00
|
|
|
#ifdef SINGLE_THREADED
|
|
|
|
if (wolfSSL_CTX_new_rng(ctx) != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-09-16 13:35:29 -07:00
|
|
|
err_sys("Single Threaded new rng at CTX failed");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-04-05 11:21:11 -07:00
|
|
|
if (cipherList && !useDefCipherList) {
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2013-01-21 10:53:42 -08:00
|
|
|
err_sys("client can't set cipher list 1");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2015-10-14 19:13:45 -07:00
|
|
|
}
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#ifdef WOLFSSL_LEANPSK
|
2016-04-11 11:13:26 -06:00
|
|
|
if (!usePsk) {
|
|
|
|
usePsk = 1;
|
|
|
|
}
|
2012-10-30 12:51:14 -07:00
|
|
|
#endif
|
|
|
|
|
2013-03-11 13:19:43 -07:00
|
|
|
#if defined(NO_RSA) && !defined(HAVE_ECC)
|
2016-04-11 11:13:26 -06:00
|
|
|
if (!usePsk) {
|
|
|
|
usePsk = 1;
|
|
|
|
}
|
2013-03-11 13:19:43 -07:00
|
|
|
#endif
|
|
|
|
|
2013-04-19 13:10:19 -07:00
|
|
|
if (fewerPackets)
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_set_group_messages(ctx);
|
2013-04-19 13:10:19 -07:00
|
|
|
|
2015-05-21 10:11:21 -07:00
|
|
|
#ifndef NO_DH
|
|
|
|
wolfSSL_CTX_SetMinDhKey_Sz(ctx, (word16)minDhKeyBits);
|
|
|
|
#endif
|
|
|
|
|
2012-10-30 12:51:14 -07:00
|
|
|
if (usePsk) {
|
2011-02-05 11:14:47 -08:00
|
|
|
#ifndef NO_PSK
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb);
|
2012-10-30 12:51:14 -07:00
|
|
|
if (cipherList == NULL) {
|
|
|
|
const char *defaultCipherList;
|
2015-03-27 14:28:05 -07:00
|
|
|
#if defined(HAVE_AESGCM) && !defined(NO_DH)
|
|
|
|
defaultCipherList = "DHE-PSK-AES128-GCM-SHA256";
|
|
|
|
#elif defined(HAVE_NULL_CIPHER)
|
2013-03-07 17:44:40 -08:00
|
|
|
defaultCipherList = "PSK-NULL-SHA256";
|
2012-10-30 12:51:14 -07:00
|
|
|
#else
|
2013-03-11 13:19:43 -07:00
|
|
|
defaultCipherList = "PSK-AES128-CBC-SHA256";
|
2012-10-30 12:51:14 -07:00
|
|
|
#endif
|
2015-03-27 14:28:05 -07:00
|
|
|
if (wolfSSL_CTX_set_cipher_list(ctx,defaultCipherList)
|
2017-01-10 09:26:47 +10:00
|
|
|
!=SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2013-01-21 10:53:42 -08:00
|
|
|
err_sys("client can't set cipher list 2");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2012-10-30 12:51:14 -07:00
|
|
|
}
|
2011-02-05 11:14:47 -08:00
|
|
|
#endif
|
2016-04-11 11:13:26 -06:00
|
|
|
if (useClientCert) {
|
|
|
|
useClientCert = 0;
|
|
|
|
}
|
2012-10-30 12:51:14 -07:00
|
|
|
}
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2014-12-01 11:44:32 -08:00
|
|
|
if (useAnon) {
|
|
|
|
#ifdef HAVE_ANON
|
2017-04-05 14:35:33 -07:00
|
|
|
if (cipherList == NULL || (cipherList && useDefCipherList)) {
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_allow_anon_cipher(ctx);
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_CTX_set_cipher_list(ctx,"ADH-AES128-SHA")
|
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2014-12-01 11:44:32 -08:00
|
|
|
err_sys("client can't set cipher list 4");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2014-12-01 11:44:32 -08:00
|
|
|
}
|
|
|
|
#endif
|
2016-04-11 11:13:26 -06:00
|
|
|
if (useClientCert) {
|
|
|
|
useClientCert = 0;
|
|
|
|
}
|
2014-12-01 11:44:32 -08:00
|
|
|
}
|
|
|
|
|
2016-08-26 10:47:01 -07:00
|
|
|
#ifdef WOLFSSL_SCTP
|
|
|
|
if (dtlsSCTP)
|
|
|
|
wolfSSL_CTX_dtls_set_sctp(ctx);
|
|
|
|
#endif
|
|
|
|
|
2014-03-03 12:18:26 -08:00
|
|
|
#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack);
|
2011-02-05 11:14:47 -08:00
|
|
|
#endif
|
|
|
|
|
2015-04-01 12:14:48 -07:00
|
|
|
#if defined(WOLFSSL_SNIFFER)
|
2012-08-31 13:28:07 -07:00
|
|
|
if (cipherList == NULL) {
|
2012-10-30 12:51:14 -07:00
|
|
|
/* don't use EDH, can't sniff tmp keys */
|
2015-12-17 12:10:22 -08:00
|
|
|
if (wolfSSL_CTX_set_cipher_list(ctx, "AES128-SHA") != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2013-01-21 10:53:42 -08:00
|
|
|
err_sys("client can't set cipher list 3");
|
2012-10-30 12:51:14 -07:00
|
|
|
}
|
2012-08-31 13:28:07 -07:00
|
|
|
}
|
2011-04-29 10:41:21 -07:00
|
|
|
#endif
|
|
|
|
|
2013-06-20 11:07:54 -07:00
|
|
|
#ifdef HAVE_OCSP
|
|
|
|
if (useOcsp) {
|
2017-03-06 09:49:05 -08:00
|
|
|
#ifdef HAVE_IO_TIMEOUT
|
|
|
|
wolfIO_SetTimeout(DEFAULT_TIMEOUT_SEC);
|
|
|
|
#endif
|
|
|
|
|
2013-12-17 18:26:29 -08:00
|
|
|
if (ocspUrl != NULL) {
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl);
|
|
|
|
wolfSSL_CTX_EnableOCSP(ctx, WOLFSSL_OCSP_NO_NONCE
|
|
|
|
| WOLFSSL_OCSP_URL_OVERRIDE);
|
2013-12-17 18:26:29 -08:00
|
|
|
}
|
|
|
|
else
|
2015-11-05 11:36:11 -03:00
|
|
|
wolfSSL_CTX_EnableOCSP(ctx, 0);
|
2013-06-20 11:07:54 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-01-26 12:52:54 -08:00
|
|
|
#ifdef USER_CA_CB
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_SetCACb(ctx, CaCb);
|
2012-01-26 12:52:54 -08:00
|
|
|
#endif
|
|
|
|
|
2011-02-05 11:14:47 -08:00
|
|
|
#ifdef VERIFY_CALLBACK
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myVerify);
|
2011-02-05 11:14:47 -08:00
|
|
|
#endif
|
2016-11-23 17:19:54 -08:00
|
|
|
#if !defined(NO_CERTS)
|
2013-04-19 13:10:19 -07:00
|
|
|
if (useClientCert){
|
2016-11-23 17:19:54 -08:00
|
|
|
#if !defined(NO_FILESYSTEM)
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_CTX_use_certificate_chain_file(ctx, ourCert)
|
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2012-10-29 15:39:42 -07:00
|
|
|
err_sys("can't load client cert file, check file and run from"
|
2015-01-05 14:48:43 -07:00
|
|
|
" wolfSSL home dir");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
if (wolfSSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM)
|
2017-01-10 09:26:47 +10:00
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2013-03-11 16:07:46 -07:00
|
|
|
err_sys("can't load client private key file, check file and run "
|
2015-01-05 14:48:43 -07:00
|
|
|
"from wolfSSL home dir");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2016-11-23 17:19:54 -08:00
|
|
|
#else
|
|
|
|
load_buffer(ctx, ourCert, WOLFSSL_CERT_CHAIN);
|
|
|
|
load_buffer(ctx, ourKey, WOLFSSL_KEY);
|
|
|
|
#endif /* !defined(NO_FILESYSTEM) */
|
2013-04-19 13:10:19 -07:00
|
|
|
}
|
2012-08-01 12:55:13 -07:00
|
|
|
|
2014-12-01 11:44:32 -08:00
|
|
|
if (!usePsk && !useAnon) {
|
2016-11-23 17:19:54 -08:00
|
|
|
#if !defined(NO_FILESYSTEM)
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_CTX_load_verify_locations(ctx, verifyCert,0)
|
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-04-01 12:03:27 -07:00
|
|
|
err_sys("can't load ca file, Please run from wolfSSL home dir");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2016-11-23 17:19:54 -08:00
|
|
|
#else
|
|
|
|
load_buffer(ctx, verifyCert, WOLFSSL_CA);
|
|
|
|
#endif /* !defined(NO_FILESYSTEM) */
|
2015-04-01 12:03:27 -07:00
|
|
|
#ifdef HAVE_ECC
|
|
|
|
/* load ecc verify too, echoserver uses it by default w/ ecc */
|
2016-11-23 17:19:54 -08:00
|
|
|
#if !defined(NO_FILESYSTEM)
|
2017-04-06 15:54:59 -07:00
|
|
|
if (wolfSSL_CTX_load_verify_locations(ctx, eccCertFile, 0) != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-04-01 12:03:27 -07:00
|
|
|
err_sys("can't load ecc ca file, Please run from wolfSSL home dir");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2016-11-23 17:19:54 -08:00
|
|
|
#else
|
2017-04-06 15:54:59 -07:00
|
|
|
load_buffer(ctx, eccCertFile, WOLFSSL_CA);
|
2016-11-23 17:19:54 -08:00
|
|
|
#endif /* !defined(NO_FILESYSTEM) */
|
2015-04-01 12:03:27 -07:00
|
|
|
#endif /* HAVE_ECC */
|
2016-11-23 17:19:54 -08:00
|
|
|
#if defined(WOLFSSL_TRUST_PEER_CERT) && !defined(NO_FILESYSTEM)
|
2016-03-01 16:35:32 -07:00
|
|
|
if (trustCert) {
|
|
|
|
if ((ret = wolfSSL_CTX_trust_peer_cert(ctx, trustCert,
|
|
|
|
SSL_FILETYPE_PEM)) != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-03-01 16:35:32 -07:00
|
|
|
err_sys("can't load trusted peer cert file");
|
|
|
|
}
|
2016-02-29 11:02:18 -07:00
|
|
|
}
|
2016-11-23 17:19:54 -08:00
|
|
|
#endif /* WOLFSSL_TRUST_PEER_CERT && !NO_FILESYSTEM */
|
2012-10-29 15:39:42 -07:00
|
|
|
}
|
2014-12-01 11:44:32 -08:00
|
|
|
if (!usePsk && !useAnon && doPeerCheck == 0)
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
2014-12-01 11:44:32 -08:00
|
|
|
if (!usePsk && !useAnon && overrideDateErrors == 1)
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myDateCb);
|
2016-11-23 17:19:54 -08:00
|
|
|
#endif /* !defined(NO_CERTS) */
|
2012-08-01 12:55:13 -07:00
|
|
|
|
2016-08-15 13:59:41 -06:00
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
ret = wolfAsync_DevOpen(&devId);
|
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-07 15:46:32 -07:00
|
|
|
if (ret < 0) {
|
|
|
|
printf("Async device open failed\nRunning without async\n");
|
2016-08-15 13:59:41 -06:00
|
|
|
}
|
|
|
|
wolfSSL_CTX_UseAsync(ctx, devId);
|
|
|
|
#endif /* WOLFSSL_ASYNC_CRYPT */
|
2013-02-01 12:21:38 -08:00
|
|
|
|
2013-05-21 14:37:50 -07:00
|
|
|
#ifdef HAVE_SNI
|
|
|
|
if (sniHostName)
|
2015-01-05 14:48:43 -07:00
|
|
|
if (wolfSSL_CTX_UseSNI(ctx, 0, sniHostName, XSTRLEN(sniHostName))
|
2017-01-10 09:26:47 +10:00
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2013-05-21 14:37:50 -07:00
|
|
|
err_sys("UseSNI failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2013-05-21 14:37:50 -07:00
|
|
|
#endif
|
2013-07-23 15:42:43 -03:00
|
|
|
#ifdef HAVE_MAX_FRAGMENT
|
|
|
|
if (maxFragment)
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_CTX_UseMaxFragment(ctx, maxFragment) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2013-07-23 15:42:43 -03:00
|
|
|
err_sys("UseMaxFragment failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2013-07-23 15:42:43 -03:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_TRUNCATED_HMAC
|
|
|
|
if (truncatedHMAC)
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_CTX_UseTruncatedHMAC(ctx) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2013-07-23 15:42:43 -03:00
|
|
|
err_sys("UseTruncatedHMAC failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2013-07-23 15:42:43 -03:00
|
|
|
#endif
|
2014-09-30 09:24:42 -03:00
|
|
|
#ifdef HAVE_SESSION_TICKET
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_CTX_UseSessionTicket(ctx) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2014-09-30 09:24:42 -03:00
|
|
|
err_sys("UseSessionTicket failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2014-09-30 09:24:42 -03:00
|
|
|
#endif
|
2016-09-01 15:17:46 -06:00
|
|
|
#ifdef HAVE_EXTENDED_MASTER
|
2016-09-09 23:16:52 -07:00
|
|
|
if (disableExtMasterSecret)
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_CTX_DisableExtendedMasterSecret(ctx) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-09-09 23:16:52 -07:00
|
|
|
err_sys("DisableExtendedMasterSecret failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2016-09-01 15:17:46 -06:00
|
|
|
#endif
|
2013-05-21 14:37:50 -07:00
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
if (benchmark) {
|
2015-10-14 19:13:45 -07:00
|
|
|
((func_args*)args)->return_code =
|
2016-08-25 22:20:35 -07:00
|
|
|
ClientBenchmarkConnections(ctx, host, port, dtlsUDP, dtlsSCTP,
|
|
|
|
benchmark, resumeSession);
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-10-14 19:13:45 -07:00
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
2012-08-01 12:55:13 -07:00
|
|
|
|
2015-10-14 19:13:45 -07:00
|
|
|
if(throughput) {
|
|
|
|
((func_args*)args)->return_code =
|
2016-08-25 22:20:35 -07:00
|
|
|
ClientBenchmarkThroughput(ctx, host, port, dtlsUDP, dtlsSCTP,
|
|
|
|
throughput);
|
2015-10-14 19:13:45 -07:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2012-08-01 12:55:13 -07:00
|
|
|
exit(EXIT_SUCCESS);
|
2011-02-05 11:14:47 -08:00
|
|
|
}
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#if defined(WOLFSSL_MDK_ARM)
|
|
|
|
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
2013-05-19 10:02:13 +09:00
|
|
|
#endif
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2016-12-08 19:05:35 -07:00
|
|
|
#if defined(OPENSSL_EXTRA)
|
|
|
|
if (wolfSSL_CTX_get_read_ahead(ctx) != 0) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-12-08 19:05:35 -07:00
|
|
|
err_sys("bad read ahead default value");
|
|
|
|
}
|
2016-12-09 13:16:17 -07:00
|
|
|
if (wolfSSL_CTX_set_read_ahead(ctx, 1) != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-12-09 13:16:17 -07:00
|
|
|
err_sys("error setting read ahead value");
|
|
|
|
}
|
2016-12-08 19:05:35 -07:00
|
|
|
#endif
|
|
|
|
|
2016-11-24 01:31:07 +10:00
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
if (noPskDheKe)
|
|
|
|
wolfSSL_CTX_no_dhe_psk(ctx);
|
|
|
|
#endif
|
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
ssl = wolfSSL_new(ctx);
|
2017-01-10 09:26:47 +10:00
|
|
|
if (ssl == NULL) {
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2012-08-01 12:55:13 -07:00
|
|
|
err_sys("unable to get SSL object");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2016-01-29 09:38:13 -07:00
|
|
|
|
2016-11-07 10:15:04 -07:00
|
|
|
#ifdef OPENSSL_EXTRA
|
|
|
|
wolfSSL_KeepArrays(ssl);
|
|
|
|
#endif
|
|
|
|
|
2016-11-24 01:31:07 +10:00
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
if (!helloRetry) {
|
|
|
|
if (onlyKeyShare == 0 || onlyKeyShare == 1) {
|
|
|
|
#ifdef HAVE_FFDHE_2048
|
|
|
|
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_FFDHE_2048) != SSL_SUCCESS) {
|
|
|
|
err_sys("unable to use DH 2048-bit parameters");
|
|
|
|
}
|
|
|
|
#endif
|
2016-01-29 09:38:13 -07:00
|
|
|
}
|
2016-11-24 01:31:07 +10:00
|
|
|
if (onlyKeyShare == 0 || onlyKeyShare == 2) {
|
|
|
|
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
|
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
err_sys("unable to use curve secp256r1");
|
|
|
|
}
|
|
|
|
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP384R1)
|
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
err_sys("unable to use curve secp384r1");
|
|
|
|
}
|
2016-01-29 09:38:13 -07:00
|
|
|
}
|
2016-11-24 01:31:07 +10:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
wolfSSL_NoKeyShares(ssl);
|
|
|
|
}
|
2017-01-18 11:54:43 -08:00
|
|
|
#endif
|
2016-01-29 09:38:13 -07:00
|
|
|
|
2014-10-20 09:25:14 -07:00
|
|
|
#ifdef HAVE_SESSION_TICKET
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_set_SessionTicket_cb(ssl, sessionTicketCB, (void*)"initial session");
|
2014-10-20 09:25:14 -07:00
|
|
|
#endif
|
2015-10-13 15:00:53 -07:00
|
|
|
|
|
|
|
#ifdef HAVE_ALPN
|
|
|
|
if (alpnList != NULL) {
|
|
|
|
printf("ALPN accepted protocols list : %s\n", alpnList);
|
|
|
|
wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList), alpn_opt);
|
|
|
|
}
|
|
|
|
#endif
|
2015-11-02 15:51:01 -03:00
|
|
|
#ifdef HAVE_CERTIFICATE_STATUS_REQUEST
|
|
|
|
if (statusRequest) {
|
2015-12-28 19:38:04 -03:00
|
|
|
switch (statusRequest) {
|
|
|
|
case WOLFSSL_CSR_OCSP:
|
|
|
|
if (wolfSSL_UseOCSPStapling(ssl, WOLFSSL_CSR_OCSP,
|
2017-01-10 09:26:47 +10:00
|
|
|
WOLFSSL_CSR_OCSP_USE_NONCE) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-12-28 19:38:04 -03:00
|
|
|
err_sys("UseCertificateStatusRequest failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2015-12-28 19:38:04 -03:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
wolfSSL_CTX_EnableOCSP(ctx, 0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_CERTIFICATE_STATUS_REQUEST_V2
|
|
|
|
if (statusRequest) {
|
|
|
|
switch (statusRequest) {
|
|
|
|
case WOLFSSL_CSR2_OCSP:
|
|
|
|
if (wolfSSL_UseOCSPStaplingV2(ssl,
|
|
|
|
WOLFSSL_CSR2_OCSP, WOLFSSL_CSR2_OCSP_USE_NONCE)
|
2017-01-10 09:26:47 +10:00
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-12-28 19:38:04 -03:00
|
|
|
err_sys("UseCertificateStatusRequest failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2015-12-28 19:38:04 -03:00
|
|
|
break;
|
|
|
|
case WOLFSSL_CSR2_OCSP_MULTI:
|
|
|
|
if (wolfSSL_UseOCSPStaplingV2(ssl,
|
|
|
|
WOLFSSL_CSR2_OCSP_MULTI, 0)
|
2017-01-10 09:26:47 +10:00
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-12-28 19:38:04 -03:00
|
|
|
err_sys("UseCertificateStatusRequest failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2015-12-28 19:38:04 -03:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
2015-11-02 15:51:01 -03:00
|
|
|
|
2015-11-05 11:36:11 -03:00
|
|
|
wolfSSL_CTX_EnableOCSP(ctx, 0);
|
2015-11-02 15:51:01 -03:00
|
|
|
}
|
|
|
|
#endif
|
2015-10-13 15:00:53 -07:00
|
|
|
|
2016-08-25 22:20:35 -07:00
|
|
|
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, ssl);
|
2016-03-25 13:59:04 -06:00
|
|
|
if (wolfSSL_set_fd(ssl, sockfd) != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-03-25 13:59:04 -06:00
|
|
|
err_sys("error in setting fd");
|
|
|
|
}
|
2016-04-22 13:46:54 -06:00
|
|
|
|
|
|
|
/* STARTTLS */
|
|
|
|
if (doSTARTTLS) {
|
2016-04-28 14:21:33 -06:00
|
|
|
if (StartTLS_Init(&sockfd) != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("error during STARTTLS protocol");
|
2016-04-22 13:46:54 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-16 17:04:56 -07:00
|
|
|
#ifdef HAVE_CRL
|
2015-05-07 10:02:43 -07:00
|
|
|
if (disableCRL == 0) {
|
2017-03-06 09:49:05 -08:00
|
|
|
#ifdef HAVE_IO_TIMEOUT
|
|
|
|
wolfIO_SetTimeout(DEFAULT_TIMEOUT_SEC);
|
|
|
|
#endif
|
|
|
|
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_EnableCRL(ssl, WOLFSSL_CRL_CHECKALL) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-05-07 10:02:43 -07:00
|
|
|
err_sys("can't enable crl check");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
|
|
|
if (wolfSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, 0)
|
|
|
|
!= SSL_SUCCESS) {
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-05-07 10:02:43 -07:00
|
|
|
err_sys("can't load crl, check crlfile and date validity");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
|
|
|
if (wolfSSL_SetCRL_Cb(ssl, CRL_CallBack) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-05-07 10:02:43 -07:00
|
|
|
err_sys("can't set crl callback");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2015-05-07 10:02:43 -07:00
|
|
|
}
|
2013-08-09 17:27:15 -07:00
|
|
|
#endif
|
2014-09-24 18:48:23 -07:00
|
|
|
#ifdef HAVE_SECURE_RENEGOTIATION
|
|
|
|
if (scr) {
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_UseSecureRenegotiation(ssl) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2014-09-24 18:48:23 -07:00
|
|
|
err_sys("can't enable secure renegotiation");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2014-09-24 18:48:23 -07:00
|
|
|
}
|
|
|
|
#endif
|
2013-08-09 17:27:15 -07:00
|
|
|
#ifdef ATOMIC_USER
|
|
|
|
if (atomicUser)
|
|
|
|
SetupAtomicUser(ctx, ssl);
|
2013-08-22 18:19:39 -07:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PK_CALLBACKS
|
|
|
|
if (pkCallbacks)
|
|
|
|
SetupPkCallbacks(ctx, ssl);
|
2012-05-16 17:04:56 -07:00
|
|
|
#endif
|
2012-08-10 10:15:37 -07:00
|
|
|
if (matchName && doPeerCheck)
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_check_domain_name(ssl, domain);
|
|
|
|
#ifndef WOLFSSL_CALLBACKS
|
2012-10-17 13:13:58 -07:00
|
|
|
if (nonBlocking) {
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_set_using_nonblock(ssl, 1);
|
2012-10-17 13:13:58 -07:00
|
|
|
tcp_set_nonblocking(&sockfd);
|
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-07 15:46:32 -07:00
|
|
|
ret = NonBlockingSSL_Connect(ssl);
|
2012-10-17 13:13:58 -07:00
|
|
|
}
|
2016-03-04 10:05:22 -08:00
|
|
|
else {
|
|
|
|
do {
|
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-07 15:46:32 -07:00
|
|
|
err = 0; /* reset error */
|
2016-03-04 10:05:22 -08:00
|
|
|
ret = wolfSSL_connect(ssl);
|
|
|
|
if (ret != SSL_SUCCESS) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
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-07 15:46:32 -07:00
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
2016-03-04 10:05:22 -08: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-07 15:46:32 -07:00
|
|
|
} while (err == WC_PENDING_E);
|
2012-10-17 13:13:58 -07:00
|
|
|
}
|
2011-02-05 11:14:47 -08:00
|
|
|
#else
|
2017-03-06 09:49:05 -08:00
|
|
|
timeout.tv_sec = DEFAULT_TIMEOUT_SEC;
|
2012-10-17 13:13:58 -07:00
|
|
|
timeout.tv_usec = 0;
|
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-07 15:46:32 -07:00
|
|
|
ret = NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */
|
2011-02-05 11:14:47 -08:00
|
|
|
#endif
|
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-07 15:46:32 -07:00
|
|
|
if (ret != SSL_SUCCESS) {
|
|
|
|
printf("wolfSSL_connect error %d, %s\n", err,
|
|
|
|
wolfSSL_ERR_error_string(err, buffer));
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
|
|
|
err_sys("wolfSSL_connect failed");
|
|
|
|
/* see note at top of README */
|
|
|
|
/* if you're getting an error here */
|
|
|
|
}
|
|
|
|
|
2011-02-05 11:14:47 -08:00
|
|
|
showPeer(ssl);
|
2012-08-20 17:02:25 -07:00
|
|
|
|
2016-11-07 10:15:04 -07:00
|
|
|
#ifdef OPENSSL_EXTRA
|
|
|
|
{
|
2016-11-11 13:39:36 -07:00
|
|
|
byte* rnd;
|
|
|
|
byte* pt;
|
|
|
|
size_t size;
|
2016-11-07 10:15:04 -07:00
|
|
|
|
|
|
|
/* get size of buffer then print */
|
|
|
|
size = wolfSSL_get_client_random(NULL, NULL, 0);
|
2016-11-11 13:39:36 -07:00
|
|
|
if (size == 0) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-11-07 10:15:04 -07:00
|
|
|
err_sys("error getting client random buffer size");
|
|
|
|
}
|
|
|
|
|
|
|
|
rnd = (byte*)XMALLOC(size, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
|
|
|
if (rnd == NULL) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-11-07 10:15:04 -07:00
|
|
|
err_sys("error creating client random buffer");
|
|
|
|
}
|
|
|
|
|
|
|
|
size = wolfSSL_get_client_random(ssl, rnd, size);
|
2016-11-11 13:39:36 -07:00
|
|
|
if (size == 0) {
|
2016-11-07 10:15:04 -07:00
|
|
|
XFREE(rnd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-11-07 10:15:04 -07:00
|
|
|
err_sys("error getting client random buffer");
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("Client Random : ");
|
|
|
|
for (pt = rnd; pt < rnd + size; pt++) printf("%02X", *pt);
|
|
|
|
printf("\n");
|
|
|
|
XFREE(rnd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-04-22 13:46:54 -06:00
|
|
|
if (doSTARTTLS) {
|
2016-04-28 14:21:33 -06:00
|
|
|
if (XSTRNCMP(starttlsProt, "smtp", 4) == 0) {
|
|
|
|
if (SMTP_Shutdown(ssl, wc_shutdown) != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-04-28 14:21:33 -06:00
|
|
|
err_sys("error closing STARTTLS connection");
|
|
|
|
}
|
|
|
|
}
|
2016-04-22 13:46:54 -06:00
|
|
|
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
CloseSocket(sockfd);
|
|
|
|
|
|
|
|
wolfSSL_CTX_free(ctx);
|
|
|
|
|
|
|
|
((func_args*)args)->return_code = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-10-13 15:00:53 -07:00
|
|
|
#ifdef HAVE_ALPN
|
|
|
|
if (alpnList != NULL) {
|
|
|
|
char *protocol_name = NULL;
|
|
|
|
word16 protocol_nameSz = 0;
|
|
|
|
|
|
|
|
err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz);
|
|
|
|
if (err == SSL_SUCCESS)
|
|
|
|
printf("Received ALPN protocol : %s (%d)\n",
|
|
|
|
protocol_name, protocol_nameSz);
|
|
|
|
else if (err == SSL_ALPN_NOT_FOUND)
|
|
|
|
printf("No ALPN response received (no match with server)\n");
|
|
|
|
else
|
|
|
|
printf("Getting ALPN protocol name failed\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-09-24 18:48:23 -07:00
|
|
|
#ifdef HAVE_SECURE_RENEGOTIATION
|
2014-09-29 15:32:41 -07:00
|
|
|
if (scr && forceScr) {
|
2014-09-24 18:48:23 -07:00
|
|
|
if (nonBlocking) {
|
|
|
|
printf("not doing secure renegotiation on example with"
|
|
|
|
" nonblocking yet");
|
2014-09-26 10:47:57 -07:00
|
|
|
} else {
|
2015-01-05 14:48:43 -07:00
|
|
|
if (wolfSSL_Rehandshake(ssl) != SSL_SUCCESS) {
|
2016-06-23 13:10:39 -06:00
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
2014-09-26 10:47:57 -07:00
|
|
|
printf("err = %d, %s\n", err,
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_ERR_error_string(err, buffer));
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-01-05 14:48:43 -07:00
|
|
|
err_sys("wolfSSL_Rehandshake failed");
|
2014-09-26 10:47:57 -07:00
|
|
|
}
|
2014-09-24 18:48:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_SECURE_RENEGOTIATION */
|
|
|
|
|
2012-08-01 12:55:13 -07:00
|
|
|
if (sendGET) {
|
2011-02-05 11:14:47 -08:00
|
|
|
printf("SSL connect ok, sending GET...\n");
|
2011-03-22 08:18:27 -07:00
|
|
|
msgSz = 28;
|
|
|
|
strncpy(msg, "GET /index.html HTTP/1.0\r\n\r\n", msgSz);
|
2013-02-14 14:09:41 -08:00
|
|
|
msg[msgSz] = '\0';
|
2015-11-02 13:26:46 -08:00
|
|
|
|
|
|
|
resumeSz = msgSz;
|
|
|
|
strncpy(resumeMsg, "GET /index.html HTTP/1.0\r\n\r\n", resumeSz);
|
|
|
|
resumeMsg[resumeSz] = '\0';
|
2011-02-05 11:14:47 -08:00
|
|
|
}
|
2016-05-10 13:27:45 -06:00
|
|
|
|
|
|
|
/* allow some time for exporting the session */
|
|
|
|
#ifdef WOLFSSL_SESSION_EXPORT_DEBUG
|
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-07 15:46:32 -07:00
|
|
|
#ifdef USE_WINDOWS_API
|
|
|
|
Sleep(500);
|
|
|
|
#elif defined(WOLFSSL_TIRTOS)
|
|
|
|
Task_sleep(1);
|
|
|
|
#else
|
|
|
|
sleep(1);
|
|
|
|
#endif
|
2016-05-10 13:27:45 -06:00
|
|
|
#endif /* WOLFSSL_SESSION_EXPORT_DEBUG */
|
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-07 15:46:32 -07:00
|
|
|
|
2016-11-24 01:31:07 +10:00
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
if (updateKeysIVs)
|
|
|
|
wolfSSL_update_keys(ssl);
|
|
|
|
#endif
|
|
|
|
|
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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_write(ssl, msg, msgSz);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret != msgSz) {
|
|
|
|
printf("SSL_write msg error %d, %s\n", err,
|
|
|
|
wolfSSL_ERR_error_string(err, buffer));
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2011-02-05 11:14:47 -08:00
|
|
|
err_sys("SSL_write failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2011-02-05 11:14:47 -08: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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_read(ssl, reply, sizeof(reply)-1);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret > 0) {
|
|
|
|
reply[ret] = 0;
|
2011-02-05 11:14:47 -08:00
|
|
|
printf("Server response: %s\n", reply);
|
2011-03-22 08:18:27 -07:00
|
|
|
|
2012-08-02 12:15:42 -07:00
|
|
|
if (sendGET) { /* get html */
|
2011-03-22 08:18:27 -07:00
|
|
|
while (1) {
|
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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_read(ssl, reply, sizeof(reply)-1);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(ssl, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(ssl, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret > 0) {
|
|
|
|
reply[ret] = 0;
|
2011-03-22 08:18:27 -07:00
|
|
|
printf("%s\n", reply);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-02-05 11:14:47 -08: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-07 15:46:32 -07:00
|
|
|
if (ret < 0) {
|
|
|
|
if (err != SSL_ERROR_WANT_READ) {
|
|
|
|
printf("SSL_read reply error %d, %s\n", err,
|
|
|
|
wolfSSL_ERR_error_string(err, buffer));
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
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-07 15:46:32 -07:00
|
|
|
err_sys("SSL_read failed");
|
2016-11-03 14:45:24 -07:00
|
|
|
}
|
2012-12-28 17:54:19 -08:00
|
|
|
}
|
2012-10-17 13:13:58 -07:00
|
|
|
|
2013-03-11 16:07:46 -07:00
|
|
|
#ifndef NO_SESSION_CACHE
|
2012-10-17 13:13:58 -07:00
|
|
|
if (resumeSession) {
|
2015-01-05 14:48:43 -07:00
|
|
|
session = wolfSSL_get_session(ssl);
|
|
|
|
sslResume = wolfSSL_new(ctx);
|
2017-01-10 09:26:47 +10:00
|
|
|
if (sslResume == NULL) {
|
|
|
|
wolfSSL_free(ssl);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-10-16 14:12:38 -07:00
|
|
|
err_sys("unable to get SSL object");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2012-08-02 11:54:49 -07:00
|
|
|
}
|
2013-03-11 16:07:46 -07:00
|
|
|
#endif
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2016-08-25 22:20:35 -07:00
|
|
|
if (dtlsUDP == 0) { /* don't send alert after "break" command */
|
2015-02-16 14:23:33 -08:00
|
|
|
ret = wolfSSL_shutdown(ssl);
|
2015-02-18 08:00:25 -07:00
|
|
|
if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE)
|
2015-02-16 14:23:33 -08:00
|
|
|
wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
2015-01-30 08:41:34 -07:00
|
|
|
}
|
2013-08-09 17:27:15 -07:00
|
|
|
#ifdef ATOMIC_USER
|
|
|
|
if (atomicUser)
|
|
|
|
FreeAtomicUser(ssl);
|
|
|
|
#endif
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_free(ssl);
|
2011-02-05 11:14:47 -08:00
|
|
|
CloseSocket(sockfd);
|
|
|
|
|
2013-03-11 16:07:46 -07:00
|
|
|
#ifndef NO_SESSION_CACHE
|
2012-10-17 13:13:58 -07:00
|
|
|
if (resumeSession) {
|
2016-08-25 22:20:35 -07:00
|
|
|
if (dtlsUDP) {
|
2015-10-14 19:13:45 -07:00
|
|
|
#ifdef USE_WINDOWS_API
|
|
|
|
Sleep(500);
|
|
|
|
#elif defined(WOLFSSL_TIRTOS)
|
|
|
|
Task_sleep(1);
|
|
|
|
#else
|
|
|
|
sleep(1);
|
|
|
|
#endif
|
2012-10-17 13:13:58 -07:00
|
|
|
}
|
2016-08-25 22:20:35 -07:00
|
|
|
tcp_connect(&sockfd, host, port, dtlsUDP, dtlsSCTP, sslResume);
|
2016-03-25 13:59:04 -06:00
|
|
|
if (wolfSSL_set_fd(sslResume, sockfd) != SSL_SUCCESS) {
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(sslResume);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2016-03-25 13:59:04 -06:00
|
|
|
err_sys("error in setting fd");
|
|
|
|
}
|
2015-10-13 15:00:53 -07:00
|
|
|
#ifdef HAVE_ALPN
|
|
|
|
if (alpnList != NULL) {
|
|
|
|
printf("ALPN accepted protocols list : %s\n", alpnList);
|
|
|
|
wolfSSL_UseALPN(sslResume, alpnList, (word32)XSTRLEN(alpnList),
|
|
|
|
alpn_opt);
|
|
|
|
}
|
|
|
|
#endif
|
2015-04-29 17:06:57 -07:00
|
|
|
#ifdef HAVE_SECURE_RENEGOTIATION
|
|
|
|
if (scr) {
|
2017-01-10 09:26:47 +10:00
|
|
|
if (wolfSSL_UseSecureRenegotiation(sslResume) != SSL_SUCCESS) {
|
|
|
|
wolfSSL_free(sslResume);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2015-04-29 17:06:57 -07:00
|
|
|
err_sys("can't enable secure renegotiation");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2015-04-29 17:06:57 -07:00
|
|
|
}
|
|
|
|
#endif
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_set_session(sslResume, session);
|
2014-10-20 09:25:14 -07:00
|
|
|
#ifdef HAVE_SESSION_TICKET
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_set_SessionTicket_cb(sslResume, sessionTicketCB,
|
2014-10-20 09:25:14 -07:00
|
|
|
(void*)"resumed session");
|
|
|
|
#endif
|
2016-11-24 01:31:07 +10:00
|
|
|
|
|
|
|
#ifdef WOLFSSL_TLS13
|
|
|
|
#ifdef HAVE_FFDHE_2048
|
|
|
|
if (wolfSSL_UseKeyShare(sslResume, WOLFSSL_FFDHE_2048) != SSL_SUCCESS) {
|
|
|
|
err_sys("unable to use DH 2048-bit parameters");
|
2016-09-01 15:17:46 -06:00
|
|
|
}
|
2016-11-24 01:31:07 +10:00
|
|
|
#endif
|
|
|
|
if (wolfSSL_UseKeyShare(sslResume,
|
|
|
|
WOLFSSL_ECC_SECP256R1) != SSL_SUCCESS) {
|
|
|
|
err_sys("unable to use curve secp256r1");
|
2016-09-01 15:17:46 -06:00
|
|
|
}
|
2016-11-24 01:31:07 +10:00
|
|
|
if (wolfSSL_UseKeyShare(sslResume,
|
|
|
|
WOLFSSL_ECC_SECP384R1) != SSL_SUCCESS) {
|
|
|
|
err_sys("unable to use curve secp384r1");
|
2016-09-01 15:17:46 -06:00
|
|
|
}
|
|
|
|
#endif
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#ifndef WOLFSSL_CALLBACKS
|
2012-10-17 13:13:58 -07:00
|
|
|
if (nonBlocking) {
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_set_using_nonblock(sslResume, 1);
|
2012-10-17 13:13:58 -07:00
|
|
|
tcp_set_nonblocking(&sockfd);
|
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-07 15:46:32 -07:00
|
|
|
ret = NonBlockingSSL_Connect(sslResume);
|
2012-10-17 13:13:58 -07: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-07 15:46:32 -07:00
|
|
|
else {
|
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_connect(sslResume);
|
|
|
|
if (ret != SSL_SUCCESS) {
|
|
|
|
err = wolfSSL_get_error(sslResume, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(sslResume,
|
|
|
|
WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2012-10-17 13:13:58 -07:00
|
|
|
#else
|
2017-03-06 09:49:05 -08:00
|
|
|
timeout.tv_sec = DEFAULT_TIMEOUT_SEC;
|
2012-08-20 17:02:25 -07:00
|
|
|
timeout.tv_usec = 0;
|
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-07 15:46:32 -07:00
|
|
|
ret = NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */
|
2012-08-20 17:02:25 -07:00
|
|
|
#endif
|
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-07 15:46:32 -07:00
|
|
|
if (ret != SSL_SUCCESS) {
|
|
|
|
printf("wolfSSL_connect resume error %d, %s\n", err,
|
|
|
|
wolfSSL_ERR_error_string(err, buffer));
|
|
|
|
wolfSSL_free(sslResume);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
|
|
|
err_sys("wolfSSL_connect resume failed");
|
|
|
|
}
|
|
|
|
|
2015-11-02 13:26:46 -08:00
|
|
|
showPeer(sslResume);
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
if (wolfSSL_session_reused(sslResume))
|
2012-10-17 13:13:58 -07:00
|
|
|
printf("reused session id\n");
|
|
|
|
else
|
|
|
|
printf("didn't reuse session id!!!\n");
|
2013-03-07 17:44:40 -08:00
|
|
|
|
2015-10-13 15:00:53 -07:00
|
|
|
#ifdef HAVE_ALPN
|
|
|
|
if (alpnList != NULL) {
|
|
|
|
char *protocol_name = NULL;
|
|
|
|
word16 protocol_nameSz = 0;
|
|
|
|
|
|
|
|
printf("Sending ALPN accepted list : %s\n", alpnList);
|
|
|
|
err = wolfSSL_ALPN_GetProtocol(sslResume, &protocol_name,
|
|
|
|
&protocol_nameSz);
|
|
|
|
if (err == SSL_SUCCESS)
|
|
|
|
printf("Received ALPN protocol : %s (%d)\n",
|
|
|
|
protocol_name, protocol_nameSz);
|
|
|
|
else if (err == SSL_ALPN_NOT_FOUND)
|
|
|
|
printf("Not received ALPN response (no match with server)\n");
|
|
|
|
else
|
|
|
|
printf("Getting ALPN protocol name failed\n");
|
|
|
|
}
|
|
|
|
#endif
|
2016-05-10 13:27:45 -06:00
|
|
|
|
|
|
|
/* allow some time for exporting the session */
|
|
|
|
#ifdef WOLFSSL_SESSION_EXPORT_DEBUG
|
|
|
|
#ifdef USE_WINDOWS_API
|
|
|
|
Sleep(500);
|
|
|
|
#elif defined(WOLFSSL_TIRTOS)
|
|
|
|
Task_sleep(1);
|
|
|
|
#else
|
|
|
|
sleep(1);
|
|
|
|
#endif
|
|
|
|
#endif /* WOLFSSL_SESSION_EXPORT_DEBUG */
|
|
|
|
|
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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_write(sslResume, resumeMsg, resumeSz);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(sslResume, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(sslResume, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret != resumeSz) {
|
|
|
|
printf("SSL_write resume error %d, %s\n", err,
|
|
|
|
wolfSSL_ERR_error_string(err, buffer));
|
2017-01-10 09:26:47 +10:00
|
|
|
wolfSSL_free(sslResume);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
2012-10-17 13:13:58 -07:00
|
|
|
err_sys("SSL_write failed");
|
2017-01-10 09:26:47 +10:00
|
|
|
}
|
2012-10-17 13:13:58 -07:00
|
|
|
|
|
|
|
if (nonBlocking) {
|
2012-10-23 16:32:47 -07:00
|
|
|
/* give server a chance to bounce a message back to client */
|
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-07 15:46:32 -07:00
|
|
|
#ifdef USE_WINDOWS_API
|
|
|
|
Sleep(500);
|
|
|
|
#elif defined(WOLFSSL_TIRTOS)
|
|
|
|
Task_sleep(1);
|
|
|
|
#else
|
|
|
|
sleep(1);
|
|
|
|
#endif
|
2012-10-17 13:13:58 -07:00
|
|
|
}
|
2012-08-20 17:02:25 -07: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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_read(sslResume, reply, sizeof(reply)-1);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(sslResume, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(sslResume, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret > 0) {
|
|
|
|
reply[ret] = 0;
|
2017-03-06 09:49:05 -08:00
|
|
|
printf("Server resume response: %s\n", reply);
|
2015-11-02 13:26:46 -08:00
|
|
|
|
2017-03-06 09:49:05 -08:00
|
|
|
if (sendGET) { /* get html */
|
|
|
|
while (1) {
|
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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_read(sslResume, reply, sizeof(reply)-1);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(sslResume, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(sslResume,
|
|
|
|
WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
|
|
|
if (ret > 0) {
|
|
|
|
reply[ret] = 0;
|
2017-03-06 09:49:05 -08:00
|
|
|
printf("%s\n", reply);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
2015-11-02 13:26:46 -08:00
|
|
|
}
|
|
|
|
}
|
2012-10-17 13:13:58 -07: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-07 15:46:32 -07:00
|
|
|
if (ret < 0) {
|
|
|
|
if (err != SSL_ERROR_WANT_READ) {
|
|
|
|
printf("SSL_read resume error %d, %s\n", err,
|
|
|
|
wolfSSL_ERR_error_string(err, buffer));
|
2017-03-06 09:49:05 -08:00
|
|
|
wolfSSL_free(sslResume);
|
|
|
|
wolfSSL_CTX_free(ctx);
|
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-07 15:46:32 -07:00
|
|
|
err_sys("SSL_read failed");
|
2017-03-06 09:49:05 -08:00
|
|
|
}
|
2016-11-03 14:45:24 -07:00
|
|
|
}
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2012-10-17 13:13:58 -07:00
|
|
|
/* try to send session break */
|
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-07 15:46:32 -07:00
|
|
|
do {
|
|
|
|
err = 0; /* reset error */
|
|
|
|
ret = wolfSSL_write(sslResume, msg, msgSz);
|
|
|
|
if (ret <= 0) {
|
|
|
|
err = wolfSSL_get_error(sslResume, 0);
|
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
if (err == WC_PENDING_E) {
|
|
|
|
ret = wolfSSL_AsyncPoll(sslResume, WOLF_POLL_FLAG_CHECK_HW);
|
|
|
|
if (ret < 0) break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
} while (err == WC_PENDING_E);
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2015-02-16 14:23:33 -08:00
|
|
|
ret = wolfSSL_shutdown(sslResume);
|
2015-02-18 08:00:25 -07:00
|
|
|
if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE)
|
2015-02-16 14:23:33 -08:00
|
|
|
wolfSSL_shutdown(sslResume); /* bidirectional shutdown */
|
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_free(sslResume);
|
2013-02-14 14:09:41 -08:00
|
|
|
CloseSocket(sockfd);
|
2012-10-17 13:13:58 -07:00
|
|
|
}
|
2013-03-11 16:07:46 -07:00
|
|
|
#endif /* NO_SESSION_CACHE */
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_CTX_free(ctx);
|
2011-02-05 11:14:47 -08:00
|
|
|
|
|
|
|
((func_args*)args)->return_code = 0;
|
2013-03-15 13:17:05 -07:00
|
|
|
|
2016-08-15 13:59:41 -06:00
|
|
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
|
|
|
wolfAsync_DevClose(&devId);
|
|
|
|
#endif
|
|
|
|
|
2016-04-11 13:39:44 -06:00
|
|
|
/* There are use cases when these assignments are not read. To avoid
|
|
|
|
* potential confusion those warnings have been handled here.
|
|
|
|
*/
|
|
|
|
(void) overrideDateErrors;
|
|
|
|
(void) useClientCert;
|
|
|
|
(void) verifyCert;
|
|
|
|
(void) ourCert;
|
|
|
|
(void) ourKey;
|
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#if !defined(WOLFSSL_TIRTOS)
|
2013-03-28 11:28:38 -07:00
|
|
|
return 0;
|
2014-05-08 15:52:20 -07:00
|
|
|
#endif
|
2011-02-05 11:14:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* so overall tests can pull in test function */
|
|
|
|
#ifndef NO_MAIN_DRIVER
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
func_args args;
|
|
|
|
|
2013-02-01 12:21:38 -08:00
|
|
|
|
2011-02-05 11:14:47 -08:00
|
|
|
StartTCP();
|
|
|
|
|
|
|
|
args.argc = argc;
|
|
|
|
args.argv = argv;
|
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_MDK_SHELL) && !defined(STACK_TRAP)
|
|
|
|
wolfSSL_Debugging_ON();
|
2011-02-05 11:14:47 -08:00
|
|
|
#endif
|
2016-03-23 10:21:26 -06:00
|
|
|
wolfSSL_Init();
|
2015-10-28 23:54:08 -07:00
|
|
|
ChangeToWolfRoot();
|
2015-10-14 19:13:45 -07:00
|
|
|
|
2013-03-28 11:28:38 -07:00
|
|
|
#ifdef HAVE_STACK_SIZE
|
|
|
|
StackSizeCheck(&args, client_test);
|
2015-10-14 19:13:45 -07:00
|
|
|
#else
|
2011-02-05 11:14:47 -08:00
|
|
|
client_test(&args);
|
2013-03-28 11:28:38 -07:00
|
|
|
#endif
|
2015-01-05 14:48:43 -07:00
|
|
|
wolfSSL_Cleanup();
|
2011-02-05 11:14:47 -08:00
|
|
|
|
2016-05-05 15:31:25 -06:00
|
|
|
#ifdef HAVE_WNR
|
|
|
|
if (wc_FreeNetRandom() < 0)
|
|
|
|
err_sys("Failed to free netRandom context");
|
|
|
|
#endif /* HAVE_WNR */
|
|
|
|
|
2011-02-05 11:14:47 -08:00
|
|
|
return args.return_code;
|
|
|
|
}
|
|
|
|
|
2012-08-01 17:33:49 -07:00
|
|
|
int myoptind = 0;
|
|
|
|
char* myoptarg = NULL;
|
|
|
|
|
2011-02-05 11:14:47 -08:00
|
|
|
#endif /* NO_MAIN_DRIVER */
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
#ifdef WOLFSSL_CALLBACKS
|
2011-02-05 11:14:47 -08:00
|
|
|
|
|
|
|
int handShakeCB(HandShakeInfo* info)
|
|
|
|
{
|
2013-04-08 15:34:54 -07:00
|
|
|
(void)info;
|
2011-02-05 11:14:47 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int timeoutCB(TimeoutInfo* info)
|
|
|
|
{
|
2013-04-08 15:34:54 -07:00
|
|
|
(void)info;
|
2011-02-05 11:14:47 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2014-10-20 09:25:14 -07:00
|
|
|
|
|
|
|
#ifdef HAVE_SESSION_TICKET
|
|
|
|
|
2015-01-05 14:48:43 -07:00
|
|
|
int sessionTicketCB(WOLFSSL* ssl,
|
2014-10-20 09:25:14 -07:00
|
|
|
const unsigned char* ticket, int ticketSz,
|
|
|
|
void* ctx)
|
|
|
|
{
|
|
|
|
(void)ssl;
|
|
|
|
(void)ticket;
|
|
|
|
printf("Session Ticket CB: ticketSz = %d, ctx = %s\n",
|
|
|
|
ticketSz, (char*)ctx);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|