16304 Commits

Author SHA1 Message Date
David Garske
54e7db0a9a
Merge pull request #4739 from rizlik/psa
support Platform Security Architecture (PSA) API
2022-02-07 10:40:21 -08:00
Chris Conlon
4c8f0709fc
Merge pull request #4720 from dgarske/fips_compat 2022-02-07 09:56:24 -07:00
David Garske
3d85a9690f
Merge pull request #4819 from lealem47/hashMismatch
Fix for OpenSSL x509_NAME_hash mismatch
2022-02-07 08:08:49 -08:00
Sean Parkinson
f6d79ff598
Merge pull request #4813 from dgarske/zd13571
Fix for mutual authentication to prevent mismatch of certificate and sigalgo
2022-02-07 11:00:04 +10:00
Lealem Amedie
f9ff551992 Fix for OpenSSL x509_NAME_hash mismatch 2022-02-04 16:59:51 -08:00
David Garske
1f8ff7d9fe
Merge pull request #4822 from embhorn/zd13613
Fix warnings in VS
2022-02-04 15:37:31 -08:00
Marco Oliverio
2077184953 psa: add compile-time error if builded with crypto cb 2022-02-04 21:45:38 +01:00
Marco Oliverio
b8635efda7 psa: add README.md and doxygen header 2022-02-04 21:45:38 +01:00
Marco Oliverio
0cb2cc1705 psa: support pk callbacks for ECDSA, ECDH, HKDF 2022-02-04 21:45:38 +01:00
Marco Oliverio
630b244cee psa: introduce global lock 2022-02-04 21:45:38 +01:00
Marco Oliverio
a7165907da psa: support AES 2022-02-04 21:45:38 +01:00
Marco Oliverio
9ccfc81f26 psa: support PSA SHA1/SHA256/SHA224 2022-02-04 21:45:38 +01:00
Marco Oliverio
06915b6fa3 psa: support PSA random generator 2022-02-04 21:45:38 +01:00
David Garske
08047b2d95 Add checking to make sure key is present in all cases. Explicitly set validSigAlgo to zero with comment to clarify the default assumption. 2022-02-04 11:47:06 -08:00
David Garske
2d184348fb
Merge pull request #4825 from embhorn/gh4815
Fix wolfSSL_PEM_X509_INFO_read with NO_FILESYSTEM
2022-02-04 10:42:40 -08:00
David Garske
327e35fc25
Merge pull request #4826 from haydenroche5/evp_aes_gcm_iv_bug
Fix IV length bug in EVP AES-GCM code.
2022-02-04 10:38:02 -08:00
Hayden Roche
d1ca8fc673
Merge pull request #4821 from elms/cmake/help_cleanup 2022-02-04 09:37:39 -08:00
Marco Oliverio
08fbcf5eae autoconf: add PSA options 2022-02-04 12:12:04 +01:00
Hayden Roche
b850cc89b0 Fix IV length bug in EVP AES-GCM code.
In `wolfSSL_EVP_CipherInit`, `ctx`'s `ivSz` field isn't being accounted for.
A common OpenSSL EVP AES-GCM flow looks like this:

- `EVP_CIPHER_CTX_new`
- `EVP_EncryptInit_ex`
- `EVP_CIPHER_CTX_ctrl` with command `EVP_CTRL_GCM_SET_IVLEN` to set the IV
length to 16 (AES block size) instead of the default 12
- `EVP_EncryptInit_ex` again to set the key and IV
- `EVP_EncryptUpdate` however many times
- `EVP_EncryptFinal`

In fact, we test this flow in our unit test `test_wolfssl_EVP_aes_gcm`. However,
in our implementation, the second call to `EVP_EncryptInit_ex` unconditionally
resets the IV length back to 12. This doesn't cause a test failure because
decryption has the same problem, so both sides of the equation have the same
wrong view of the IV.

The solution is to preserve the IV length in wolfSSL_EVP_CipherInit if ctx->ivSz
is non-zero. Otherwise, use the default of 12 (`GCM_NONCE_MID_SZ`).

This was discovered by a user migrating to the compatibility layer. As I
mentioned, it isn't exposed by our testing. It is exposed if you try to use the
same key and IV with OpenSSL and compare the resulting ciphertext with wolfSSL.
They won't be the same and thus won't interoperate.
2022-02-03 17:40:26 -08:00
Eric Blankenhorn
a0444bf72f Fix wolfSSL_PEM_X509_INFO_read with NO_FILESYSTEM 2022-02-03 16:52:08 -06:00
Eric Blankenhorn
7b2e457d04 Fix VS unreachable code warning 2022-02-03 15:53:35 -06:00
David Garske
53e64b55e1
Merge pull request #4823 from haydenroche5/alpn_bug
Fix bug in TLSX_ALPN_ParseAndSet when using ALPN select callback.
2022-02-03 13:16:13 -08:00
Hayden Roche
fab2e99bff Fix bug in TLSX_ALPN_ParseAndSet when using ALPN select callback.
At the start of this function, it attempts to find an ALPN extension in the
ssl object's extensions with `TLSX_Find`. If an ALPN select callback has been
set (i.e. via `wolfSSL_CTX_set_alpn_select_cb`), that gets called next. If that
callback finds a match, it removes all existing ALPN extensions found in the
ssl object. It then uses the new protocol name like this:

```
if (TLSX_UseALPN(&ssl->extensions, (char*)out, outLen, 0, ssl->heap)
                                                           == WOLFSSL_SUCCESS) {
    if (extension == NULL) {
        extension = TLSX_Find(ssl->extensions,
                              TLSX_APPLICATION_LAYER_PROTOCOL);
    }
}
```

