Commit Graph

1895 Commits (devin/1739920896-esp32-fixes)

Author SHA1 Message Date
Eric Blankenhorn 91e411b4b9 Set RSA_MIN_SIZE default to 2048 bits 2024-09-13 16:02:05 -05:00
David Garske 20e2e33e25
Merge pull request #7939 from SparkiDev/thumb2_poly1305
undefined
2024-09-12 11:15:53 -07:00
Siert Wieringa 9e2a7b3653
Feature/multiple aes siv ads (#7911)
* Proposed new interface for AesSivEncrypt with number of ADs != 1.

* Implement AES SIV S2V computation with a number of ADs not equal to 1.

* Add Example A.1 from RFC5297 to AES SIV test vectors.

* Add tests for new AES SIV interface, and add test vectors for examples given in RFC5297.

* Include the nonce in count of maximum number of ADs.

* Addressing review comments.

* Addressing review comments: Use uppercase 'U' suffix on unsigned constant.

* Rename local variables named 'ad0' to 'ad', since the zero makes no sense, especially since in the RFC 5297 document they're actually counting the ADs from 1.
2024-09-12 07:55:29 -07:00
Sean Parkinson 27033c225f Thumb-2 ChaCha, Poly1305: implemention in assembly
Implementation of ChaCha algorithm for ARM Thumb-2.
Implementation of Poly1305 algorithm for ARM Thumb-2.
2024-09-12 10:59:01 +10:00
night1rider e912aff7e5 DES ECB using mmcau HW Library, and DES ECB basic test 2024-09-09 15:32:21 -06:00
Daniel Pouzzner 49a680540c add constant time DH key agreement APIs:
* adds wc_DhAgree_ct().
* adds wolfSSL_DH_compute_key_padded(), using wc_DhAgree_ct() if available, with fallback fixup code.
* adds unit test coverage in api.c:test_wolfSSL_DH() for expected-success calls to wolfSSL_DH_compute_key() and wolfSSL_DH_compute_key_padded().
2024-09-09 16:24:07 -05:00
David Garske 80a63a3fce
Merge pull request #7924 from anhu/pqm4_purge
Get rid of pqm4 in favour our own Kyber/MLDSA implementation
2024-09-06 12:00:26 -07:00
Daniel Pouzzner a3fb5029f8 clean up trailing whitespace and misplaced CRLFs, add missing final newlines, remove stray UTF8 nonprintables (BOMs) and ASCIIfy stray homoglyphs (spaces and apostrophes), guided by expanded coverage in wolfssl-multi-test check-source-text. 2024-09-05 14:52:18 -05:00
Daniel Pouzzner a31733db85
Merge pull request #7909 from SparkiDev/dilithium_fips204_draft
Dilithium: Support FIPS 204 Draft
2024-09-04 14:34:59 -05:00
David Garske 7c7de235d8
Merge pull request #7937 from douzzer/20240903-missing-WC_NO_ERR_TRACEs
20240903-missing-WC_NO_ERR_TRACEs
2024-09-04 08:07:19 -07:00
Daniel Pouzzner b26fa6cf59
Merge pull request #7918 from SparkiDev/type_conversion_fixes_3
Type conversion fixes
2024-09-03 20:18:00 -05:00
Daniel Pouzzner 806df85477 backfill more missing WC_NO_ERR_TRACE()s on error code operands, and refactor away the obsolete GEN_MEM_ERR macro mechanism in wolfcrypt/src/ecc.c. 2024-09-03 17:44:11 -05:00
Sean Parkinson ed7beb4e0e Type conversion fixes
Changes to get compilation with -Wconversion passing on the files.
2024-09-02 19:19:23 +10:00
Juliusz Sosinowicz 2c9a3c5c1c Missing libspdm features
- RsaFunctionPrivate: detect when only n,e,d are available
- wolfSSL_EVP_add_digest: return success
- wolfSSL_EVP_add_cipher: return success
- wolfSSL_BN_bin2bn: accept NULL data if len is 0 (checked in mp_read_unsigned_bin)
- wolfssl_read_bio: advance correct bio
- wolfSSL_X509_set_ext: return raw extension data for BASIC_CA_OID
- Implement
  - sk_X509_EXTENSION_free
  - d2i_EC_PUBKEY_bio
  - d2i_RSA_PUBKEY_bio
  - d2i_X509_REQ_INFO
  - X509_REQ_INFO_free
  - ASN1_TIME_set_string_X509
2024-09-02 10:01:12 +02:00
Anthony Hu 844d0ec558 Get rid of pqm4 in favour our own Kyber/MLDSA implementation 2024-08-29 13:23:39 -04:00
Daniel Pouzzner b178138d83 src/internal.c: in wolfSSL_ERR_reason_error_string(), add missing error string for SCR_DIFFERENT_CERT_E, and de-gate error strings previously gated on HAVE_HTTP_CLIENT.
tests/api.c: add error_test() adapted from wolfcrypt/test/test.c, checking all error strings for expected presence/absence and length, called from existing test_wolfSSL_ERR_strings().

wolfssl/ssl.h, wolfssl/error-ssl.h, and wolfssl/wolfcrypt/error-crypt.h:
* move several negative error return codes from ssl.h to error-ssl.h,
* renumber them to conform to existing sequence, and
* include error-ssl.h from ssl.h;
* add special-case WOLFSSL_DEBUG_TRACE_ERROR_CODES macros for WOLFSSL_FAILURE;
* add missing WOLFSSL_API attribute to wc_backtrace_render().

add numerous WC_NO_ERR_TRACE()s to operand error code uses, cleaning up error traces in general, and particularly when WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS.
* crypto lib (36),
* crypto test&benchmark (20),
* TLS lib (179),
* examples (122),
* linuxkm (3),
* tests/api.c (2272).
2024-08-28 23:05:04 -05:00
Sean Parkinson 652158fcac Dilithium: Support FIPS 204 Draft
Compile with WOLFSSL_DILITHIUM_FIPS204_DRAFT to get code that implements
the FIPS-204 August 2023 DRAFT.
Alternatively, --enable-dilithium=draft or
--enable-dilithium=fips204-draft
2024-08-28 11:02:01 +10:00
Eric Blankenhorn dcea21a9a5
Merge pull request #7897 from douzzer/20240823-WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS
20240823-WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS
2024-08-27 15:41:20 -05:00
Sean Parkinson 60f438f0c3 Dilithum, Kyber: Update to final specification
FIPS 203 and FIPS 204 final specification changes.
2024-08-26 17:42:27 +10:00
Daniel Pouzzner 7725e75c42 add WOLFSSL_DEBUG_TRACE_ERROR_CODES_ALWAYS flag for optional errcode tracing in apps, define it in wolfcrypt/test/test.c when defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES), and deploy WC_NO_ERR_TRACE() to test.c where needed. 2024-08-23 16:35:43 -05:00
Daniel Pouzzner 2448d482f4 wolfssl/wolfcrypt/error-crypt.h: move MPI error codes to range {-97, -100} to avoid collisions. 2024-08-20 23:37:21 -05:00
Daniel Pouzzner 0da78a7ee2 move several MP error codes from wolfssl/wolfcrypt/sp_int.h, wolfssl/wolfcrypt/tfm.h, and wolfssl/wolfcrypt/integer.h, to wolfssl/wolfcrypt/error-crypt.h, harmonizing their names and numbers.
wolfssl/wolfcrypt/error-crypt.h: add WC_FIRST_E.

