Commit Graph

8030 Commits

Author SHA1 Message Date
David Garske
340aed5498 Fix for crypto callbacks to allow invalid devId for non _ex single shot hash functions. 2024-01-10 15:33:10 -08:00
Sean Parkinson
08aa39f538 Merge pull request #7094 from dgarske/armasm_thumb_aes
Fixes for ARM ASM with Thumb
2024-01-07 15:10:16 +10:00
David Garske
9e28d5010c Fixes for ARM ASM with Thumb. Fix for AES ECB build with Thumb. Add alignment to thumb2 AES tables. Refactor alignment macros and expose generic alignment macro XALIGNED. The WOLFSSL_USE_ALIGN still controls alignment enablement in wolfSSL/wolfCrypt. ZD 17225 and ZD 17226 2024-01-05 08:16:02 -08:00
Daniel Pouzzner
7f53bcc4d0 fixes for clang-tidy reported defects and misstylings --with-liboqs:
* readability-named-parameter (style)
* bugprone-sizeof-expression (true bugs)
* clang-analyzer-deadcode.DeadStores (true bugs)
* clang-analyzer-core.NonNullParamChecker (true bug)
* clang-diagnostic-newline-eof (style)
* clang-diagnostic-shorten-64-to-32 (true but benign in practice)

fixes for sanitizer reported defects --with-liboqs: null pointer memcpy()s in TLSX_KeyShare_GenPqcKey() and server_generate_pqc_ciphertext().

fixes for silent crypto-critical failure in wolfSSL_liboqsGetRandomData(): refactor to accommodate oversize numOfBytes, and abort() if wc_RNG_GenerateBlock() returns failure.
2024-01-04 15:57:09 -06:00
Tobias Frauenschläger
3fbbc7c1bb Fix implicit conversion.
Fix implicit type conversion from size_t to word32 in liboqs.c source
file to make it build with clang.

Fixes #7108.

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2024-01-04 16:55:19 +01:00
Daniel Pouzzner
bcfaf0372c Merge pull request #7026 from Frauschi/liboqs
Improve liboqs integration
2024-01-03 16:20:26 -05:00
Sean Parkinson
52db533d9b Merge pull request #7106 from bandi13/20231114-codesonar-fixes
20231114 codesonar fixes
2024-01-04 07:16:33 +10:00
Daniel Pouzzner
7e60b029c2 Merge branch 'master' into liboqs 2024-01-03 15:56:05 -05:00
Andras Fekete
b206e074fc Uninitialized Variable
Warning 545067.3236517
2024-01-03 09:59:18 -05:00
Andras Fekete
f5c3fcfec4 Uninitialized variable
Warning 581107.3236416
2024-01-03 09:59:18 -05:00
Andras Fekete
f00c5eb95d Fix double free
Warning 546055.3229451
2024-01-03 09:59:18 -05:00
jordan
e175004f85 Fix Infer Uninitialized Values. 2024-01-02 12:16:20 -06:00
Daniel Pouzzner
c8188eaabd Merge pull request #7100 from philljj/zd17237
Fix uninitialized keyUsage in DecodeKeyUsage.
2024-01-02 01:51:45 -05:00
Daniel Pouzzner
b17ec3b4bc cppcheck-2.13.0 mitigations peer review:
* add explanation in DoSessionTicket() re autoVariables.
* re-refactor ECC_KEY_MAX_BITS() in ecc.c to use two separate macros, ECC_KEY_MAX_BITS() with same definition as before, and ECC_KEY_MAX_BITS_NONULLCHECK().
* in rsip_vprintf() use XVSNPRINTF() not vsnprintf().
* in types.h, fix fallthrough definition of WC_INLINE macro in !NO_INLINE cascade to be WC_MAYBE_UNUSED as it is when NO_INLINE.
2023-12-28 16:38:47 -06:00
Daniel Pouzzner
44b18de704 fixes for cppcheck-2.13.0 --force:
* fix null pointer derefs in wc_InitRsaKey_Id() and wc_InitRsaKey_Label() (nullPointerRedundantCheck).
* fix use of wrong printf variant in rsip_vprintf() (wrongPrintfScanfArgNum).
* fix wrong printf format in bench_xmss_sign_verify() (invalidPrintfArgType_sint).
* add missing WOLFSSL_XFREE_NO_NULLNESS_CHECK variants of XFREE() (WOLFSSL_LINUXKM, FREESCALE_MQX, FREESCALE_KSDK_MQX).
* suppress false-positive uninitvar on "limit" in CheckTLS13AEADSendLimit().
* suppress true-but-benign-positive autoVariables in DoClientHello().
* in wolfcrypt/src/ecc.c, refactor ECC_KEY_MAX_BITS() as a local function to resolve true-but-benign-positive identicalInnerCondition.
* refactor flow in wc_ecc_sign_hash_ex() to resolve true-but-benign-positive identicalInnerCondition.
2023-12-28 15:06:21 -06:00
jordan
46bf30ca77 Fix uninitialized keyUsage in DecodeKeyUsage. 2023-12-27 22:58:52 -06:00
Daniel Pouzzner
457188f55e Merge pull request #7070 from dgarske/cryptocb_moreinfo
Fixes for TLS with crypto callbacks
2023-12-27 18:55:56 -05:00
David Garske
1c4d7285d3 Add documentation for HKDF functions. Improve param comments for devId. 2023-12-27 13:56:40 -08:00
lealem47
fc3977fc77 Merge pull request #7098 from dgarske/stm32_pka
Fixes for STM32 PKA
2023-12-27 14:36:53 -07:00
David Garske
c37edb09f7 Fix STM32 PKA V2 (STM32U5) point multiply missing order/coefB. 2023-12-27 11:37:16 -08:00
David Garske
0d057099af Fix line lengths. 2023-12-27 10:12:52 -08:00
David Garske
3a798e148b Fix STM32 PKA ECC cast warning. 2023-12-27 09:57:40 -08:00
David Garske
b86dfffdbe Improve the TLS v1.3 expand key label warning for possible use of uninitialized "hash". 2023-12-27 09:52:56 -08:00
Daniel Pouzzner
8a32e7f3f9 fixes for clang -Wunreachable-code-aggressive:
tests/suites.c: in SuiteTest(), swap order of (void)s and return.

