Commit Graph

1800 Commits (2151a1b8a1f8f81c4dba985429d50b76db7307e5)

Author SHA1 Message Date
jordan f5074772da infer: fix more uninitialized value errors. 2024-10-15 12:41:09 -05:00
jordan 052cf77233 acert: fix defines, cleanup, more testing. 2024-10-08 16:11:46 -05:00
Aidan Garske e10c943bf3 wolfCrypt CSharp Wrapper:
* Adds RNG, ECC(ECIES and ECDHE), RSA, ED25519/Curve25519, AES-GCM, and Hashing to the CSharp wrapper.
* Adds GitHub action for building the CSharp wrapper solution and running wolfCrypt test and a TLS server/client example.
* Adds "new" API's for wolfCrypt for platforms that cannot tolerate the structs directly.
* Fixes for several scan-build warnings.
2024-10-05 11:44:58 -07:00
Daniel Pouzzner e814d1baea
Merge pull request #8016 from SparkiDev/dilithium_draft_final_fix
Dilithium: Final and draft available in one build
2024-10-02 14:02:00 -05:00
Sean Parkinson 50bbdbbe42 Dilithium: Final and draft available in one build
Make draft version of ML-DSA compiled in with final.
Use WC_ML_DSA_44_DRAFT, WC_ML_DSA_65_DRAFT and WC_ML_DSA_87_DRAFT for
the level to get the draft implementation.
2024-10-02 22:23:25 +10:00
Colton Willey 3d9a4ccddc Use GetShortInt instead for CRL number extension parsing 2024-09-26 15:43:30 -07:00
jordan c6124d573a asn: tiny peer review cleanup. 2024-09-24 13:01:13 -05:00
jordan 0f646b6e4b asn: cleanup around edPubKeyASN. 2024-09-23 23:24:36 -05:00
Colton Willey e5022e3ef0 Fix broken endif 2024-09-23 12:11:04 -07:00
Colton Willey 183aef241c CRL improvements, add parsing for CRL number, do not allow CRL duplicates, add callback for when CRL entry is updated. 2024-09-23 11:52:39 -07:00
Hideki Miyazaki 3f0a17b331 Update TSIP driver version to v1.21
Use ASN_TEMPLATE
Extracting YEAR and MONTH from __DATE__
2024-09-21 06:23:59 +09:00
Daniel Pouzzner 80f3b0d3d8
Merge pull request #7926 from philljj/x509_acert_support
x509 attribute cert support
2024-09-14 00:30:29 -05:00
Daniel Pouzzner 84f0800b96 configure.ac:
* set DEFAULT_ENABLED_ALL_ASM=no if enable_afalg or ENABLED_32BIT;
* omit enable_srtp_kdf from enable-all-crypto if enable_afalg.

linuxkm: add GetCAByAKID to wolfssl_linuxkm_pie_redirect_table.

src/x509.c: in GenerateDNSEntryIPString(), use XMEMSET() to initialize tmpName, not = {0}, to avoid unmaskable compiler emission of memset() call.

wolfssl/openssl/ssl.h: add OPENSSL_EXTRA to an existing OPENSSL_ALL-gated section, consistent with gating of correspinding section in wolfssl/ssl.h.