wolfcrypt/src/error.c: add MP error code strings.

wolfssl/error-ssl.h: add WOLFSSL_FIRST_E and WOLFSSL_LAST_E.

wolfcrypt/test/test.c: update error_test() for new error code layout, refactoring the "missing" check.

src/internal.c: use WC_FIRST_E and WC_LAST_E  in wolfSSL_ERR_reason_error_string().

src/ssl.c: fix wolfSSL_ERR_GET_REASON() to identify in-range error codes using WC_FIRST_E, WC_LAST_E, WOLFSSL_FIRST_E, and WOLFSSL_LAST_E.

sp_int.h: provide for WOLFSSL_DEBUG_TRACE_ERROR_CODES, and refactor MP error codes as enums, for consistency with other error codes.

wolfcrypt/src/ecc.c: fix 2 identicalInnerCondition's.
2024-08-20 14:09:06 -05:00
Daniel Pouzzner 14254e8a6e
Merge pull request #7862 from bigbrett/wc-test-nocryptocb
cryptocb test disable option
2024-08-14 23:18:02 -05:00
Andras Fekete f8c968d8d1 Fix possible memory overrun 2024-08-13 13:43:54 -04:00
Brett Nicholas 8df5d61179 add optional cryptocb test disable macro to wolfCrypt tests 2024-08-12 15:16:33 -06:00
Andras Fekete f419e2351b Remove NULL test with 'ptr = NULL' at the end 2024-08-06 10:55:37 -04:00
Andras Fekete d6a7187538 Programmatically remove NULL test with { XFREE() } 2024-08-06 10:37:43 -04:00
Andras Fekete d7a0f49906 Programmatically remove NULL test before XFREE 2024-08-06 10:20:45 -04:00
Daniel Pouzzner 9aa0742baa
Merge pull request #7798 from dgarske/asn_macros
ASN macro simplification

