Commit Graph

8134 Commits

Author SHA1 Message Date
Daniel Pouzzner
63fe12efe3 wolfcrypt/src/aes.c: fix WOLFSSL_AESGCM_STREAM && WC_AES_C_DYNAMIC_FALLBACK: establish AESNI status dynamically at time of wc_AesGcmSetKey(), and stick to it (or return failure) until the next wc_AesGcmSetKey(). this matches the semantics of the Linux kernel in-tree implementation, allowing safe registration of the wolfCrypt AESNI implementation with the LKCAPI.
configure.ac: move enable_aesgcm_stream=yes clauses in enable-all and enable-all-crypto to the main section, from the !ENABLED_LINUXKM_DEFAULTS section, and in ENABLED_LINUXKM_LKCAPI_REGISTER setup, remove the !ENABLED_AESNI from the condition for forcing on ENABLED_AESGCM_STREAM.

linuxkm/lkcapi_glue.c:
* remove all special-casing for AES-GCM with AESNI.
* add support for a LINUXKM_LKCAPI_PRIORITY_ALLOW_MASKING macro.

wolfssl/wolfcrypt/memory.h: add missing definition of SAVE_VECTOR_REGISTERS2() when DEBUG_VECTOR_REGISTER_ACCESS_FUZZING && !DEBUG_VECTOR_REGISTER_ACCESS.

wolfcrypt/src/memory.c:
* define SAVE_VECTOR_REGISTERS2_fuzzer() if DEBUG_VECTOR_REGISTER_ACCESS_FUZZING, regardless of DEBUG_VECTOR_REGISTER_ACCESS.
* add a DEBUG_VECTOR_REGISTER_ACCESS clause to the !HAVE_THREAD_LS version of SAVE_VECTOR_REGISTERS2_fuzzer().

wolfcrypt/test/test.c: remove several errant wc_AesFree()s in aes256_test().
2024-02-10 01:09:15 -06:00
Daniel Pouzzner
6146485d2a linuxkm/linuxkm_wc_port.h:
* add support for DEBUG_LINUXKM_FORTIFY_OVERLAY to allow KASAN analysis of the overlay without actually enabling CONFIG_FORTIFY_SOURCE (which is buggy in combination with KASAN).
* make SAVE_VECTOR_REGISTERS2 definition conditional on !defined(SAVE_VECTOR_REGISTERS2).

wolfssl/wolfcrypt/memory.h: fix the DEBUG_VECTOR_REGISTER_ACCESS definition for SAVE_VECTOR_REGISTERS to properly omit the on-success bookkeeping code even if the supplied fail_clause doesn't return.

wolfcrypt/src/rsa.c: in wc_MakeRsaKey() primality loop, invoke RESTORE_VECTOR_REGISTERS() SAVE_VECTOR_REGISTERS() to prevent lengthy kernel lockups.

wolfcrypt/src/dh.c: in wc_DhGenerateParams() primality loop, invoke RESTORE_VECTOR_REGISTERS() SAVE_VECTOR_REGISTERS() to prevent lengthy kernel lockups.

wolfcrypt/src/{curve25519.c,dh.c,dsa.c,ecc.c,eccsi.c,rsa.c,sakke.c,sp_int.c}: when WOLFSSL_LINUXKM, force {SAVE,RESTORE}_VECTOR_REGISTERS() to WC_DO_NOTHING if settings gate out applicable asm.
2024-02-09 00:47:23 -06:00
Daniel Pouzzner
91681f378f configure.ac:
* add srtp to enable-all
* add srtp-kdf to enable-all-crypto
* fix typo in enable-all[-crypto] where ENABLED_FIPS was used when FIPS_VERSION was needed.
* in enable-all[-crypto], conditionalize aesxts on !FIPS || FIPS_VERSION == dev.
* move AES-XTS CFLAG setup after FIPS settings, to allow non-dev FIPS to force it off, and add clause to FIPS v5 setup to do that.
* in FIPS v5 setup, add AES-XTS to the list of modes that forces -DWOLFSSL_AES_DIRECT -DHAVE_AES_ECB.

wolfcrypt/src/kdf.c: fix several benign -Wconversions.