wolfssl/wolfcrypt/settings.h: adopt setup for WOLFSSL_SP_NO_UMAAL from wolfssl/wolfcrypt/sp_int.h now that it's used by wolfcrypt/src/port/arm/thumb2-poly1305-asm.S.
2024-09-13 18:01:11 -05:00
jordan 7df446bf4e cleanup: fix cast warning, and small cleanup. 2024-09-13 09:26:19 -05:00
jordan 7faed6cded X509 attribute cert (acert) support. 2024-09-13 08:03:55 -05:00
Sean Parkinson 4fa20cb770
Merge pull request #7965 from ColtonWilley/pkcs12_use_indef_len
Use context specific for PKCS7 encrypted data encoding
2024-09-13 12:17:08 +10:00
Colton Willey b0ddccc802 Change PKCS7 encrypted content encoding to use ASN_CONTEXT_SPECIFIC 2024-09-12 16:46:35 -07:00
Daniel Pouzzner eb53a95f57 wolfcrypt/src/asn.c:DecodeSingleResponse(): fix gating for "at" working var, by refactoring gating for WOLFSSL_OCSP_PARSE_STATUS sections for clarity. 2024-09-12 14:38:50 -05:00
Colton Willey 88d1ed7393 Modify pkcs8 pbe encryption to use indefinite length encoding, making it consistent with both old ASN code and openssl 2024-09-11 15:55:05 -07:00
Daniel Pouzzner c81c9be9ce error code fixes:
* fix TLS layer to consistently use WOLFSSL_FATAL_ERROR for error retvals, rather than literal -1.
* add WC_NO_ERR_TRACE() wrapper around LENGTH_ONLY_E (it does not signify an error condition).
* refactor errcode handling for traceability in wolfSSL_DSA_do_sign(), wolfSSL_DH_size(), wolfSSL_EC_KEY_get_conv_form(), wolfSSL_d2i_DSA_SIG(), wolfSSL_DSA_do_sign(), SetDhInternal(), and wolfSSL_EC_KEY_get_conv_form().
2024-09-06 19:33:48 -05:00
Daniel Pouzzner dcaff9dff4
Merge pull request #7944 from JacobBarthelmeh/pkcs12
add parsing over optional PKCS8 attributes
2024-09-05 16:55:44 -05:00
Daniel Pouzzner 9f6a75cdfd
Merge pull request #7934 from rizlik/ocsp-get-ca-keyhash-fix
ocsp: search CA by key hash instead of ext key id
2024-09-05 15:03:54 -05:00
JacobBarthelmeh 9a8573afc9 touch up pkcs8 create function and test case warning 2024-09-04 15:48:44 -06:00
JacobBarthelmeh 2a1165460e add parsing over optional PKCS8 attributes 2024-09-04 15:15:53 -06: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
Marco Oliverio 293719c168 ocsp: search CA by key hash instead of ext key id 2024-09-02 15:25:53 +00: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
Sean Parkinson d475ecc8d3
Merge pull request #7917 from douzzer/20240828-WOLFSSL_DEBUG_TRACE_ERROR_CODES-TLS
20240828-WOLFSSL_DEBUG_TRACE_ERROR_CODES-TLS
2024-08-30 14:12:20 +10:00
Daniel Pouzzner 4b4000bf61
Merge pull request #7903 from SparkiDev/ecc_sigalgo_params_null
Certificates: ECC signature algorithm parameter
2024-08-29 16:16:08 -05:00
Reda Chouk 109e4c3dfb added missing wolfSSL_X509_NAME_free(dName) 2024-08-29 17:59:02 +02: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 a3e239c2ad Certificates: ECC signature algorithm parameter
Allow, with a define, ECC signature algorithm parameters to be NULL and
not just empty.
Only for interop.
2024-08-28 11:10:41 +10:00
Daniel Pouzzner 2537e08a99
Merge pull request #7890 from embhorn/zd18463
Various Coverity fixes
2024-08-26 23:34:23 -05:00
Eric Blankenhorn 6dab58266d Various Coverity fixes 2024-08-23 16:09:18 -05:00
gojimmypi 8baf39310f
Introduce WOLFSSL_ASN_ALLOW_0_SERIAL 2024-08-22 12:30:15 -07:00
Juliusz Sosinowicz 3260a9b680 Address code review 2024-08-20 10:53:44 +02:00
Juliusz Sosinowicz a6a40de249 init sssd support
- Refactor OCSP to separate IO callback
- wolfSSL_BIO_reset: fix return
- CheckCertCRL_ex: return CRL_CERT_DATE_ERR instead of ASN_AFTER_DATE_E
- CheckCertCRL_ex: return most relevant error code
- i2d/d2i APIs: correct parameters handling and return codes
- Custom ASN1 structures: major refactor to make it much more versatile
- Use WOLFSSL_ASSERT_SIZEOF_GE where applicable
- wolfSSL_EVP_SignFinal: implement ecc
- wolfSSL_EVP_VerifyFinal: implement ecc
- OBJ_NAME_do_all: bring closer to OpenSSL functionality
- Correct return of *_push api
- Implement:
  - OCSP_REQ_CTX API
  - d2i_ECPKParameters
  - wolfSSL_sk_insert
  - OCSP_parse_url
  - X509_STORE_set1_param
  - X509_get0_subject_key_id
  - X509_OBJECT_retrieve_by_subject
  - OCSP_sendreq_nbio