merged with github CI tests failing due to unrelated upstream changes (same tests all previously succeeded on this PR, with only 25d14f1937 added in the meantime).

supplementary testing with `wolfssl-multi-test.sh ... super-quick-check` after rebase on then-current `master` 15e99c8eff.
2024-08-02 16:36:50 -05:00
Sean Parkinson ebb49b6e68 RISC-V ChaCha20: assembly implementations
ChaCha20:
  scalar and vector implementations
  vector implementations doing 6, 4, 2, 1 block at a time.
  scalar implemetations using roriw and pack
  vector implementations using VROR_VI and roriw.

RISC-V SHA-256: avoid using s0 if it can be helped.
2024-08-01 17:51:59 +10:00
David Garske 548a2c6d8e Fixed issues building with nocrypt. Improved logic on `ASN_BER_TO_DER`. Improved logic on unknown extension callback (new `WC_ASN_UNKNOWN_EXT_CB` gate). 2024-07-31 09:42:46 -07:00
David Garske f9dc5e9f4d Fixes for uses of deprecated sprintf. If C89 remap XSNPRINTF to use sprintf. 2024-07-29 14:03:44 -07:00
David Garske 7f7d94abd5 Fixes for ASN original (old) to support checking int leading 0 and invalid OID. Disable invalid UTF8 test for old ASN (only supported with newer ASN template). 2024-07-24 12:35:37 -07:00
Daniel Pouzzner 367508f498 wolfcrypt/src/asn.c: in EccSpecifiedECDomainDecode(), in calls to DataToHexString(), cast curve->size to word32 to resolve -Wconversion.
wolfcrypt/src/dh.c: in GeneratePrivateDh186(), add explicit suppression of uninitvar for "cBuf" arg that isn't fully initialized.

wolfcrypt/test/test.c: in mp_test_param(), explicitly initialize "buffer" to avoid uninitvar warning.

configure.ac: in FIPS builds, don't include enable_cryptocb in --enable-all or --enable-all-crypto.  (they can still be enabled explicitly in FIPS builds with --enable-cryptocb, but the combination is not currently supported.)
2024-07-22 18:21:36 -05:00
Daniel Pouzzner 765231060e wolfcrypt/test/test.c: add missing PRIVATE_KEY_UNLOCK() for hpke_test(). 2024-07-19 18:31:01 -05:00
JacobBarthelmeh 31a6a2bf59 update copyright to 2024 2024-07-19 13:15:05 -06:00
Sean Parkinson e6fcd488a6
Merge pull request #7685 from dgarske/renesas_rx_tsip
Renesas RX TSIP ECDSA support
2024-07-19 10:53:00 +10:00
Daniel Pouzzner c36ab59f24 fixes for defects identified by nightly testing:
* ecc.c: in wc_ecc_free(), fix gating around handling for key->sign_k to resolve memory leak, and in wc_ecc_gen_deterministic_k(), fix -Wconversion.

* test.c: add missing mp_free()s to ecdsa_test_deterministic_k_rs() and ecc521_test_deterministic_k().

* wc_HashType: change several occurrences of int to enum wc_HashType, including ecc_key.hashType and API wc_ecc_set_deterministic_ex(), to resolve C++ warnings.

