Commit Graph

1061 Commits (9ebdc8d61c136e732b8a2f7131a4df9f40e586c3)

Author SHA1 Message Date
Daniel Pouzzner f06361ddf6 add WOLFSSL_SMALL_STACK_STATIC macro, and use it to conditionally declare const byte vectors in test.c static for stack depth control -- currently only enabled for linuxkm, but should be compatible with any target with a TLB (virtual memory). 2020-12-22 17:12:57 -06:00
Tesfa Mael 56071ac21f Fix for Cryptocell tests 2020-12-22 16:23:16 -06:00
toddouska ea3c385021
Merge pull request #3579 from SparkiDev/sp_math_all_4096
SP math all: enable 4096-bit support by default for x64
2020-12-18 14:14:36 -08:00
Sean Parkinson 7f5a85ae85 Reduce stack usage 2020-12-18 13:15:50 +10:00
David Garske ce0a2f3bc9 Fixes for Cavium Nitrox and Intel QuickAssist. 2020-12-17 15:53:28 -08:00
Chris Conlon 420a040774 fix WOLFSSL_ASYNC_CRYPT usage in test.c, test_wolfSSL_OBJ_ln() in api.c 2020-12-17 11:08:36 -07:00
toddouska b0464c93e2
Merge pull request #3542 from SparkiDev/sp_mod_odd
SP: ensure modulus/prime is odd before performing RSA/DH/ModExp ops
2020-12-16 08:51:10 -08:00
Sean Parkinson 6dc06993bf SP: ensure modulus/prime is odd before performing RSA/DH/ModExp ops 2020-12-16 21:49:09 +10:00
Sean Parkinson 972d6cfefc Base64: Cache attack resistant decode 2020-12-15 17:22:02 +10:00
toddouska bd871280d7
Merge pull request #3497 from elms/erf32/se_acceleration
ERF32: HW acceleration
2020-12-14 15:43:15 -08:00
Daniel Pouzzner 2804cb2521 wolfcrypt/test/test.c: more smallstack refactoring in aes_test(). 2020-12-11 14:17:25 -06:00
Daniel Pouzzner 53c6d33695 test.c:aes_test(): add WOLFSSL_SMALL_STACK codepaths for WOLFSSL_AESNI test. 2020-12-11 14:16:44 -06:00
Daniel Pouzzner 1c0df61247 wolfssl/test.h and wolfcrypt/test/test.c: add STACK_SIZE_CHECKPOINT_WITH_MAX_CHECK(), recognize macro WOLFSSL_TEST_MAX_RELATIVE_STACK_BYTES, and add to wolfcrypt_test() runtime settability of relative cumulative stack depth assert threshold using "-s stacksize". 2020-12-11 14:16:44 -06:00
Daniel Pouzzner 525382fb13 test.c:pkcs7authenveloped_run_vectors(): small stack refactor, and reenable for WOLFSSL_LINUXKM. 2020-12-11 14:16:44 -06:00
Daniel Pouzzner f47cdfcaed wolfcrypt/test/test.c: fix skipped initialization warned by LLVM11 scan-build. 2020-12-10 14:16:21 -06:00
Daniel Pouzzner f49e9bf954 dsa.c, srp.c, wolfcrypt/test/test.c: smallstack refactors: wc_DsaExportKeyRaw(), wc_DsaSign(), wc_SrpSetKey(), ecc_test_cdh_vectors(), ecc_test_custom_curves(). 2020-12-10 14:16:21 -06:00
Daniel Pouzzner f7bf0a78fb test.c:ecc_test_curve_size(): use a macro, not a static const size_t, for size of exportBuf, to make MS Visual Studio happy. 2020-12-10 14:16:21 -06:00
Daniel Pouzzner e6b587772f fix pointer type clash in wolfSSL_BN_mod_word(); restore accidentally removed WOLFSSL_KEY_GEN gate in dsa_test(). 2020-12-10 14:16:21 -06:00
Daniel Pouzzner ad2cb67047 wolfcrypt/test/test.c: _SMALL_STACK refactors of dsa_test(), srp_test(), openssl_pkey1_test(), and ecc_test_curve_size(); add missing FIPS gates. 2020-12-10 14:16:20 -06:00
Elms 93fc37f87b SiLabs: add cleanup and address PR comments 2020-12-09 16:28:39 -08:00
Elms 620fe2da14 SiLabs: Fix tests and wc_ecc_import_private_key 2020-12-08 12:22:35 -08:00
Elms 44243278a5 SiLabs: renable ecc_ssh_test and disable AES non-12Byte IV 2020-12-07 15:04:00 -08:00
Juliusz Sosinowicz 0d87dfa493 EVP_Cipher should return length written. 2020-12-01 18:36:36 +01:00
Elms 099ed25da8 SiLabs: fixing compiler warnings and better error checking 2020-11-30 21:01:49 -08:00
Elms 9f7ef0b3e6 SiLabs: Add ECC hardware acceleration support 2020-11-30 21:01:49 -08:00
Elms 79c31a5f2c SiLbs: SHA and AES-{GCM,CBC} hardware acceleration using se_manager 2020-11-30 21:01:49 -08:00
Elms 165cb443e7 Micrium v5.8 support
* OS error type change from uc OS3 to v5
 * detect if network or TCP is available
 * XMEMCMP change workaround
