Commit Graph

110 Commits (e8c110d2ac54cecf268411af2dd09620adb1ad86)

Author SHA1 Message Date
Juliusz Sosinowicz ab64597b62 fixup! Move extended master secret testing to test_tls_ext 2025-04-09 14:36:34 +02:00
Juliusz Sosinowicz a240a58605 fixup! TLS EMS: Set haveEMS when we negotiate TLS 1.3 2025-04-09 14:36:34 +02:00
Juliusz Sosinowicz 89e392f1e8 fixup! Move extended master secret testing to test_tls_ext 2025-04-09 14:36:34 +02:00
Juliusz Sosinowicz f15ff6861c TLS EMS: Set haveEMS when we negotiate TLS 1.3 2025-04-09 14:36:34 +02:00
Juliusz Sosinowicz 2c585d73c8 Move extended master secret testing to test_tls_ext 2025-04-09 14:36:34 +02:00
Juliusz Sosinowicz 75ca54889c Implement AES-CTS in wolfCrypt 2025-04-09 12:11:08 +02:00
Daniel Pouzzner 217440c885 Add wolfcrypt/src/wolfssl_sources.h and wolfcrypt/src/wolfssl_sources_asm.h,
which force on BUILDING_WOLFSSL and do boilerplate includes, and update library
  sources to include them at the top.

  wolfssl_sources.h includes types.h, error-crypt.h, and logging.h, and
  conditionally, config.h.  settings.h and wc_port.h are unconditionally
  included at the top of types.h.

  wolfssl_sources_asm.h includes settings.h, and conditionally, config.h.

Add wolfssl_sources*.h to wolfcrypt/src/include.am, and to several IDE/ project
  files.

Also added a TEST_WOLFSSL_SOURCES_INCLUSION_SEQUENCE clause in
  wolfssl/wolfcrypt/settings.h to allow coverage testing.

In wolfcrypt/src/misc.c, retain existing ad hoc boilerplate includes, and use
  them if WOLFSSL_VIS_FOR_TESTS, otherwise include the new wolfssl_sources.h.

Define WOLFSSL_VIS_FOR_TESTS at top of wolfcrypt/test/test.c.

Also renamed WOLFSSL_NEED_LINUX_CURRENT to WOLFSSL_LINUXKM_NEED_LINUX_CURRENT,
  for clarity.
2025-04-04 16:51:04 -05:00
Daniel Pouzzner e3fe575720 tests/api/test_evp.c: fix gating in test_wolfSSL_EVP_CIPHER_type_string(). 2025-03-21 17:52:33 -05:00
Daniel Pouzzner a57326d500 fix whitespace in tests/api/test_evp.c. 2025-03-21 16:56:48 -05:00
David Garske 294e4c79a8
Merge pull request #8578 from philljj/coverity_unchecked_ret
Coverity unchecked return value
2025-03-21 10:05:29 -07:00
David Garske 9258fde02f
Merge pull request #8570 from wolfSSL/devin/1742405136-cipherType-to-string
Add wolfSSL_EVP_CIPHER_type_string function and test
2025-03-21 10:04:41 -07:00
jordan 3a02ab286c coverity: unchecked return value with mp_copy. 2025-03-21 08:59:31 -04:00
David Garske 7ba179f50f
Merge pull request #8560 from SparkiDev/test_api_c_split_1
Split out tests: random, wolfmath, public key
2025-03-20 16:42:41 -07:00
David Garske 2c36ae268f
Merge pull request #8536 from SparkiDev/kyber_to_mlkem
Update Kyber APIs to ML-KEM APIs
2025-03-20 11:07:53 -07:00
David Garske beac9cb8b8
Merge pull request #8544 from philljj/coverity_test_md5
coverity: pacify test_md5 uninitialized scalar variable warning.
2025-03-20 10:57:28 -07:00
Devin AI ec00f780ec Rename parameter in wolfSSL_EVP_CIPHER_type_string and add test
Co-Authored-By: lealem@wolfssl.com <lealem@wolfssl.com>
2025-03-19 17:41:51 +00:00
Sean Parkinson 663ca29a5d Split out tests: random, wolfmath, public key
Improved testing of random APIs.
wolfmath tests moved out.
Public key algorithm testing moved out: RSA, DSA, DH, ECC, SM2,
Curve25519, Ed25519, Curve448, Ed448, ML-DSA.
Signature API tests moved out.

Fix for OCSP testing to ensure RSA is available.

Added group names to API test cases.
Can select groups to run with --group <name>. --groups lists all known
group names.