2024-08-16 17:22:41 +02:00
Daniel Pouzzner 1fa2d2d625 ASN: move DecodedCert.extSubjKeyIdSz and .extAuthKeyIdSz out of the OPENSSL_EXTRA gate. fixes test.c:certext_test(), broken by f8c968d8d1 for some valid configs. 2024-08-14 14:45:11 -05:00
JacobBarthelmeh 85bab19090
Merge pull request #7845 from ColtonWilley/pkcs7_digest_absent_params
Add option for absent hash params in PKCS7
2024-08-09 15:56:28 -06:00
Daniel Pouzzner 92952a5538
Merge pull request #7839 from bandi13/noIfXFREE
No if xfree
2024-08-07 17:08:12 -05:00
Colton Willey 75c3030554 Add option for absent hash params in PKCS7 2024-08-07 11:07:45 -07:00
Eric Blankenhorn 1c2b47d8ad Fix template DecodeSubjDirAttr to set extSubjDirAttr data 2024-08-06 11:34:14 -05:00
Andras Fekete f419e2351b Remove NULL test with 'ptr = NULL' at the end 2024-08-06 10:55:37 -04:00
Andras Fekete d350ba6c41 remove NULL test with XFREE arguments with dereference 2024-08-06 10:44:59 -04:00
Andras Fekete d6a7187538 Programmatically remove NULL test with { XFREE() } 2024-08-06 10:37:43 -04:00
Andras Fekete eb0c64d79a Remove NULL test when there is a dereference 2024-08-06 10:29:02 -04:00
Andras Fekete d7a0f49906 Programmatically remove NULL test before XFREE 2024-08-06 10:20:45 -04:00
Daniel Pouzzner d65be7af21 wolfcrypt/src/asn.c and wolfssl/wolfcrypt/asn.h: in SetDNSEntry(), defer XFREE(dnsEntry, ...) until end (fixes double free); add PBE_NONE to enum PBESTypes; in EncryptContent(), initialize id to PBE_NONE to fix a -Wmaybe-uninitialized (CheckAlgo() can leave it unchanged even when returning success). 2024-08-04 15:41:52 -05:00
David Garske 25d14f1937 Fail with NOT_COMPILED_IN if someone tries to use ConfirmSignature with NO_ASN_CRYPT. Also default to signature failed. 2024-08-02 08:25:15 -07:00
David Garske 65283fb9bb Improvement for the --enable-asn=nocrypt. Note: This option skips certificate signature checking, so make check TLS expected failures do not pass. Cleanup of the api.c headers / macros. 2024-08-01 10:27:22 -07: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 afb6fe6c5f Fixes for building due to missing OCSP and DecodePolicyOID (`--enable-curl` and `--enable-openssh`). 2024-07-30 10:35:21 -07:00
David Garske 20f7d6f9f4 ASN macro simplification. Added new `--enable-asn=all` and `WOLFSSL_ASN_ALL` option. Added granular macros for ASN features like: `WOLFSSL_ASN_CA_ISSUER`, `WOLFSSL_ASN_PARSE_KEYUSAGE`, `WOLFSSL_ASN_TIME_STRING`, `WOLFSSL_OCSP_PARSE_STATUS`. 2024-07-30 10:35:20 -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
Sean Parkinson 3b74a64029
Merge pull request #7791 from aidangarske/privkeytoder_fix2
`api.c` and `asn.c` changes to allow 0 to be passed in and expanded coverage on test cases.
2024-07-29 09:40:20 +10:00
aidan garske 55540d03e7 fix for PR#7786 BUFFER_E bad case 2024-07-25 09:03:19 -07:00
aidan garske dace3acd4d api.c and asn.c changes to allow 0 to be passed in and expanded coverage on test cases
(cherry picked from commit 8572f67e60d419ddd74d4a2b7051dcaa7d0ca6b4)
2024-07-25 08:09:37 -07:00
David Garske c4f73f5955 Peer review cleanups. 2024-07-24 16:57:51 -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
David Garske 007f9ea39d Fix to restore `--enable-asn=original`. Fixes for building with ASN original (old). Add the new limit checks for alt names and subtree to the old ASN code. 2024-07-24 08:28:25 -07:00
Sean Parkinson a34ea32f52
Merge pull request #7730 from anhu/unknownExtCallbackEx
Extend the unknown extension callback.
2024-07-24 08:37:44 +10:00
David Garske 8f908e76f9
Merge pull request #7776 from douzzer/20240722-fixes
20240722-fixes
2024-07-23 06:46:38 -07:00
David Garske 7c6eb7c4a1
Merge pull request #7751 from SparkiDev/ecc_koblitz_ssl
ECC key load: fixes
2024-07-22 16:40:59 -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
JacobBarthelmeh 31a6a2bf59 update copyright to 2024 2024-07-19 13:15:05 -06:00
David Garske 74d4ae0075
Merge pull request #7704 from aidangarske/PKCS7_PEM
Added PKCS7 PEM support:
2024-07-19 07:39:51 -07:00
gojimmypi 8356b349a5
minor asn update: comments, code format, dateType check in CheckDate. 2024-07-18 18:25:53 -07:00
Daniel Pouzzner 5298039d09 fixes from peer review: move OS-specific code from wolfSSL_BIO_read() and wolfSSL_BIO_write() to wolfIO_Recv(), wolfIO_Send(), wolfIO_RecvFrom(), and wolfIO_SendTo(); add SOCKET_ETIMEDOUT definitions to wolfio.h; misc cleanups. 2024-07-16 19:12:19 -05:00
Daniel Pouzzner 41efa0492c add ASN_ prefixes to ISSUER, SUBJECT, BEFORE, and AFTER enum constants defined in wolfssl/wolfcrypt/asn.h. 2024-07-16 19:12:18 -05:00
Sean Parkinson e002b6efd3
Merge pull request #7742 from embhorn/zd18240
Fix ParseCRL_AuthKeyIdExt setting extAuthKeyIdSet
2024-07-16 09:38:54 +10:00
Sean Parkinson 137831367d
Merge pull request #7710 from anhu/preTBS_altsigalg_fix
Stop stripping out the sequence header on the AltSigAlg extension.
2024-07-16 09:35:11 +10:00
Sean Parkinson dc86dad26b ECC key load: fixes
asn.c:
  Return the curve OID sum with alg_id for ECC keys.