* fixes for various C++ warnings/errors in crypto and TLS layers and test and benchmark code -- implicit casts, negative initializers for unsigned type, jumped initializers, and missing enums in switch()es.
2024-07-17 18:07:08 -05:00
Sean Parkinson 0f3ebedba0
Merge pull request #7700 from aidangarske/ECDSA_deterministic_k
ecc.c and test.c changes to add support in ecc_sign_determinsitic.c
2024-07-17 09:12:32 +10:00
David Garske d5016d451f
Merge pull request #7714 from JacobBarthelmeh/coverity
Coverity issues reported
2024-07-05 13:49:20 -07:00
kaleb-himes f42fb587a5 Address coverity issue 394706 2024-07-05 13:54:23 -06:00
JacobBarthelmeh c880fcf822 add check on padSz return, coverity issue 394711 2024-07-05 12:07:42 -06:00
JacobBarthelmeh 50a7243486 fix for coverity issue 394670 possible overflow 2024-07-05 11:53:19 -06:00
Sean Parkinson 1fd9f2af91 KYBER/ML-KEM: make ML-KEM available
Added ML-KEM instead of Kyber implementation with WOLFSSL_ML_KEM.
Tests added from NIST for ML-KEM operations.
2024-07-04 23:51:23 +10:00
David Garske 9ec29e9ad9 Reduced duplicate code in deterministic test. 2024-07-01 10:35:03 -07:00
David Garske ac7f44b0dc Fix the async tests for deterministic sign. The _ex versions cannot be called again. Fix possible leak with async and deterministic sign. 2024-07-01 10:13:28 -07:00
aidan garske c07e7f1e58 Fixed async test for test.c deterministic K. 2024-07-01 09:51:07 -07:00
aidan garske b5b0e17587 ecc.c and test.c changes to add support in ecc_sign_determinsitic.c for SHA256, SHA384, and SHA512 for SECP256R1, SECP384R1, SECP521R1. 2024-07-01 08:43:32 -07:00
David Garske 2fd7a2e4ae Fix for test.c `memcb_test` and missing XREALLOC. 2024-06-28 15:25:01 -07:00
David Garske 2a86ca43f8 Fixes for building the compatibility layer with `WOLFSSL_NO_REALLOC`. Tested using `./configure --enable-opensslextra CFLAGS="-DWOLFSSL_NO_REALLOC"`.
Improve benchmark FreeRTOS default tick rate logic. For example Xilinx FreeRTOS uses 10ms tick (not default 1ms), so include `configTICK_RATE_HZ` in calculation if available.
Fix test.c warning around too many parens with no realloc.
2024-06-27 16:02:28 -07:00
David Garske e81e18859b Support for Renesas RX TSIP with ECDSA and Crypto Callbacks.
Fix building ECC with NO_ASN (`./configure --enable-cryptonly --disable-rsa --disable-asn --disable-examples`).
2024-06-25 17:43:16 -07:00
Sean Parkinson a094831e1a Dilithium: C code optimized
Changes to get best out of 32-bit ARM chips.
Fixes come compile errors when cutting out functions.
WOLFSSL_DILITHIUM_SIGN_CHECK_Y and WOLFSSL_DILITHIUM_SIGN_CHECK_W0 added
to speed up signing. No longer specification conformat when either used.
2024-06-24 16:37:43 +10:00
Daniel Pouzzner b4e15d028c WOLF_CRYPTO_CB && WOLFSSL_SHA3: add FIPS gating to wc_CryptoCb_Sha3Hash() and test routine myCryptoDevCb(). 2024-06-22 11:20:53 -05:00
aidan garske 1ef9a8fe7c Added crypto callback for SHA3 and extended the test.c tests for it in cryptocb_test. 2024-06-20 14:15:28 -07:00
Daniel Pouzzner 38c7327660
Merge pull request #7622 from SparkiDev/ml-dsa
Dilithium/ML-DSA: Implementation of ML-DSA-44/65/87
2024-06-19 13:32:35 -04:00
Sean Parkinson 3e3a00dafd Dilithium/ML-DSA: Implementation of ML-DSA-44/65/87
Impemented FIPS 204 (Draft) Module-Lattice-Based Signature Standard.
Implementation include making a key, signing and verification.
Make key API added.
Updated liboqs calls to use ML-DSA implementation instead of Dilithium.
2024-06-19 21:27:01 +10:00
JacobBarthelmeh 24291b4147
Merge pull request #7600 from SparkiDev/wc_ecc_mulmod_zero_z1
ECC: when multiplying by zero, set z to 1
2024-06-18 16:36:35 -06:00
Sean Parkinson fbd69f9b48 ECC: when multiplying by zero, set z to 1
Make sure zero times a point is infinity but z is 1 as it is assumed
later on.
2024-06-18 11:30:57 +10:00
Sean Parkinson 8d77df15ef SM2: change to official test vector
Change create digest to official test vector.
2024-06-18 10:40:47 +10:00
David Garske b69482ffac
Merge pull request #7569 from SparkiDev/riscv_aes_asm
AES RISC-V 64-bit ASM: ECB/CBC/CTR/GCM/CCM
2024-06-06 08:11:31 -07:00
Sean Parkinson acd604db3d AES RISC-V 64-bit ASM: ECB/CBC/CTR/GCM/CCM
Add implementations of AES for ECB/CBC/CTR/GCM/CCM for RISC-V using
assembly.
Assembly with standard/scalar cryptography/vector cryptographt
instructions.
2024-06-06 13:16:00 +10:00
Chris Conlon 70d317ec79
Merge pull request #7571 from rlm2002/internship
Test case for wc_HpkeGenerateKeyPair() NULL argument
2024-06-05 10:57:19 -06:00
Sean Parkinson 4b77d4caa1
Merge pull request #7589 from rizlik/sp800_56c
wolfcrypt: support NIST 800-56C Option 1 KDF
2024-05-31 11:55:12 +10:00
JacobBarthelmeh ebdc8b9a32 rename of macros, add descriptions, minor fixes 2024-05-30 14:48:52 -06:00
Marco Oliverio 174456437e wolcrypt: NIST_SP_800_56C address reviewer's comments 2024-05-30 11:39:49 +02:00
JacobBarthelmeh 288fe430f5 tying in lean staticmemory build with --enable-staticmemory=small 2024-05-29 15:50:11 -06:00
Marco Oliverio 8d41e68d1f fix: minor typos 2024-05-28 22:59:01 +02:00
Marco Oliverio 5306a85465 wolfcrypt: support NIST 800-56C Option 1 KDF 2024-05-28 14:40:52 +02:00
David Garske 3b5517692e
Merge pull request #7582 from aidangarske/hpke_test_fix
Revert change from PR #7570
2024-05-24 07:35:39 -07:00
David Garske 51f19f42c6
Merge pull request #7574 from douzzer/20240522-quantum-safe-linuxkm
20240522-quantum-safe-linuxkm
2024-05-24 07:35:01 -07:00
Ruby Martin 078fb66b29 Negative tests for all NULL arguments 2024-05-23 14:16:17 -06:00
Ruby Martin b8838dca44 Tests all NULL argument cases 2024-05-23 13:36:48 -06:00
aidan garske 3670bfb9ae Revert change from PR #7570 2024-05-23 12:34:59 -07:00
Chris Conlon e05dbd531e
Merge pull request #7570 from jackctj117/test
Code Coverage for hpke.c test case HAVE_CURVE448 using test.c
2024-05-23 11:49:37 -06:00
Daniel Pouzzner 5c497c62e7 initial linuxkm compatibility (no asm yet) for wc_kyber, wc_xmss, and wc_lms, and smallstack refactors for kyber512_kat(), kyber768_kat(), kyber1024_kat(), and kyber_test(). 2024-05-23 00:15:32 -05:00
Ruby Martin f2492da6a4 include negative test comment and BAD_FUNC_ARG 2024-05-22 16:20:20 -06:00
Jack Tjaden 14068fb7f3 Removed returns & check next case for ret 2024-05-22 15:58:09 -06:00
Ruby Martin 159981f442 include negative test comment and BAD_FUNC_ARG 2024-05-22 15:23:38 -06:00
aidan garske fe5cc9589b Add HPKE Curve448 test case, however HPKE does not support 448 yet, so expect bad function argument return code. 2024-05-22 12:49:56 -07:00
Jack Tjaden 1a000ef94c single_test and BAD_FUNC_ARG fix 2024-05-22 13:13:56 -06:00
Jack Tjaden 52b6c361f9 test.c code coverage test hpke.c 2024-05-22 11:51:44 -06:00
Ruby Martin fe9882769e Test case for wc_HpkeGenerateKeyPair() NULL argument 2024-05-22 09:13:31 -06:00
Daniel Pouzzner d0e73783f1 wolfcrypt/src/aes.c and wolfssl/wolfcrypt/aes.h: add FIPS_AES_XTS_MAX_BYTES_PER_TWEAK and struct XtsAesStreamData, with improved error checking on streaming AES-XTS APIs;
wolfcrypt/test/test.c and linuxkm/lkcapi_glue.c: update AES-XTS streaming calls to use struct XtsAesStreamData;