2020-11-30 16:32:30 -08:00
Sean Parkinson 91d23d3f5a Implement all relevant mp functions in sp_int 2020-11-19 11:58:14 +10:00
toddouska de6f1c1ae2
Merge pull request #3508 from JacobBarthelmeh/DH
fix for no filesystem build with DH test case
2020-11-18 16:15:42 -08:00
toddouska 9bde34ef5b
Merge pull request #3438 from douzzer/harmonize-CCM8-cipher-names
add "CCM8" variants to cipher_names "CCM-8" ciphers, for OpenSSL compat
2020-11-18 15:52:52 -08:00
Jacob Barthelmeh 9cdbff8ee7 fix for no filesystem build with DH test case 2020-11-17 18:27:32 +07:00
David Garske 710cb7c9f5 Fixes for ECC tests with `WOLFSSL_NO_MALLOC` defined. 2020-11-16 12:17:30 -08:00
David Garske e5a0a264b3 Fix for coverity report with possible use of uninitialized value "err" in `WC_ECC_NONBLOCK` case. More fixes for building with `WOLFSSL_NO_MALLOC`. 2020-11-16 12:17:28 -08:00
David Garske 40387ab0a0 Fixes for building with `WOLFSSL_NO_MALLOC` and/or `NO_ASN_CRYPT` defined. 2020-11-16 12:17:28 -08:00
David Garske c7bb602a30
Merge pull request #3482 from douzzer/scan-build-fixes-20201110
scan-build fixes -- 1 null deref, 34 unused results
2020-11-12 07:45:45 -08:00
Daniel Pouzzner 68ebca8573 wolfcrypt/test/test.c: fix typos in aesgcm_test() malloc checks. 2020-11-11 22:47:47 -06:00
Daniel Pouzzner 5fe1586688 fix 34 deadcode.DeadStores detected by llvm11 scan-build. 2020-11-11 13:04:14 -06:00
David Garske 1d531fe13b Peer review fixes. 2020-11-10 09:47:37 -08:00
David Garske 5de80d8e41 Further refactor the minimum ECC key size. Adds `--with-eccminsz=BITS` option. Fix for FIPSv2 which includes 192-bit support. If `WOLFSSL_MIN_ECC_BITS` is defined that will be used. 2020-11-10 09:47:37 -08:00
David Garske b13848e568 Fix tests to handle ECC < 224 not enabled. 2020-11-10 09:47:37 -08:00
Daniel Pouzzner 4b1a779fcc tests: fix for fips-test -Wunused-variable on "rng" 2020-11-09 11:54:49 -06:00
toddouska b76ac0b842
Merge pull request #3442 from SparkiDev/config_fix_2
Configuration fixes
2020-11-03 14:48:49 -08:00
toddouska 3cce86d7a8
Merge pull request #3420 from dgarske/small_pk
ECC memory reductions with key and signature parsing
2020-11-03 14:42:43 -08:00
Sean Parkinson 320afab227 Configuration fixes
--enable-sp --enable-sp-asm --disable-fastmath:
    cpuid.h - check for WOLFSSL_SP_ASM as well