Added option to stop API testing on first failure: --stopOnFail.
2025-03-17 09:32:00 +10:00
Daniel Pouzzner bc7fbee539
Merge pull request #8528 from SparkiDev/digest_test_rework_2
Digest tests: add more tests
2025-03-14 16:11:42 -05:00
Sean Parkinson a7690ca24b ML-KEM/Kyber: finish name change 2025-03-10 08:37:14 +10:00
Sean Parkinson e7ef3ab606 Digest tests: add more tests
Add testing of MD2 and Md4.
Add more tests of functions in hash.c.
Reformat data to match what is output by PRINT_DATA macro.
2025-03-10 08:13:06 +10:00
jordan f91f9bf037 coverity: pacify test_md5 uninitialized scalar variable warning. 2025-03-09 16:03:21 -04:00
David Garske 9b16ed5da4
Merge pull request #8518 from lealem47/evp_update_null_cipher
Add NULL_CIPHER_TYPE support to wolfSSL_EVP_CipherUpdate
2025-03-03 14:03:57 -08:00
Lealem Amedie 59a987aa00 Remove trailing whitespace 2025-02-28 16:06:24 -07:00
Lealem Amedie 22221e5007 Add NULL_CIPHER_TYPE support to wolfSSL_EVP_CipherUpdate 2025-02-28 11:44:30 -07:00
Daniel Pouzzner 7698546531
Merge pull request #8515 from SparkiDev/test_sha512_be
Tests api.c: sha512 big endian
2025-02-28 00:51:54 -06:00
Sean Parkinson 14651edae0 Tests api.c: sha512 big endian
Don't need to reverse bytes for SHA-512 Transform API.
2025-02-28 14:58:43 +10:00
Sean Parkinson 4f8a39cbcf
Merge pull request #8498 from rizlik/ocsp_fixes
OCSP openssl compat fixes
2025-02-28 13:42:50 +10:00
Daniel Pouzzner d63a180f95
Merge pull request #8513 from SparkiDev/api_c_split_ciphers
Test api.c: split out MACs and ciphers
2025-02-27 14:00:36 -06:00
Marco Oliverio 194db7e844 tests: gate ocsp test on SM2 || SM3
we don't properly support SM2 and SM3 hash algo id properly yet
2025-02-27 19:38:46 +00:00
Marco Oliverio 814f0f8a09 Refactor CERT_ID encoding as per review comments 2025-02-27 12:50:37 +00:00
Sean Parkinson 48300352c6 Test api.c: split out MACs and ciphers 2025-02-27 15:52:39 +10:00
Daniel Pouzzner f7ddc49487 linuxkm/linuxkm_wc_port.h: add #error if the user tries to use the kernel crypto fuzzer with FIPS AES-XTS (kernel bug).
src/internal.c: fix shiftTooManyBitsSigned in DefTicketEncCb().

tests/api/test_sha256.c and wolfssl/wolfcrypt/sha256.h: gate raw transform APIs (wc_Sha256Transform(), wc_Sha256FinalRaw()) and tests on !defined(WOLFSSL_KCAPI_HASH) && !defined(WOLFSSL_AFALG_HASH).

move enum wc_HashFlags from wolfssl/wolfcrypt/hash.h to wolfssl/wolfcrypt/types.h to resolve circular dependency detected by cross-armv7m-armasm-thumb-fips-140-3-dev-sp-asm-all-crypto-only.

add FIPS_VERSION_GE(7,0) gates to new null-arg tests in test_wc_Shake{128,256}_*().

optimize ByteReverseWords() for cases where only one operand is unaligned, and add correct handling of unaligned data in ByteReverseWords64() to resolve unaligned access sanitizer report in cross-aarch64_be-all-sp-asm-unittest-sanitizer.
2025-02-26 20:55:56 -06:00
David Garske 512f928650 Fix cast warnings with g++. 2025-02-26 14:45:23 -08:00
Marco Oliverio 5eef98a5ea ocsp: add OCSP CERT ID encode/decode test 2025-02-25 22:22:43 +00:00
David Garske 3557cc764a
Merge pull request #8501 from SparkiDev/digest_test_rework
Digest testing: improve
2025-02-25 13:03:48 -08:00
Marco Oliverio 740fb6bafc test: gate ocsp test when SHA-1 is disabled
tests blobs contains sha-1 hashes in certificate status
2025-02-25 15:42:35 +00:00
Marco Oliverio 78ca784826 test: ocsp: fix output file name in script 2025-02-25 15:42:30 +00:00
Marco Oliverio 8b80cb10d6 ocsp: responderID.ByKey is SHA-1 Digest len
Check that responderID.ByKey is exactly WC_SHA_DIGEST_SIZE as per RFC
6960. KEYID_SIZE can change across build configuration.
2025-02-25 15:42:22 +00:00
Sean Parkinson 6016cc0c97 Digest testing: improve
Make testing digests consistent.
Add KATs for all digests.
Check unaligned input and output works.
Perform chunking tests for all digests.