linuxkm/lkcapi_glue.c: add handling for CONFIG_CRYPTO_MANAGER*.
2024-05-18 22:00:00 -05:00
Daniel Pouzzner 6d0f611ab5 AES-XTS: add wc_AesXtsEncryptFinal() and wc_AesXtsDecryptFinal() for API consistency, and add error-checking (block alignment check) to wc_AesXtsEncryptUpdate() and wc_AesXtsDecryptUpdate(). 2024-05-16 15:20:37 -05:00
kaleb-himes fa08e2cb62 Fix a long line in pbkdf2 test 2024-05-15 14:02:44 -04:00
kaleb-himes 49e9c06679 (Has dependency PR) API Service update HmacSizeByType 2024-05-15 14:02:43 -04:00
David Garske ac7aea9674
Merge pull request #7478 from JacobBarthelmeh/staticmemory
add global heap hint setter function
2024-05-15 10:43:15 -07:00
David Garske 9c4c9234b1
Merge pull request #7532 from SparkiDev/wc_ecc_mulmod_zero
ECC: handle zero in wc_ecc_mulmod()
2024-05-15 09:02:02 -07:00
Daniel Pouzzner 1469aab109 linuxkm/lkcapi_glue.c: add native test coverage for WOLFSSL_AESXTS_STREAM.
wolfcrypt/test/test.c:
* add WOLFSSL_AESXTS_STREAM testing to the LARGE_XTS_SZ exercise in aes_xts_128_test().
* add the LARGE_XTS_SZ exercise to aes_xts_256_test().
* add aes_xts_192_test().
* fix -Werror=frame-larger-than=2048 in ed25519_test().
2024-05-15 00:45:51 -05:00
Daniel Pouzzner 2fe366cc74 wolfcrypt/test/test.c: add test coverage for WOLFSSL_AESXTS_STREAM.
linuxkm/lkcapi_glue.c: typographic cleanups, and failsafe error return constructs when skcipher_walk_virt() returns zero walk.nbytes.