-enable-curve448 --enable-ed448 --disable-rsa --disable-dh
--enable-tls13 --disable-ecc --enable-certgen --enable-keygen:
    api.c - certificate loaded that was RSA but RSA disabled

--enable-sp --enable-sp-asm --enable-sp-math:
    cpuid.c - check for WOLFSSL_SP_ASM as well

--disable-shared --disable-ecc --disable-dh --enable-cryptonly
--enable-rsavfy --disable-asn --disable-rng --disable-filesystem:
    test.c - rsa_test()

'CC=clang -fsanitize=address' '-enable-distro' '--enable-stacksize':
testsuit.c - echoclient_test_wrapper needs to free ECC FP cache when
it is in a separate thread
2020-10-29 16:21:06 +10:00
toddouska 931eea30f5
Merge pull request #3397 from cconlon/rc2
RC2 ECB/CBC and PKCS#12 Integration
2020-10-28 15:06:47 -07:00
David Garske 589057245f Improvement to ECC `wc_ecc_rs_raw_to_sig` to reduce memory use (avoid the mp_int). Additional test cases. Fixes for previous function changes. 2020-10-23 11:00:46 -07:00
John Safranek a7b325f542
Merge pull request #3414 from kabuobeid/wolfrand_build_fix
Fix wolfrand build failure.
2020-10-22 22:54:05 -07:00
Kareem Abuobeid 42583b5270 Fix wolfrand build failure, caused by defining NO_ASN without NO_CERTS. 2020-10-22 14:48:37 -07:00
Daniel Pouzzner c910c94824 rename API wc_XChaCha20Poly1305_{encrypt,decrypt}_oneshot to wc_XChaCha20Poly1305_{Encrypt,Decrypt} for consistency; remove stray debugging printf in XChaCha20Poly1305_test(). 2020-10-21 14:36:46 -05:00
Daniel Pouzzner 99b76241bd wolfcrypt/test/test.c: remove debugging printf in XChaCha20Poly1305_test(). 2020-10-21 14:08:41 -05:00
Daniel Pouzzner f65947ae09 rename wc_XChaCha_init() to wc_XChacha_SetKey() for consistency, and add a counter argument to provide for future random access scenarios; refactor wc_Chacha_purge_current_block() to use a dummy wc_Chacha_Process() call for intrinsically correct counter dynamics. 2020-10-21 14:08:41 -05:00
Daniel Pouzzner 6142c22948 add wc_XChaCha_init(), wc_XChaCha20Poly1305_Init(), wc_XChaCha20Poly1305_encrypt_oneshot(), wc_XChaCha20Poly1305_decrypt_oneshot(), and wc_Poly1305_EncodeSizes64(). also, remove redundant arg check (typo) in wc_Poly1305Update(). 2020-10-21 14:08:41 -05:00
toddouska 7c38be407c
Merge pull request #3398 from dgarske/async_test
Fixes for `--enable-asynccrypt` tests
2020-10-20 15:13:51 -07:00
David Garske fbd98be7af Fixes for `--enable-asynccrypt` tests after PR #3244. 2020-10-16 15:55:17 -07:00
John Safranek 4364700c01
DH Fix
These changes fix several fuzz testing reports. (ZD 11088 and ZD 11101)
1. In GetDhPublicKey(), the DH Pubkey is owned by the SSL session. It
   doesn't need to be in the check for weOwnDh before freeing. There
   could be a chance it leaks.
2. In GeneratePublicDh() and GeneratePrivateDh(), the size of the
   destination buffer should be stored at the location pointed to by the
   size pointer. Check that before writing into the destination buffer.
