1227 Commits

Author SHA1 Message Date
Jacob Barthelmeh
ebde18af59 silence static analysis tool warning about null parameter after sanity check 2017-04-13 15:32:31 -06:00
Jacob Barthelmeh
620d21c850 fix scrypt test with no password 2017-04-13 15:06:26 -06:00
David Garske
3df47d57ab Fix error with armv8-aes wc_AesInit function using h instead of heap variable. (moved from PR #852). 2017-04-13 14:50:55 -06:00
David Garske
4c6a70861b Fix build errors with --enable-scrypt. 2017-04-13 09:37:48 -07:00
Daniele Lacamera
723ee69114 Fixed missing braces in wolfcrypt test 2017-04-13 15:31:50 +02:00
Daniele Lacamera
ef231a039d Updated to latest masterbranch 2017-04-13 15:28:19 +02:00
Nickolas Lapp
460197a5e0 Add aes192 and aes256 tests
Fix bug with AES decrypt for non-128 bit sizes on STM32F4 hardware
crypto
2017-04-12 20:09:47 -06:00
JacobBarthelmeh
3ac35ce3b3 Merge pull request #838 from SparkiDev/curve25519_51-bit
Curve25519 51-bit Implementation
2017-04-12 16:06:37 -06:00
Jacob Barthelmeh
26c8958d1e testsuite time check on Windows system and fix dh_test if statement 2017-04-12 15:56:45 -06:00
toddouska
e1a53a6c36 Merge pull request #845 from SparkiDev/cert_file
Rename caCertFile
2017-04-12 13:55:56 -07:00
David Garske
11133e578d Fixes and cleanups based on feedback from Sean. Added ifdef checks around WC_PENDING_E code to reduce code size for non-async builds. Cleanup accumulative result code checking in SSL_hmac. Cleanup of the RSA async state advancement. 2017-04-12 10:07:38 -07:00
Daniele Lacamera
3e9a5fd433 Updated to latest masterbranch 2017-04-12 12:48:38 +02:00
David Garske
d0f31d4a30 Fix issue with wc_ecc_make_key where state failure can occur if the wc_ecc_init hasn’t been called on key prior. Now wc_ecc_make_key and wc_ecc_import_private_key (and _ex versions) can be called without having to call wc_ecc_init first. This keeps backwards compatibility. If async or static memory is desired then wc_ecc_init_ex must be called first. 2017-04-11 15:57:09 -07:00
David Garske
85bef98331 Fix wc_ecc_alloc_rs memset logic. Fix error handling in hmac.c for SHA224. Cleanup of the wc_DhGenerateKeyPair_Async function. Added comment about the “BuildTlsFinished” allocation for hash buffer. Fixed issue with example server that caused the benchmark script to fail in throughput mode. 2017-04-11 14:13:08 -07:00
Daniele Lacamera
8f300515bd Grouped HAPROXY compatibility into WOLFSSL_HAPROXY flag
now haproxy compatible wolfssl builds with:

./configure --prefix=/usr --sysconfdir=/etc --disable-fastmath \
iam * ] 2:18 PM
    --disable-fasthugemath --disable-bump \
    --enable-opensslextra \
    --enable-keygen --enable-certgen \
    --disable-ntru --disable-examples \
    --enable-tlsx --enable-haproxy \
    --enable-savecert --enable-savesession --enable-sessioncerts \
    --enable-webserver --enable-sslv3 --enable-stunnel