wolfcrypt/src/aes.c: additional comments and inline documentation.

.github/workflows/openvpn.yml: disable test on master branch.
2024-05-14 19:11:39 -05:00
Sean Parkinson b63f308812 fixup 2024-05-15 09:07:04 +10:00
Sean Parkinson 36754683d6 ECC: handle zero in wc_ecc_mulmod()
Public API needs to handle multiplying by zero as the underlying code
doesn't and needn't.
2024-05-15 09:05:31 +10:00
David Garske 28bd4ebeea
Merge pull request #7520 from bandi13/fixConversion
Fix conversion
2024-05-14 11:26:37 -07:00
David Garske 7526f527d1
Merge pull request #7526 from lealem47/addCast
Fix for type conversion error
2024-05-14 10:30:08 -07:00
Andras Fekete a59a3d109f Explicit cast 2024-05-14 11:03:20 -04:00
Sean Parkinson e1274013d8 AES: NO_AES_DECRYPT defined
Allow code to compile with NO_AES_DECRYPT with AES modes enabled and
disabled.
2024-05-14 16:27:36 +10:00
Daniel Pouzzner 009ea6640b
Merge pull request #7493 from SparkiDev/sm3_benchmark_fix
Benchmark, SM3: fix full hash testing
2024-05-13 19:22:22 -04:00
Lealem Amedie f4275d53c4 Fix for type conversion error 2024-05-13 16:32:12 -06:00
David Garske a9164293c2
Merge pull request #7513 from julek-wolfssl/gh/7510
ed25519: check that the signature is smaller than the order
2024-05-13 09:16:17 -07:00
Daniel Pouzzner 1faa70c128 wolfcrypt/test/test.c:
* fix unconditional memory leak in pkcs12_test().
* refactor pkcs12_test() to fix error-conditional memory leaks.
* fix various old-style return codes in sm4_ccm_test(), pkcs12_test(), prf_test(), tls12_kdf_test(), xmss_test(), xmss_test_verify_only(), lms_test(), and lms_test_verify_only().
2024-05-12 14:13:06 -05:00
JacobBarthelmeh d68f3cf63c add macro guard around test case 2024-05-10 11:08:45 -06:00
JacobBarthelmeh 98a19f9fdd add debug log and adjust set global heap hint function 2024-05-10 11:08:43 -06:00
JacobBarthelmeh de3d1a488d add global heap hint setter function 2024-05-10 11:08:01 -06:00
Sean Parkinson add7428d1c TLS, SM2: fixes to get SM handshakes working
Pass around the algorithm id from the private key so that the WOLFSSL or
WOLFSSL_CTX get the correct key format set.
Use different verification context when self-signed certificate with SM2
and SM3 signature but public key OID is ECC.
2024-05-10 10:15:47 +10:00
Daniel Pouzzner f7e1e370a0
Merge pull request #7438 from julek-wolfssl/zephr-no-malloc
zephyr no malloc
2024-05-09 02:57:20 -04:00
Daniel Pouzzner 5a784c818d
Merge pull request #7319 from SparkiDev/chacha_poly1305_asm_msvc
ChaCha20, Poly1305 ASM for MSVC
2024-05-08 19:03:56 -04:00
Juliusz Sosinowicz 2508c9e1f4 ed25519: check that the signature is smaller than the order 2024-05-08 17:54:37 +02:00
Juliusz Sosinowicz 14ce8ce198 Jenkins fixes 2024-05-07 11:46:36 +02:00
Juliusz Sosinowicz 8d8f4d4e1e fixup! zephyr no malloc 2024-05-07 10:38:01 +02:00
Juliusz Sosinowicz 7ed5e0b3ba zephyr no malloc
- cert gen
- csr gen
- pkcs12
- Compiles for Zephyr 3.4.0 and 2.7.4
- Add support for CONFIG_POSIX_API
2024-05-07 10:38:01 +02:00
John Safranek 195bbcc315 Generic Memory Pools Fix
1. Add some expository comments describing the purpose of:
   * WOLFMEM_MAX_BUCKETS
   * WOLFMEM_DEF_BUCKETS
   * WOLFMEM_BUCKETS
   * WOLFMEM_DIST