3. Ensure the size of the private and public key values are in the size
   value before generating or getting the DH keys.
2020-10-16 15:35:23 -07:00
Chris Conlon d4bbe529fb switch RC2 struct name to Rc2 for consistent camel case across algorithms 2020-10-16 15:19:47 -06:00
Chris Conlon a6923ff100 initial implementation of RC2-CBC 2020-10-16 12:02:16 -06:00
Chris Conlon 4c75037bdb initial implementation of RC2-ECB 2020-10-16 12:00:56 -06:00
John Safranek aeeeb666a7
Maintenance Fixes
1. The test_wolfSSL_X509V3_EXT_print() test was using stderr for output,
   changed to stdout.
2. A call to XFREAD wasn't typecasting its output to the size of the
   variable getting the output in decodedCertCache_test().
2020-10-09 15:01:32 -07:00
Daniel Pouzzner 29d4de6307 fix pkcs7compressed_test() (test gated on HAVE_LIBZ), broken by PR#3244. 2020-10-09 12:42:14 -05:00
toddouska c69e9927fa
Merge pull request #3354 from SparkiDev/mac_arm_asm_2
ARM ASM ChaCha20: Fix calc of left over bytes
2020-10-08 14:49:33 -07:00
kaleb-himes d9eaeb4a3b Fix NTRU + QSH build 2020-10-08 09:13:00 -06:00
Sean Parkinson f76165a3fa ARM ASM ChaCha20: Fix calc of left over bytes 2020-09-30 15:57:33 +10:00
John Safranek dbf18b8532
Test ECC-521 Only
Update benchmark and wolfcrypt test to support using only ECC-521 in a custom curve list.
2020-09-28 09:22:24 -07:00
Sean Parkinson c798c7f396 DH EXTRA test: Disable DH test unless not FIPS or FIPS > 2
statickeys/dh-ffdhe2048.der is an alternate format that is supported
when WOLFSSL_DH_EXTRA is defined.
The decoding is not supported when FIPS and FIPS version is less than 3.
Fix test to not use file unless not FIPS or FIPS > 2.
2020-09-25 11:41:59 +10:00
Daniel Pouzzner 62bbef2f2e wolfcrypt/test/test.c: add missing gating for -DBENCH_EMBEDDED. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 2609fa9aeb test.c:rsa_test(): fix cpp gating for clearing of keypub buffer. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 5f972d2ae6 test.c: now that sp math is fixed and working in linuxkm, reenable prime_test() for WOLFSSL_LINUXKM, and add a small stack refactor for it. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 8f130f3642 test.c: tweaks to accommodate clang's belligerent -Wparentheses-equality. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 447a238e8e test.c: missed a _SMALL_STACK spot in rsa_ecc_certgen_test(). 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 5bfb5a3a83 test.c: fix missed spot in rsa_certgen_test(), and do another _SMALL_STACK refactor of a missed object in rsa_ecc_certgen_test(). 2020-09-23 18:32:16 -05:00
Daniel Pouzzner fdf87fe152 test.c: another missed spot. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner ebca451c93 test.c: missed a spot -- inadvertently unused return value. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 80961ea913 test.c:ecc_decode_test(): WOLFSSL_SMALL_STACK refactor 2020-09-23 18:32:16 -05:00
Daniel Pouzzner dbe0273bf4 test.c: additional WOLFSSL_SMALL_STACK refactoring, covering --enable-sp-math and various missed spots. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner cd88a2c7df wolfcrypt/test/test.c: when WOLFSSL_LINUXKM, don't do the large-malloc-incurring wc_scrypt()s in scrypt_test(). 2020-09-23 18:32:16 -05:00
Daniel Pouzzner dc4b15a265 test.c: fix gating on heap deallocation in hc128_test() to match earlier tweak to gating on allocation. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner b52d50d903 test.c: various improvements and fixes pursuant to dgarske's comments on PR #3244 2020-09-23 18:32:16 -05:00
Daniel Pouzzner a80b0c1982 test.c: don't exclude prime_test when -DOLD_PRIME_CHECK, but to exclude it when -DWOLFSSL_LINUXKM. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner e8b69f8a6a dh_test(): fix missing casts for XMALLOC(). 2020-09-23 18:32:16 -05:00
Daniel Pouzzner f440089e92 dh_test(): fix typo (undersized dynamic buffers). 2020-09-23 18:32:16 -05:00
Daniel Pouzzner f106fea0d8 rsa_no_pad_test(): fix uninited pointer. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 4ea8b46177 dh_test(): refactor remaining bare returns to ERROR_OUT(). 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 2ee218761e dh_test(): missed a spot in last commit. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner ca1a991de5 wolfcrypt/test/test.c: fix an error-path leak in dh_test(), and deal with possible -Wdeclaration-after-statement for `XFILE file`. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner a7381f8a48 test.c:rsa_test(): fix uninited pointer 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 426de2101a more work on DECLARE_VAR -- proper handling of failed allocations. WIP. 2020-09-23 18:32:16 -05:00
Daniel Pouzzner 9b7c753165 wolfssl/wolfcrypt/types.h: make DECLARE_VAR() et al use heap allocation not only when WOLFSSL_ASYNC_CRYPT but also when WOLFSSL_SMALL_STACK. 2020-09-23 18:32:15 -05:00
Daniel Pouzzner 571bf897c4 wolfcrypt/test/test.c: stack->heap refactor for dh_test(). 2020-09-23 18:32:15 -05:00
David Garske 66b59bda9b Fix for expected fail test in `openssl_test` for partial block. Fix for `mp_test` with ECC disabled, which uses `mp_init_copy`. 2020-09-23 18:32:15 -05:00
David Garske 0f8cf32122 Fix for possible leak in `openssl_test` because EVP free not called with `WOLFSSL_SMALL_STACK_CACHE` (SHA256/SHA512). Added return code checking to the openssl_test in wolfCrypt test. 2020-09-23 18:32:15 -05:00
Daniel Pouzzner 32e30d23c6 wolfcrypt/test/test.c: fix uninitialized values in aesofb_test(). 2020-09-23 18:32:15 -05:00
Daniel Pouzzner f56c6d1d8f wolfcrypt/test/test.c and wolfssl/test.h: implement DEBUG_STACK_SIZE_VERBOSE, measuring and reporting stack usage separately for each test. to use, ./configure --enable-stacksize && make CFLAGS+=-DDEBUG_STACK_SIZE_VERBOSE; also, remove a throwaway dev pragma that snuck into an earlier commit. 2020-09-23 18:32:15 -05:00
Daniel Pouzzner 925afe3b74 cast XMALLOC() return values assiduously, for Visual Studio compatibility. 2020-09-23 18:32:15 -05:00
Daniel Pouzzner 535822f4df wolfcrypt/test/test.c: refactor for stack size and namespace control, allowing embedding of wolfcrypt_test() in kernel module. 2020-09-23 18:32:15 -05:00
toddouska 8753b5b947
Merge pull request #3257 from kojo1/user-mutex
fix guard, user define mutex
2020-09-03 15:21:53 -07:00
toddouska a626ac39f2
Merge pull request #3253 from SparkiDev/chacha20_stream_fix
ChaCha20: Enable streaming with Intel x86_64 asm
2020-09-03 15:18:00 -07:00
Sean Parkinson 54c8774103 ChaCha20: Enable streaming with Intel x86_64 asm 2020-08-31 09:06:51 +10:00
David Garske 21d17b17d0 Fix typo in code comment for ECC curve cache. Fix for valgrind report of possible use of uninitialized value with ChaCha/Poly AEAD test. 2020-08-27 12:01:24 -07:00
David Garske 6d5731b8e9 Fixes for HMAC_CTX cleanup not being called to free SHA2 resources with `WOLFSSL_SMALL_STACK_CACHE`. Added return code checking and cleanup for `openssl_test`. 2020-08-26 09:45:26 -07:00