ssl_load.c:
Don't permanently strip the PKCS#8 information as it contains the
curve OID.
2024-07-15 15:46:05 +10:00
Eric Blankenhorn d6731f0f84 Fix ParseCRL_AuthKeyIdExt setting extAuthKeyIdSet 2024-07-12 07:43:23 -05:00
Daniel Pouzzner 76f669b1cc wolfcrypt/src/asn.c: fix -Wconversion in GetLength_ex() added in fea7a89b86. 2024-07-11 14:47:58 -05:00
Anthony Hu e581930cb7 Extend the unknown extension callback.
This will allow the user to pass in a context pointer. Allows them to avoid
global variables.

We also add unknown extensions callback when processing a CA in cert manager
as CA certs can have unknown extensions as well.

Fixes ZD 18252
2024-07-10 13:22:19 -04:00
Sean Parkinson fea7a89b86 Coverity fixes
pk.c:
	EncryptDerKey - setting wrong ret value on allocation failure.
	wolfssl_rsa_generate_key_native - now checks e is a valid long
before passing in.
	Fix formatting.

ssl_load.c:
	ProcessBufferPrivPkcs8Dec - now checking password is not NULL
before zeroizing. Allocation may fail and ForceZero doesn't check for
NULL.
	Fix formatting.

tests/api.c:
	test_RsaSigFailure_cm - Check cert_sz is greater than zero