2. Switch the API test for LoadStaticMemory() to named constants.
3. Delete redundant test case. Add a new test case.
4. In the wolfCrypt test for the memory constants, check the sizes of
   the WOLFMEM_BUCKETS and WOLFMEM_DIST lists against
   WOLFMEM_DEF_BUCKETS which should be their length. Check that
   WOLFMEM_DEF_BUCKETS is not greater than WOLFMEM_MAX_BUCKETS.
5. Default for WOLFMEM_MAX_BUCKETS should be WOLFMEM_DEF_BUCKETS, set it
   to what is specified. Add a warning if MAX is less than DEF.
6. Separate the definition of the constant LARGEST_MEM_BUCKET so it is
   dependent on config and not if WOLFMEM_BUCKETS isn't set.
2024-05-03 16:15:38 -07:00
Daniel Pouzzner fa30d3ae0b wolfcrypt/benchmark/benchmark.c: fixes for clang-analyzer-deadcode.DeadStores in bench_xmss_sign_verify();
wolfcrypt/test/test.c: fix for invalidPrintfArgType_sint in xmss_test_verify_only().
2024-04-30 22:48:48 -05:00
Sean Parkinson aab97fe9e2 ChaCha20, Poly1305 ASM for MSVC
Make ChaCha20 and Poly1305 asm available for MSVC.
2024-05-01 13:44:25 +10:00
Daniel Pouzzner 7260cc124c smallstack refactors of wolfcrypt/src/evp.c:wolfssl_evp_digest_pk_final() and wolfcrypt/test/test.c:openssl_test(). 2024-04-27 12:35:23 -05:00
Daniel Pouzzner 4cc27fa58b rename WC_AES_C_DYNAMIC_FALLBACK to WC_C_DYNAMIC_FALLBACK. 2024-04-27 12:35:23 -05:00
Daniel Pouzzner 460991a6f0 wolfcrypt/test/test.c: fix invalidPrintfArgType_sint in lms_test_verify_only(). 2024-04-25 22:09:28 -05:00
Sean Parkinson 6e49aa7543
Merge pull request #7421 from philljj/update_lms_parms
Update enum wc_LmsParm for wolfboot support.
2024-04-24 16:39:10 +10:00
Colton Willey 7f19be05bd Modify HMAC oversized key tests to consistently use test vectors from RFC. 2024-04-23 15:23:51 -07:00
jordan 094ddb62c2 Add wc_LmsKey_ExportPubRaw to wolfcrypt test. 2024-04-23 10:48:53 -05:00
David Garske 3a89c452b3
Merge pull request #7454 from lealem47/stm32AesCtr
Fix for AES CTR on STM32
2024-04-22 10:04:06 -07:00
kaleb-himes 4b1edc78bb Add test case 2024-04-19 13:16:19 -06:00
Lealem Amedie acc6ff84d8 Move rng seed cb call to wolfcrypt_test 2024-04-19 12:36:20 -06:00
JacobBarthelmeh 69be7a7c54
Merge pull request #7431 from lealem47/aes_cfb
Fix for AES-CFB1 encrypt/decrypt on size (8*x-1) bits
2024-04-19 10:55:27 -06:00
JacobBarthelmeh ef153101b7
Merge pull request #7433 from SparkiDev/eddsa_fips_checks
EdDSA FIPS checks on public key
2024-04-18 14:34:31 -06:00
Lealem Amedie 295033441c Fix for AES-CFB1 encrypt/decrypt on size (8*x-1) bits 2024-04-18 11:31:28 -06:00
Daniel Pouzzner 436efb0078 wolfcrypt/test/test.c: in aes_xts_128_test(), change DEBUG_VECTOR_REGISTER_ACCESS gates to DEBUG_VECTOR_REGISTER_ACCESS_AESXTS (currently unused), after refactor of AES-XTS C fallback in 9f55dba2f2. (per-call fallback is no longer supported for AES-XTS.) 2024-04-18 00:59:03 -05:00
Sean Parkinson c590fe514f EdDSA FIPS checks on public key
Check that the Ed25519 and Ed448 public key is valid even without
private key.
Perform pairwise consistency test, only in FIPS, when making a key i
Ed25519 and Ed448.
2024-04-17 17:50:33 +10:00
Daniel Pouzzner 281c2a431e wolfcrypt/test/test.c: fix return code in pbkdf2_test(), add DEBUG_WOLFSSL gates on keysize report in ecc_test_curve(), and add missing PRIVATE_KEY_UNLOCK()s in cryptocb_test() for fips-dev coverage. 2024-04-15 14:11:21 -05:00
Daniel Pouzzner 6e0a90190f fixes for v5 and v6+ FIPS builds, including linuxkm v6+ builds. 2024-04-15 14:11:21 -05:00
kaleb-himes b8d31b042f Windows support 2024-04-09 13:55:05 -06:00
kaleb-himes a3413ad009 Address Jenkins caught item 2024-04-09 09:48:33 -06:00
kaleb-himes ef2a636610 Expose additional features of opensslall in a compliant way 2024-04-09 09:48:33 -06:00
kaleb-himes 8092104396 Address a flush-left in test.c and gt 80 column limit in settings.h 2024-04-09 09:48:33 -06:00
kaleb-himes 84f5b4e5bf Touchup a few more edge cases caught by Jenkins 2024-04-09 09:48:33 -06:00
kaleb-himes 829d028d98 Add configure for wolfEngine with new module 2024-04-09 09:48:33 -06:00
kaleb_himes 81f5ac7f6c SRTP-KDF FS Preview 2024-04-09 09:48:33 -06:00
jordan 4a069ee5c1 Small cleanup for review. 2024-04-08 21:41:33 -05:00
jordan d0802335a8 Add wc_XmssKey_ExportPubRaw to wolfcrypt test. 2024-04-05 12:09:04 -05:00
Daniel Pouzzner d930825a92
Merge pull request #7362 from jpbland1/rsa-make-key-no-malloc
fix wc_MakeRsaKey and wc_RsaKeyToDer to work with WOLFSSL_NO_MALLOC
2024-03-30 03:19:27 -04:00
Daniel Pouzzner 03d7eac9c4
Merge pull request #7337 from gojimmypi/PR-test-certbuf-256
wolfcrypt tests: improve file system gating for USE_CERT_BUFFERS
2024-03-30 00:43:20 -04:00
John Bland 7c0423eb65 reduce der buffer size 2024-03-28 12:56:26 -04:00
Andras Fekete 4cb176ffff Fix sanitizer complaint 2024-03-28 11:44:12 -04:00
John Bland 6cc32e90b0 trim down buffer size 2024-03-28 03:01:46 -04:00
John Bland 9cd614fcac update rsa test to support no malloc 2024-03-28 02:54:49 -04:00
Daniel Pouzzner 716870cbc2
Merge pull request #7370 from anhu/quickie
sizeof(oriType) ---> sizeof(asnDataOid)
2024-03-28 01:58:01 -04:00
Anthony Hu 28a88d1c7c sizeof(oriType) ---> sizeof(asnDataOid) 2024-03-27 17:05:25 -04:00
gojimmypi bf9775831f Improve wolfcrypt test NO_FILESYSTEM checks 2024-03-22 13:00:25 -07:00
Sean Parkinson d4b1995a2c ASN.1 testing: add tests of bad DER encodings
Certificates with bad DER encoded ASN.1 added to testing.
Fix comment in asn.c.
2024-03-22 08:51:17 +10:00
Sean Parkinson 638d0b1a9f Regression test fixes
pkcs7.c: pkcs7->stream must be restored or there will be a leak.
test.c: when compiled for compression, compiler warning about const
2024-03-18 09:57:22 +10:00
Sean Parkinson d1b16f2c7b Regression testing fixes
api.c: z and ret no longer only when !NO_ASN_TIME.
benchmark.c: rsaKey array type has changed and unusual code path needsed
updating.
cmac.c: Zeroization test failed when checkSz was zero as called function
didn't zero out cmac. checkSz is invalid.
test.c: rsaCaCertDerFile used even when NO_ASN_TIME.
test.h: --enable-sp-math only supports DH of 2048 bits and above. Change
default DH parameters to be 2048 bits.
2024-03-15 13:24:40 +10:00