wolfcrypt/src/chacha.c: gate out unreachable C wc_Chacha_encrypt_bytes() call in wc_Chacha_Process, and gate out unused implementations of wc_Chacha_wordtobyte() and wc_Chacha_encrypt_bytes(), when defined(USE_INTEL_CHACHA_SPEEDUP).

wolfcrypt/src/sha256.c and wolfcrypt/src/sha512.c: fix logic in Sha256_SetTransform() and Sha512_SetTransform() to make the AVX1_RORX implementations accessible.  also add a missing Transform_Sha512_Len_p = NULL in the C path of Sha512_SetTransform().

wolfssl/internal.h: for the fallback definition of wolfSSL_curve_is_disabled, use an inline function instead of a compound-clause macro, because clang isn't smart enough to treat the compound expression as a bare constant zero, producing a lame-positive -Wunreachable-code.
2023-12-25 00:23:37 -06:00
David Garske
d9ac8b5422 Peer review fixes. Fix issues with Tls13HKDFExpandKeyLabel. Fix crypto callback line lengths. 2023-12-22 14:16:59 -08:00
Daniel Pouzzner
59cdd5c70f Merge pull request #7082 from bandi13/ARIA_Sign_fix
Aria sign fix
2023-12-21 19:01:54 -05:00
Sean Parkinson
f77f7c70d3 Merge pull request #7018 from dgarske/ti_aes
Fixes for TI AES and SHA
2023-12-22 07:55:00 +10:00
Andras Fekete
b5592c4571 Addressing PR comments 2023-12-21 16:48:15 -05:00
Sean Parkinson
00c9625ab8 Merge pull request #7081 from gojimmypi/PR-Espressif-ESP32-C2
Add wolfcrypt SHA support for ESP32-C2/ESP8684, other minor updates
2023-12-22 07:23:51 +10:00
Sean Parkinson
a5a2b3752d Merge pull request #7077 from gojimmypi/PR-Espressif-threads
wolfSSL_NewThread() type update for Espressif FreeRTOS
2023-12-22 07:22:33 +10:00
David Garske
00f196d497 Fix for invalid dh_ffdhe_test test with even P when using Intel QuickAssist. 2023-12-20 11:30:17 -08:00
Andras Fekete
77e8a66ca3 Not cryptocb's job to sanity check input
Don't need to check parameters at every level
2023-12-19 15:55:38 -05:00
Andras Fekete
12192b7683 Set result to invalid as first step 2023-12-19 15:54:25 -05:00
Andras Fekete
f45ffd8802 Rename variable to keep the names similar across functions 2023-12-19 15:37:58 -05:00
Andras Fekete
9e974027a8 Fix ARIA signing
Used the wrong function to extract key
2023-12-19 15:33:28 -05:00
David Garske
fb5eab8f79 Fix one shot hash routines to attempt offloading to crypto callbacks. Fix random.c health test to use devId. Fix FIPS unused "ssl". 2023-12-19 11:20:56 -08:00
David Garske
2001d1c74b Fixes for TLS v1.3 with crypto callbacks not offloading DeriveKeyMsg, KDF HMAC and ECH. 2023-12-19 08:15:58 -08:00
gojimmypi
07a5566c52 Add wolfcrypt SHA support for ESP32-C2, other minor updates 2023-12-18 17:35:43 -08:00
David Garske
90748b5f61 Remove the SHA1-/SHA2-256 auto devId selection devId = wc_CryptoCb_GetDevIdAtIndex(0); 2023-12-18 17:14:58 -08:00
David Garske
8b203719d3 Add support for using devId with one-shot hash functions. 2023-12-18 17:14:43 -08:00
David Garske
d5e83310b6 Fix typo with HMAC determination of update/final. 2023-12-18 17:11:33 -08:00
David Garske
205403ebb2 Add more information in the DEBUG_CRYPTOCB. 2023-12-18 17:11:16 -08:00
gojimmypi
da644c7be3 wolfSSL_NewThread() type update for Espressif FreeRTOS 2023-12-17 11:59:42 -08:00
Tobias Frauenschläger
0780fd9719 liboqs: add RNG support for sphincs
Added a RNG argument to the wc_sphincs_sign_msg method to properly
generate necessary random data using the desired WolfSSL RNG object.

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2023-12-16 12:40:26 +01:00
Tobias Frauenschläger
85c40b1728 liboqs: add RNG support for falcon
Added a RNG argument to the wc_falcon_sign_msg method to properly
generate necessary random data using the desired WolfSSL RNG object.

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2023-12-16 12:40:26 +01:00
Tobias Frauenschläger
ec86a86096 liboqs: add RNG support for dilithium
Added a RNG argument to the wc_dilithium_sign_msg method to properly
generate necessary random data using the desired WolfSSL RNG object.

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2023-12-16 12:40:26 +01:00
Tobias Frauenschläger
755c385b1f Liboqs: use WolfSSL RNG
Improve the interface to liboqs by properly configuring and using the
RNG provided by WolfSSL from within liboqs.

Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
2023-12-16 12:40:25 +01:00
Daniel Pouzzner
ef14176b7f SRTP fixes:
* in wolfssl/ssl.h, add missing arg names to wolfSSL_CTX_set_tlsext_use_srtp(), wolfSSL_set_tlsext_use_srtp(), and wolfSSL_export_dtls_srtp_keying_material();
* in wolfcrypt/src/kdf.c, call wc_AesFree if and only if wc_AesInit() succeeded;
* in src/ssl.c:DtlsSrtpSelProfiles(), fix bugprone-inc-dec-in-conditions;
* in tests/suites.c:execute_test_case(), fix several -Wdeclaration-after-statement and -Wmissing-field-initializers;
* in wolfcrypt/test/test.c, fix a shiftTooManyBitsSigned warning in srtpkdf_test(), and fix a typo (kaSz/ksSz).
2023-12-15 14:06:36 -06:00
David Garske
4b771a9b28 Document new macro and rename to: NO_TIME_SIGNEDNESS_CHECK 2023-12-14 13:58:29 -08:00
Chris Conlon
27c6ee4d05 Merge pull request #7068 from SparkiDev/srtp_kdf_label
SRTP/SRTCP KDF: add APIs that derives one key from a label
2023-12-14 14:54:58 -07:00