2017-04-11 14:18:41 +02:00
David Garske
eb1a191fd2 Refactor to add the wc_HmacInit and wc_HmacFree calls. 2017-04-10 14:47:08 -07:00
David Garske
e419a6f899 Fixes and cleanups based on feedback from Sean. 2017-04-10 14:47:07 -07:00
David Garske
c1640e8a3d 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-10 14:45:05 -07:00
Sean Parkinson
5edcf685ca Rename caCertFile 2017-04-10 10:38:16 +10:00
Sean Parkinson
cbe46f8d74 Include new file in dist 2017-04-10 08:30:44 +10:00
toddouska
2b443a79f2 Merge pull request #836 from dgarske/stack_check_free
Fix leak in StackSizeCheck and build error with debug enabled
2017-04-07 09:35:01 -07:00
David Garske
2c13ea9a67 Cleanup name conflicts with test.h cert files (by adding “File” to end). Fix memory leak in ecc_test_buffers function. 2017-04-06 15:54:59 -07:00
dgarske
9ef26679df Merge pull request #833 from SparkiDev/asn_func
ASN Code Rework
2017-04-06 12:47:40 -07:00
toddouska
c8400e9ff1 Merge pull request #824 from dgarske/fix_asn_confirm_sig
Fix for return code checking on ConfirmSignature
2017-04-05 16:58:47 -07:00
Sean Parkinson
b11bb5325a Implementation of 51-bit curve25519 2017-04-06 09:48:01 +10:00
David Garske
d648d4f6c7 Fix leak in StackSizeCheck. Fix build error with debug enabled and stack size check. 2017-04-05 14:24:55 -07:00
dgarske
338c70a1ab Merge pull request #834 from cconlon/ecc_name_from_params
add wc_ecc_get_curve_id_from_params()
2017-04-05 14:09:41 -07:00
Chris Conlon
e101dfa26e add wc_ecc_get_curve_id_from_params() 2017-04-04 14:49:46 -06:00
David Garske
26f3924c93 Fix for return code checking on ConfirmSignature, so it returns actual error codes or 0 on success. 2017-04-04 10:55:22 -07:00
dgarske
e740756706 Merge pull request #832 from toddouska/rdrand64
allow rdrand to use full 64bit output
2017-04-04 08:58:06 -07:00
Sean Parkinson
36e81b650e Fix missing symbol for specific configs 2017-04-04 14:33:14 +10:00
Sean Parkinson
683a655908 Starting 128-bit FE implementation 2017-04-04 14:17:54 +10:00
Sean Parkinson
b02a75510e Fix Windows warnings 2017-04-04 11:19:06 +10:00
Sean Parkinson
abaf820537 Improvements and comments 2017-04-04 10:42:04 +10:00
toddouska
2d323dee42 Merge pull request #829 from cconlon/ecc_import
fix curve selection on ecc private only import
2017-04-03 15:44:42 -07:00
toddouska
59dc839341 Merge pull request #819 from dgarske/test_static_fixes
Fixes for wolfCrypt test/benchmark with static memory
2017-04-03 15:25:45 -07:00
toddouska
1d48fba032 allow rdrand to use full 64bit output 2017-04-03 15:08:35 -07:00
Chris Conlon
8cde26a6c5 fix curve selection on ecc private only import 2017-04-03 09:50:46 -06:00
Sean Parkinson
fd9e41dd99 ASN functions added to simplify code
Functions to get and set different ASN.1 tags have been added.
The functions are used in the asn.c file to simplify the code and ensure
all checks are done.
2017-04-03 16:56:21 +10:00
David Garske
d69c860ab8 Fix bad #elif logic cleanup for using “USE_TEST_GENSEED”. 2017-03-31 13:16:21 -07:00
David Garske
c532819659 Fixes for building with “CUSTOM_RAND_GENERATE_BLOCK”. Removed seed as backup RNG source. Fixed building on embedded system with time_t not defined (test.c should use long for asn_test). 2017-03-31 13:16:21 -07:00
David Garske
69535198ca Fix RNG to only allow disabling HASHDRBG if CUSTOM_RAND_GENERATE_BLOCK is defined. Added support for CUSTOM_RAND_GENERATE_BLOCK with Intel RDRAND. 2017-03-31 13:16:21 -07:00
David Garske
1251607b04 Retain existing HAVE_HASHDRBG functionality and only disable if ./configure --disable-hashdrbg or WC_NO_HASHDRBG defined. Fix use of warning with VS. Fix to only use rng seed as source if no DRBG. 2017-03-31 13:16:21 -07:00
David Garske
5e3d8e705e Fix RNG issue with Intel RDRAND and RDSEED accelerations not being used because HAVE_HASHDRBG was always being defined if !WOLFSSL_FORCE_RC4_DRBG. Added new --enable-intelrand option to indicate use of RDRAND preference for RNG source (if RDRAND not supported by CPU then HASHDRBG will be used). The --enable-intelasm option enables the RDSEED support for seeding HASHDRBG if CPU supports it. Allow use of seed as RNG source if --disable-hashdbrg (shows build warning). Cleanup to remove old ARC4 RNG support. Fixed random_test return code with !HAVE_HASHDRBG. Cleanup of ./configure --help alignment. 2017-03-31 13:16:21 -07:00
David Garske
34a4f1fae0 Move wolfCrypt test/benchmark to move static memory pool to global (not in stack). Fix wolfCrypt test wc_InitRng to use _ex with HEAP_HINT (when not FIPS). Added ability to use HAVE_STACK_SIZE with wolfCrypt test and benchmark. Cleanup of the benchmark_test function main wrapper. 2017-03-31 13:11:23 -07:00
toddouska
ccad9f5575 Merge pull request #818 from dgarske/tkernel_port
TKernel port
2017-03-31 10:10:26 -07:00
dgarske
9455c3b469 Merge pull request #826 from cconlon/ecc_adds
add XSTRLEN cast in ecc helper
2017-03-31 10:08:05 -07:00
toddouska
6a4b71de05 Merge pull request #822 from JacobBarthelmeh/Testing
testing buffer size with const DH and remove redeclaration of WOLFSSL…
2017-03-31 08:53:49 -07:00
Chris Conlon
e1f6dbe74e add XSTRLEN cast in ecc helper 2017-03-31 09:17:42 -06:00
dgarske
cc4cc41ccf Merge pull request #825 from cconlon/ecc_der
add EccPrivateKeyToDer()
2017-03-30 20:07:26 -07:00