wolfcrypt/test/test.c: add aes_cfb_test() and aes_xts_test() as top-level tests with separate "pass" messages, for transparency that those modes have indeed been tested in builds that activate them.
2024-02-09 00:46:54 -06:00
Daniel Pouzzner
7365c3c6ba Merge pull request #7215 from julek-wolfssl/openssh-workflow-update
Point openssh workflow to wolf master
2024-02-08 12:43:53 -05:00
David Garske
7e142583c6 Merge pull request #7221 from SparkiDev/thumb2_inline_asm_iar_fix
Thumbs inline ASM IAR: fix register clobber list
2024-02-07 13:30:41 -08:00
Sean Parkinson
fff4effe31 Thumbs inline ASM IAR: fix register clobber list
Change register clobber list so that it reserves the same registers for
constants regardless of WOLFSSL_NO_VAR_ASSIGN_REG.
2024-02-07 10:28:01 +10:00
Juliusz Sosinowicz
bdc0b80ddb Don't include unnecessary headers in public header file 2024-02-06 13:27:34 +01:00
Daniel Pouzzner
4d842f094e Merge pull request #7199 from lealem47/defaultASN
Default to ASN TEMPLATE library
2024-02-05 22:32:57 -05:00
Sean Parkinson
86b1aae218 Merge pull request #7209 from philljj/zd17416
Coverity issues: fix MD5 and SHA buffer overrun.
2024-02-06 08:58:27 +10:00
Lealem Amedie
d36bd47a27 For cppcheck: Explicitly initialize some variables 2024-02-05 15:09:05 -07:00
Daniel Pouzzner
48e40b8d8e Merge pull request #7201 from SparkiDev/sha256_aarch64_unaligned
SHA-256 Aarch64: fix alignments on loads and stores
2024-02-05 16:50:27 -05:00
Sean Parkinson
9060da42a6 Merge pull request #7211 from douzzer/20240203-linuxkm-fixes
20240203-linuxkm-fixes
2024-02-06 07:08:40 +10:00
Daniel Pouzzner
5c421d0207 Merge pull request #7178 from anhu/OQS_MEM_LEAKS
Fixes that prevent memory leaks when using OQS.
2024-02-05 13:26:43 -05:00
jordan
83169f91e9 Fix ShaFinal overrun. 2024-02-03 17:36:26 -06:00
Daniel Pouzzner
3a280e8295 linuxkm fixes:
linuxkm/linuxkm_wc_port.h: add fallback definition for static_assert() to support legacy kernels.
wolfcrypt/src/aes.c: fix AESNI runtime failure/fallback logic in wc_AesXtsSetKeyNoInit().
2024-02-03 13:46:45 -06:00
jordan
d111d7da1b Fix MD5 and SHA buffer overrun. 2024-02-02 19:50:22 -06:00
Daniel Pouzzner
851f059023 Merge pull request #7203 from julek-wolfssl/openssh-9.6
openssh 9.6p1 fixes
2024-02-02 19:51:55 -05:00
Daniel Pouzzner
866992151b Merge pull request #7208 from philljj/fix_ext_xmss_sigsleft
Fix ext_xmss sigsleft null deref.
2024-02-02 18:28:20 -05:00
Daniel Pouzzner
7823acbbde Merge pull request #7184 from JacobBarthelmeh/pkcs7-enc
PKCS7 streaming with encode/sign
2024-02-02 18:00:12 -05:00
jordan
13e427433c Fix ext_xmss sigsleft null deref. 2024-02-02 16:04:23 -06:00
JacobBarthelmeh
7592559fd3 rename argument, fix warnings on casts 2024-02-02 14:50:50 -07:00
David Garske
32aecf4c35 Merge pull request #7180 from douzzer/20240126-LINUXKM_LKCAPI_REGISTER
20240126-LINUXKM_LKCAPI_REGISTER
2024-02-02 11:12:35 -08:00
Juliusz Sosinowicz
be90fe073e tfm and integer: skip whitespace at end in radix read 2024-02-02 14:38:40 +01:00
Juliusz Sosinowicz
7ebb8cd007 Update radix tests 2024-02-02 12:09:50 +01:00
Sean Parkinson
c8b0aac144 SHA-256 Aarch64: fix alignments on loads and stores
Input buffer must be loaded with a byte alignment.
Fix other loads and stores to be consistent.
2024-02-02 12:41:12 +10: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
JacobBarthelmeh
c843064681 update macro guard 2024-02-01 11:50:51 -07:00
JacobBarthelmeh
75762d44b6 PKCS7 streaming with encode/sign 2024-02-01 11:50:51 -07:00
Juliusz Sosinowicz
335c51987e openssh 9.6p1 fixes
- wolfSSL_DSA_set0_key: allow setting just the public key
- radix16: allow skipping the end of line whitespace
- Add openssh action
2024-02-01 11:39:56 +01:00
Daniel Pouzzner
f9bf96d9ba Merge pull request #7187 from SparkiDev/sha256_intel_instrs
SHA-256: Implementation using Intel instructions
2024-01-31 19:15:43 -05:00
Daniel Pouzzner
1fda249468 Merge pull request #7189 from philljj/fix_static_nomalloc_build
Fix WOLFSSL_NO_MALLOC build.
2024-01-31 18:46:48 -05:00
Daniel Pouzzner
75bd1af110 Merge pull request #7179 from philljj/fix_ext_xmss_sigsleft
Fix ext_xmss SigsLeft.
2024-01-31 14:33:18 -05:00
Daniel Pouzzner
f228a85cee AES-XTS: fix FIPS gating to use defined(HAVE_FIPS), not defined(HAVE_FIPS_VERSION). 2024-01-30 17:16:37 -06:00
jordan
7ddf20851d Fix WOLFSSL_NO_MALLOC build. 2024-01-30 09:00:02 -06:00
Sean Parkinson
492490f7e6 SHA-256: Implementation using Intel instructions
Detects Intel SHA-256 instructions available for CPU.
Preferences implementation using Intel instructions.
2024-01-30 23:17:05 +10:00
Daniel Pouzzner
3d3c07944e wolfcrypt/src/ecc.c: fix logic around WOLF_CRYPTO_CB_ONLY_ECC in wc_ecc_shared_secret(), _ecc_make_key_ex(), wc_ecc_sign_hash(), and wc_ecc_verify_hash() (defects reported by -Wreturn-type, -Wmaybe-uninitialized around err, and a failure of ecc_onlycb_test()). 2024-01-29 22:30:33 -06:00
Daniel Pouzzner
67bbe1e1bb wolfcrypt/src/rsa.c: in wc_RsaFunction_ex(), if defined(WOLF_CRYPTO_CB_ONLY_RSA), add clause to return NO_VALID_DEVID if key->devId == INVALID_DEVID. fixes "control reaches end of non-void function" in PRB-single-flag.txt. 2024-01-29 22:00:20 -06:00
Daniel Pouzzner
11e8a89f67 wolfcrypt/src/aes.c: coddle XCode (clang) to clear frivolous -Wparentheses-equality. 2024-01-29 17:58:13 -06:00
Daniel Pouzzner
6261108d49 linuxkm: fix line lengths throughout; in linuxkm/lkcapi_glue.c: fix/harmonize error catching, reporting, and error codes; further address peer review feedback. 2024-01-29 17:48:31 -06:00
David Garske
de91add3d9 Merge pull request #7182 from SparkiDev/armv8_32_align_chacha20_asm
ARMv8 32 bit ChaCha20 ASM: loading from in/out
2024-01-29 14:59:56 -08:00
David Garske
de4a6f9e00 Merge pull request #7167 from SparkiDev/rsa_dec_check_d
RSA Decryption: check private value after decryption
2024-01-29 14:01:27 -08:00
David Garske
a6326bd80a Merge pull request #7183 from SparkiDev/regression_fixes_9
Regression testing fixes
2024-01-29 07:42:34 -08:00
David Garske
60de159707 Merge pull request #7176 from danielinux/iotsafe-sha384
IoT-Safe sha384+sha512 support
2024-01-29 07:35:50 -08:00
Sean Parkinson
13591dcae8 Regression testing fixes
internal.c: NO_CERT, privateKeySz not used.
./configure --disable-shared --disable-asn --disable-rsa --disable-ecc
--enable-psk