The bug is exposed if `extension` is not NULL, i.e. it was found on that initial
`TLSX_Find` call. `extension` is not NULL but it now points to garbage because
all the old ALPN extensions were just removed. It won't have it's value assigned
to the new extension that just got pushed via `TLSX_UseALPN` because of this
NULL check. This results in a segfault later in the function.

The solution is to remove the NULL check and always update `extension` after the
`TLSX_UseALPN` call.

This bug was discovered by a customer when using nginx + wolfSSL. I was able to
reproduce locally with curl acting as the client
2022-02-03 09:36:18 -08:00
Eric Blankenhorn
f0b953ce0c Fix warnings in VS 2022-02-03 07:19:43 -06:00
Elms
fab8eca2fd cmake: Check for valid voerride values
Also remove trailing whitespace
2022-02-02 16:32:00 -08:00
Elms
9b4289c751 cmake: Add KEYGEN option. Cleanup help messages.
Add `WOLFSSL_KEYGEN` option and override enable when `WOLFTPM` is
enabled

Also major reduction of variables for help messages. Override only
updates `VALUE`
2022-02-02 16:15:47 -08:00
David Garske
d3e3f57b77
Merge pull request #4818 from julek-wolfssl/guido-13454
`object` and `value` need to be `free`'ed
2022-02-02 16:04:39 -08:00
David Garske
17eee2ba0c
Merge pull request #4817 from julek-wolfssl/ZD13495
ZD13495
2022-02-02 15:54:08 -08:00
Juliusz Sosinowicz
97dd974a94 object and value need to be free'ed 2022-02-02 23:13:59 +01:00
David Garske
e13861bcde Fix for mutual authentication to prevent mismatch of certificate and sig algo. Work from Sean P. ZD 13571 2022-02-02 12:20:02 -08:00
David Garske
28d3292a16
Merge pull request #4811 from haydenroche5/dh_get_2048_256
Add DH_get_2048_256 to compatibility layer.
2022-02-02 12:12:34 -08:00
David Garske
0618b69b6d
Merge pull request #4816 from julek-wolfssl/ok-error
For `0` OpenSSL prints "ok"
2022-02-02 12:10:35 -08:00
David Garske
9efb791abc
Merge pull request #4814 from SparkiDev/bio_dump_iter
wolfSSL_BIO_dump: fix output format and make iterative
2022-02-02 12:02:07 -08:00
Juliusz Sosinowicz
d5b294edc4 ZD13495
- `wolfSSLeay_version` now returns the version of wolfSSL
- `wolfssl/openssl/crypto.h` was not enveloped in a `extern "C"` wrapper
2022-02-02 17:38:36 +01:00
Hayden Roche
c629c3fcaa Add DH_get_2048_256 to compatibility layer. 2022-02-02 07:59:17 -08:00
Juliusz Sosinowicz
1552e89810 For 0 OpenSSL prints "ok" 2022-02-02 15:54:21 +01:00
Marco Oliverio
cebb127ac3 test: don't free AesXts struct in-between tests that reuse the key 2022-02-02 10:46:40 +01:00
Sean Parkinson
641576390d wolfSSL_BIO_dump() and wolfSSL_OBJ_obj2txt() rework
wolfSSL_BIO_dump(): fix output format and make iterative
wolfSSL_OBJ_obj2txt(): make iterative, test and rework.
2022-02-02 12:43:06 +10:00
Chris Conlon
59ea65bad3
Merge pull request #4809 from haydenroche5/asn1_int 2022-02-01 13:44:32 -07:00
David Garske
99799a3e3e
Merge pull request #4806 from anhu/kill_idea
Purge IDEA cipher
2022-02-01 12:27:55 -08:00
Hayden Roche
24a2ed7e9e
Merge pull request #4780 from dgarske/ipsec_racoon 2022-01-31 15:10:58 -08:00
David Garske
df85ea7e87
Merge pull request #4800 from SparkiDev/sp_c_smul
SP C: multiplication of two signed types with overflow is undefined in C
2022-01-31 14:29:18 -08:00
David Garske
13c759cc10
Merge pull request #4812 from douzzer/20220131-camellia-clang-tidy
wolfcrypt/src/camellia.c: clang-tidy fixes (bugprone-macro-parentheses).
2022-01-31 14:13:23 -08:00
Anthony Hu
a742c33c0c Mention IDEA removal in README.md. 2022-01-31 16:18:39 -05:00
Anthony Hu
9ea40f3a9c Purge IDEA cipher 2022-01-31 15:29:25 -05:00
Daniel Pouzzner
a7de880745 wolfcrypt/src/camellia.c: clang-tidy fixes (bugprone-macro-parentheses). 2022-01-31 14:21:54 -06:00
David Garske
ecb3f215b5
Merge pull request #4808 from lealem47/certreq
Fix for certreq and certgen options with openssl compatability
2022-01-31 10:16:22 -08:00
David Garske
5bdaf44354
Merge pull request #4774 from anhu/kill_rabbit
Purge Rabbit cipher
2022-01-31 09:17:23 -08:00
Hayden Roche
6b71289ae1 Add new ASN1_INTEGER compatibility functions.
This commit adds:

- wolfSSL_i2d_ASN1_INTEGER
- wolfSSL_d2i_ASN1_INTEGER
- wolfSSL_ASN1_INTEGER_cmp
2022-01-29 17:01:16 -08:00
David Garske
e58ff9e765
Merge pull request #4795 from wolfSSL/cmake/wolftpm
cmake: Add options to support wolfTPM
2022-01-28 14:52:53 -08:00