before use.
	send_new_session_ticket - assert that building the message
doesn't return error or 0.
	test_ticket_nonce_malloc - fix setting of medium and big to use
preprocessor. Fix big to be medium + 20.

asn.c:
	GetLength_ex - Fix type of bytes so that it can go negative.

sp_int.h:
	sp_clamp - add one to ii while it is a signed.
	Fix formatting.
2024-07-10 11:40:48 +10:00
Daniel Pouzzner e35e713c4a wolfcrypt/src/asn.c: fix for copy-paste error in FillSigner() WOLFSSL_DUAL_ALG_CERTS path. 2024-07-06 10:04:26 -05:00
Daniel Pouzzner c8a9bdbe15 wolfcrypt/src/asn.c: fix for -Wconversion in FillSigner(). 2024-07-05 20:42:32 -05:00
Marco Oliverio fe932b893c fixup! csrv2multi: pending ca list 2024-07-04 10:21:20 +02:00
Anthony Hu f5e27bfb0c Stop stripping out the sequence header on the AltSigAlg extension. 2024-07-03 19:02:04 -04:00
aidan garske c065e4a854 Added PKCS7 PEM support: "-----BEGIN PKCS7-----" and "-----END PKCS7-----" 2024-07-02 07:58:01 -07:00
Marco Oliverio b5206e8504 csrv2multi: pending ca list 2024-07-02 09:51:34 +02:00
Sean Parkinson 4d56cc1790 Regression testing: memory allocation failure
Fixes from memory allocation failure testing.
Also:
fix asn.c to have ifdef protection around code compiled in with dual
algorithm certificates.
  fix test_tls13_rpk_handshake() to support no TLS 1.2 or no TLS 1.3.
fix wc_xmss_sigsleft() to initialize the index to avoid compilation
error.
2024-06-27 17:17:53 +10:00
Tobias Frauenschläger 7cd610bc45 Fixes for WolfSSL ML-DSA implementation
* Update OIDs etc. to match OQS ML-DSA values (old ones were Dilithium
  Round 3 values)
* Make sure private key files/buffers containing both the private and
  the public key are parsed correctly