sp_int.c: fix when sp_gcm is available
./configure --disable-shared  --disable-shared --disable-ecc
--disable-dh --disable-aes --disable-aesgcm --disable-sha512
--disable-sha384 --disable-sha --disable-poly1305 --disable-chacha
--disable-md5 --disable-sha3 --enable-cryptonly --disable-inline
--enable-rsavfy --disable-asn --disable-oaep --disable-rng
--disable-filesystem --enable-sp=rsa2048 --disable-sp-asm
--enable-sp-math
2024-01-29 23:05:46 +10:00
Daniel Pouzzner
856c9a9a7f wolfcrypt/src/port/arm/armv8-aes.c: revert changes in a0415ce855. 2024-01-29 00:17:19 -06:00
Daniel Pouzzner
1fc67183a5 linuxkm: address peer review:
* support AES_ENCRYPTION_AND_DECRYPTION only if WC_AES_XTS_SUPPORT_SIMULTANEOUS_ENC_AND_DEC_KEYS is defined, and define it in linuxkm_wc_port.h if LINUXKM_LKCAPI_REGISTER.
* fix a typo in km_AesInitCommon().
* remove #if 0 code in lkcapi_glue.c.
2024-01-28 23:58:46 -06:00
Sean Parkinson
4585c6d508 ARMv8 32 bit ChaCha20 ASM: loading from in/out
Input and output buffers come from the application and are not
necessarily alighed.
Use instructions that allow unaligned access to these buffers.
2024-01-29 11:03:40 +10:00