Fix Blake2b and Blake2s to checkout parameters in update and final
functions.
Fix Shake256 and Shake128 to checkout parameters in absorb and squeeze
blocks functions.

Add default digest size enums for Blake2b and Blake2s.
2025-02-25 19:07:20 +10:00
JacobBarthelmeh 01808bebca
Merge pull request #8474 from philljj/coverity_feb_2025
coverity: fix test_dtls warnings.
2025-02-20 10:35:47 -07:00
Sean Parkinson 82b50f19c6 ML-KEM/Kyber: improvements
ML-KEM/Kyber:
  MakeKey call generate random once only for all data.
  Allow MakeKey/Encapsulate/Decapsulate to be compiled separately.
  Pull out public key decoding common to public and private key decode.
Put references to FIPS 140-3 into code. Rename variables to match FIPS
140-3.
  Fix InvNTT assembly code for x64 - more reductions.
  Split out ML-KEM/Kyber tests from api.c.

TLSX:
Store the object instead of the private key when WOLFSSL_MLKEM_CACHE_A
is defined or WOLFSSL_TLSX_PQC_MLKEM_STORE_OBJ. Faster decapsulation
when A is cached and object stored.
To store private key as normal define
WOLFSSL_TLSX_PQC_MLKEM_STORE_PRIV_KEY.

misc.c: when Intel x64 build, assume able to read/write unaligned
2025-02-20 08:14:15 +10:00
jordan 6f1c31a816 coverity: fix macro warning. 2025-02-19 11:29:45 -05:00
jordan 9a1d60100f coverity: fix test_dtls warnings. 2025-02-19 09:38:15 -05:00
Marco Oliverio a1d1f0ddf1 ocsp: enable SSL_CTX_set_tlsext_status_cb only in OPENSSL_ALL 2025-02-17 11:29:09 +00:00
Marco Oliverio 1eecf326fd ocsp: use ocspReponse->heap in OcspFindSigner + minors 2025-02-17 08:59:29 +00:00
Marco Oliverio 0af092ec79 ocsp: minors 2025-02-17 08:59:29 +00:00
Marco Oliverio a06a8b589c ocsp: minors 2025-02-17 08:59:29 +00:00
Marco Oliverio 4351a5dd70 ocsp/test: better test assertions 2025-02-17 08:59:29 +00:00
Marco Oliverio 69116eb05d ocsp/tests: update blobs and add license header 2025-02-17 08:59:29 +00:00
Marco Oliverio 3724094ce2 ocsp: add test for response with unusable internal cert
- Added a new test case `resp_bad_embedded_cert` in
  `create_ocsp_test_blobs.py` to test OCSP response with an unusable
  internal cert that can be verified in Cert Manager.
- Updated `test_ocsp_response_parsing` in `ocsp.c` to include the new
  test case.
- Ensured the new test case checks for proper handling of OCSP responses
  with incorrect internal certificates.
2025-02-17 08:59:29 +00:00
Marco Oliverio ae3177c439 ocsp-resp-refactor: fix tests 2025-02-17 08:59:29 +00:00
Marco Oliverio f782614e1e clang tidy fixes 2025-02-17 08:59:28 +00:00
Marco Oliverio 2fe413d80f ocsp: add tests 2025-02-17 08:59:23 +00:00
Daniel Pouzzner 690bb14203 tests/utils.c and tests/api/test_dtls.c: fixes for include order, re tests/unit.h. 2025-02-14 10:57:29 -06:00
David Garske 3075e57207 Whitespace and filename comment. 2025-02-14 09:51:29 -06:00
Juliusz Sosinowicz 21dce84448 Add negative tests for DTLS CID 2025-02-14 09:51:29 -06:00
Juliusz Sosinowicz 68c27c4e5d Move dtls cid tests to tests/api/dtls.c 2025-02-14 09:51:29 -06:00
Sean Parkinson 3ff89f2cc2 API test: move digest functions out
Move all api.c tests of wolfCrypt APIs that are for digests out into
separate files.
2025-02-07 09:29:46 +10:00
Juliusz Sosinowicz db0345c009 ascon: make tests more readable by moving the kat vectors into a header 2025-02-04 12:58:51 +01:00
Juliusz Sosinowicz bcde4bdebb ascon: move tests to api.c and introduce framework to split up api.c 2025-01-29 15:50:00 +01:00