Signed-off-by: Tobias Frauenschläger
<tobias.frauenschlaeger@oth-regensburg.de>
2024-06-24 15:00:44 +02:00
JacobBarthelmeh 8ee01ebaf2 sanity check for empty directory strings 2024-06-20 13:42:31 -06: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
Daniel Pouzzner b3e8f0ad24 add --enable-debug-trace-errcodes, WOLFSSL_DEBUG_TRACE_ERROR_CODES, WC_ERR_TRACE(), WC_NO_ERR_TRACE(), support/gen-debug-trace-error-codes.sh. also add numerous deployments of WC_NO_ERR_TRACE() to inhibit frivolous/misleading errcode traces when -DWOLFSSL_DEBUG_TRACE_ERROR_CODES. 2024-06-08 16:39:53 -05:00
JacobBarthelmeh 467b3cb561 add parsing 0 serial numbers for certs with python 2024-06-06 16:24:48 -06:00
JacobBarthelmeh 690d8f7f89 sanity check on non conforming serial number of 0 2024-06-06 13:22:57 -06:00
JacobBarthelmeh 40562a0cb3
Merge pull request #7599 from dgarske/asn_checkcertsig
Expose `wc_CheckCertSigPubKey` with `WOLFSSL_SMALL_CERT_VERIFY`
2024-05-31 09:20:35 -06:00
David Garske 0789ecb808 Fix the `CheckCertSignature` API mess. 2024-05-31 06:58:35 -07:00
Sean Parkinson fc8a509b06
Merge pull request #7597 from ColtonWilley/max_altnames_and_name_constraints
Max limits on number of alternative names and name constraints
2024-05-31 11:24:30 +10:00
JacobBarthelmeh 34ca03770f still compile in wc_RsaKeyToDer with keygen but NO_CERTS 2024-05-30 09:58:25 -06:00
Colton Willey a17677c946 Remove trailing whitespace 2024-05-29 21:29:55 -07:00
Colton Willey af537a6ae3 Move definition to beginning of block 2024-05-29 17:02:29 -07:00
David Garske 0b7f293691 Expose `wc_CheckCertSigPubKey` with `WOLFSSL_SMALL_CERT_VERIFY`. 2024-05-29 16:32:31 -07:00
JacobBarthelmeh cf61df129c fix typo with NO_CERTS macro 2024-05-29 17:08:01 -06:00
Colton Willey b00ae2ac69 Initial implementation of max limits on number of alternative names and name constraints 2024-05-29 15:55:17 -07:00
Tobias Frauenschläger d28dd602e5
Various fixes for dual algorithm certificates (#7577)
This commit adds varios fixes for the implementation of hybrid
certificates with two algorithms:
* Support for Certificate Signing Requests (both creating hybrid ones
  and also verifying ones)
* Fix for SAN fields in the DecodedCert and PreTBS generation
* Fix related to WOLFSSL_SMALL_STACK

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2024-05-23 15:03:55 -04:00
Juliusz Sosinowicz d9f7629296 Add grpc support
- Fix BIO_BIO type
  - Set retry flags correctly
- Add CRL callback
- Copy the alt names instead of trying to share a pointer
- Allow calling wolfSSL_get_servername on client side (to get the requested name)
- Return the chain in wolfSSL_X509_STORE_CTX_get_chain in the correct order
  - Peer first, top CA last
- Fix leak in RebuildFullName
- Add CopyString helper function
- Implement
  - X509_CRL_dup
  - ASN1_UTCTIME_set
  - X509_STORE_CTX_get0_param
  - X509_STORE_get0_param
  - X509_STORE_set_verify_cb
  - X509_STORE_set_get_crl
  - X509_set1_notAfter
  - X509_set1_notBefore
2024-05-16 18:20:53 +02:00
Andras Fekete a59a3d109f Explicit cast 2024-05-14 11:03:20 -04: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
David Garske d39ab765f6
Merge pull request #7519 from julek-wolfssl/gh/7516
Return length in wc_Curve448PublicKeyToDer with NULL output param
2024-05-13 09:00:33 -07:00
Juliusz Sosinowicz 239706615c Return length in wc_Curve448PublicKeyToDer with NULL output param 2024-05-10 20:10:23 +02: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
Sean Parkinson b62e8c1467 ASN template debug compile error
Variable is length instead of len.
2024-05-09 10:44:36 -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
Sean Parkinson 8e9810e87e ssl.c: Move functions out to separate files
Moved E[CD][25519||448] APIs to pk.c
Move public key PEM APIs to pk.c.
Move wolfSSL loading and using of private keys and certificates to
ssl_load.c
Move PKCS#7 and PKCS#12 APIs to ssl_p7p12.c.
Move session and session cache APIs to ssl_sess.c.
Other minor fixes.
2024-04-16 10:30:59 +10:00
JacobBarthelmeh ff09f418c0
Merge pull request #7408 from SparkiDev/asn_templ_rid
X.509 RID ASN template behaviour
2024-04-10 11:42:07 -06:00
Sean Parkinson b48b5c47f4 X.509 RID ASN template behaviour
Don't set the DNS entry for RID unless OPENSSL_ALL is defined to match
the behaviour of original ASN code.
2024-04-10 10:39:45 +10:00
Daniel Pouzzner a518f493b5
Merge pull request #7388 from JacobBarthelmeh/x509_cases
check for critical policy extension when not supported
2024-04-05 15:59:03 -04:00
JacobBarthelmeh 983616afa0 check for critical policy extension when not supported 2024-04-02 16:46:47 -06:00
Daniel Pouzzner 092dba4593 wolfcrypt/src/asn.c: fix for benign identicalInnerCondition in ParseCertRelative(). 2024-04-01 23:50:05 -05:00
Anthony Hu 10d210ce26 Parenthesis 2024-04-01 19:05:59 -04:00
Anthony Hu 2d532dd6b8 Clean up after another round of analyzer execution. 2024-04-01 18:56:44 -04:00
Anthony Hu 8f599defe0 Add check inspired by original implementation of asn. 2024-04-01 17:37:03 -04:00
Tobias Frauenschläger 136eaae4f1 Improvements to dual alg certificates
* Support for external keys (CryptoCb interface)
* Support for usage in mutual authentication
* better entity cert parsing
* Fix for Zephyr port to support the feature
* Check key support
* Proper validation of signatures in certificate chains
* Proper validation of peer cert with local issuer signature
	(alt pub key is cached now)
* Support for ECC & RSA as alt keys with PQC as primary
* Support for PQC certificate generation
* Better support for hybrid signatures with variable length signatures
* Support for primary and alternative private keys in a single
  file/buffer
* More API support for alternative private keys

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2024-04-01 17:37:03 -04:00
John Bland d8e9e90f9d refactor rawLen to avoid unused warning 2024-03-30 02:12:32 -04:00
John Bland 305f87561d break out of loop on failure instead of return 2024-03-28 02:54:49 -04:00
John Bland fb784a2ac9 more changes from PR comments 2024-03-28 02:54:49 -04:00
John Bland 0bd8775eae update based on PR comments 2024-03-28 02:54:49 -04:00
John Bland d9d3f9a4f4 fix wc_MakeRsaKey and wc_RsaKeyToDer to work with
WOLFSSL_NO_MALLOC
2024-03-28 02:54:49 -04: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
John Safranek 6462986bf2
OCSP Extension Encoding Fix
1. Removed redundant check for the output being NULL in
   `EncodeOcspRequestExtensions()`. The chuck of code being protected
   only cared about the value of ret, not the pointer. The code was
   supposed to calculate the size of the data without writing it.
2024-03-19 09:13:28 -07:00
David Garske 69bc5c1c19
Merge pull request #7345 from JacobBarthelmeh/coverity
Coverity fixes
2024-03-18 08:15:59 -07:00
JacobBarthelmeh 36e67af0f8
Merge pull request #7331 from SparkiDev/asn1_templ_issuer_cn
ASN.1 template: store issuer common name
2024-03-18 20:27:04 +07:00
Sean Parkinson 84c42f4a4e ASN.1 template: store issuer common name
Under certain configurations the certificate issuer's common name is
kept in a DecodedCert. Wasn't implemented in ASN.1 template code.
2024-03-18 07:06:32 +10:00
JacobBarthelmeh 763c4a074c CID 315823 truncate on cast 2024-03-17 23:54:56 +07:00
JacobBarthelmeh 2f43cc1c7b
Merge pull request #7332 from SparkiDev/asn_templ_neg_int_check
ASN.1 parsing: check for badly encode negative INTEGER
2024-03-15 22:40:55 +07:00
Daniel Pouzzner 25efe6b66a wolfcrypt/src/asn.c: fix -Wconversions in GetASN_BitString(), GetASN_UTF8String(), and GetASN_ObjectId(). 2024-03-14 18:42:50 -05:00
Sean Parkinson 40681226aa ASN.1 parsing: check for badly encode negative INTEGER
When encoding a negative number, when the first byte is 0xff then the
next byte can't have top bit set.
2024-03-14 09:01:22 +10:00
David Garske 448378ce90
Merge pull request #7306 from SparkiDev/asn1_validate_fix_1
ASN.1 template: validate UTF8STRING and OBJECT IDENTIFER data
2024-03-13 15:23:02 -07:00
Sean Parkinson 084338dde7 ASN Template: GetASN_UTF8String optional
Allow UTF8String checking to be disabled with WOLFSSL_NO_ASN_STRICT.
2024-03-12 09:59:51 +10:00
Sean Parkinson 5daf5fff86
Merge pull request #7272 from JacobBarthelmeh/pkcs7-enc
IO callbacks for content and output with PKCS7 bundle sign/encrypt
2024-03-08 07:18:11 +10:00
Sean Parkinson faea635ee2 ASN.1 template: validate UTF8STRING and OBJECT IDENTIFER data
Check the data of UTF8STRING and OBJECT IDENTIFIER to ensure it is
properly encoded.
2024-03-07 18:01:16 +10:00
Daniel Pouzzner 52f003f5fc
Merge pull request #7281 from philljj/zd17416
Fix Coverity issues.
2024-03-01 02:41:48 -05:00
jordan b3c276bf0b Fix wc_SetExtKeyUsageOID buffer warning: update size of oid. 2024-02-29 13:17:31 -06:00
jordan c24add5da9 Fix dataASN null pointer dereference in asn.c. 2024-02-28 15:37:55 -06:00
jordan 1768b03ecd Fix wc_SetExtKeyUsageOID buffer warning. 2024-02-28 11:13:33 -06:00
JacobBarthelmeh 2044d6b7dd add callbacks for PKCS7 streaming input and output 2024-02-26 08:28:12 -07:00
Juliusz Sosinowicz 4caef93346 Implement transient certs
Add wolfSSL_CertManagerUnloadIntermediateCerts API to clear intermediate certs added to store.
2024-02-20 14:33:36 +01:00
John Safranek 52f4dcd7aa
OCSP Date Checks
When calling DecodeResponseData(), no matter the return value, if it is
not success, it is assigned to ASN_PARSE_E. This isn't the pattern for
other branch parsing. Return the value returned.

This is seen when decoding an OCSP response that is past the
next-available time.
2024-02-16 12:12:27 -08:00
John Safranek c17fb7498b
OCSP Revocation Reason
1. The ASN.1 parser wasn't handling the OCSP response correctly when
   there was a revocation reason included in the response. The encoded
   reason value is constructed, and was getting marked as not
   constructed in the parser. Changed the flag to mark it as
   constructed.
2024-02-12 13:11:51 -08:00
Daniel Pouzzner 4d842f094e
Merge pull request #7199 from lealem47/defaultASN
Default to ASN TEMPLATE library
2024-02-05 22:32:57 -05:00
Lealem Amedie d36bd47a27 For cppcheck: Explicitly initialize some variables 2024-02-05 15:09:05 -07:00
JacobBarthelmeh 7592559fd3 rename argument, fix warnings on casts 2024-02-02 14:50:50 -07:00
Lealem Amedie 63f7298be2 Default to ASN TEMPLATE library 2024-02-01 14:52:06 -07:00
JacobBarthelmeh ed4b87eb37 fix for clang-tidy null dereference error 2024-02-01 14:26:13 -07:00
JacobBarthelmeh 8d0dc7a568 fix asn original build, vs warning, and add test cases 2024-02-01 11:50:51 -07:00
JacobBarthelmeh bf23357c8c refactor streaming and additional comments 2024-02-01 11:50:51 -07:00