Commit Graph

562 Commits

Author SHA1 Message Date
gojimmypi
62c0910e15 sync w/upstream; resolve merge conflict 2023-12-08 09:06:10 -08:00
gojimmypi
f3a9d4a56e Espressif Benchmark ESP-IDF 4.4 fixes 2023-12-06 13:23:14 -08:00
gojimmypi
4bd78e5e31 Espressif benchmark update 2023-12-06 12:43:42 -08:00
gojimmypi
ca1eba0919 Espressif wolfcrypt updates 2023-12-06 10:05:31 -08:00
jordan
3158e04863 Add missing wc_AesInit calls. 2023-11-29 12:54:28 -06:00
JacobBarthelmeh
12ee732fe2 Merge pull request #6981 from douzzer/20231102-vector-register-dynamic-fallback-aes
20231102-vector-register-dynamic-fallback-aes
2023-11-28 13:15:02 -07:00
Lealem Amedie
64b98981de Fix for g++ 2023-11-17 16:44:24 -07:00
Lealem Amedie
a95a7c7e08 One last missing cast 2023-11-17 13:55:49 -07:00
Lealem Amedie
ca195445a3 Add proper casts 2023-11-17 13:33:34 -07:00
Lealem Amedie
07d6d75d72 Fix for sanitizer finds 2023-11-17 13:28:30 -07:00
Daniel Pouzzner
a10260ca5f refactor AESNI implementations and *VECTOR_REGISTERS* macros to allow dynamic as-needed fallback to pure C, via WC_AES_C_DYNAMIC_FALLBACK.
wolfssl/wolfcrypt/aes.h: add key_C_fallback[] to struct Aes, and remove comment that "AESNI needs key first, rounds 2nd, not sure why yet" now that AES_128_Key_Expansion_AESNI no longer writes rounds after the expanded key.

wolfcrypt/src/aes.c:
* add _AESNI or _aesni suffixes/infixes to AESNI implementations that were missing them: AES_CBC_encrypt(), AES_CBC_decrypt_by*(), AES_ECB_encrypt(), AES_*_Key_Expansion(), AES_set_encrypt_key(), AES_set_decrypt_key(), AES_GCM_encrypt(), AES_GCM_decrypt(), AES_XTS_encrypt(), and AES_XTS_decrypt().
* move key size check from to start of wc_AesSetKeyLocal().
* refactor pure-C AES setkey and cipher implementations to use aes->key_C_fallback when defined(WC_AES_C_DYNAMIC_FALLBACK).
* refactor wc_AesSetKeyLocal() to set up both AESNI and pure-C expanded keys when defined(WC_AES_C_DYNAMIC_FALLBACK).
* refactor all (haveAESNI && aes->use_aesni) conditions to just (aes->use_aesni).
* add macros VECTOR_REGISTERS_PUSH and VECTOR_REGISTERS_POP, which do nothing but push a brace level when !defined(WC_AES_C_DYNAMIC_FALLBACK), but when defined(WC_AES_C_DYNAMIC_FALLBACK), they call SAVE_VECTOR_REGISTERS2() and on failure, temporarily clear aes->use_aesni and restore at _POP().
* refactor all invocations of SAVE_VECTOR_REGISTERS() and RESTORE_VECTOR_REGISTERS() to VECTOR_REGISTERS_PUSH and VECTOR_REGISTERS_POP, except in wc_AesSetKeyLocal(), wc_AesXtsEncrypt(), and wc_AesXtsDecrypt(), which are refactored to use SAVE_VECTOR_REGISTERS2(), with graceful failure concealment if defined(WC_AES_C_DYNAMIC_FALLBACK).
* orthogonalize cleanup code in wc_AesCbcEncrypt(),  wc_AesCcmEncrypt() and wc_AesCcmDecrypt().
* streamline fallthrough software definitions of wc_AesEncryptDirect() and wc_AesDecryptDirect(), and remove special-casing for defined(WOLFSSL_LINUXKM)&&defined(WOLFSSL_AESNI).

wolfcrypt/src/aes_asm.{S,asm}:
* remove errant "movl $10, 240(%rsi)" from AES_128_Key_Expansion_AESNI.
* add _AESNI suffixes/infixes to implementations that needed them.

wolfcrypt/src/{aes_gcm_asm.{S,asm},aes_xts_asm.S}: regenerate from revisions in scripts#357 -- adds _aesni suffixes to implementations that were missing them.

wolfssl/wolfcrypt/types.h: remove DEBUG_VECTOR_REGISTER_ACCESS macros, and add dummy fallthrough definitions for SAVE_VECTOR_REGISTERS2 and WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL.

wolfssl/wolfcrypt/memory.h: adopt DEBUG_VECTOR_REGISTER_ACCESS code from types.h, and add definitions for WC_DEBUG_VECTOR_REGISTERS_RETVAL_INITVAL and WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL.

linuxkm/linuxkm_wc_port.h: add arch-specific macro definitions for SAVE_VECTOR_REGISTERS2().

wolfcrypt/benchmark/benchmark.c: add missing gates around calls to RESTORE_VECTOR_REGISTERS().

configure.ac:
* cover various interdependencies in enable-all/enable-all-crypto, for better behavior in combination with --disable-aesgcm, --disable-ecc, --disable-ocsp, --disable-hmac, --disable-chacha, --disable-ed25519, and --disable-ed448.
* inhibit aesgcm_stream in enable-all/enable-all-crypto when ENABLED_LINUXKM_DEFAULTS, because it is currently incompatible with WC_AES_C_DYNAMIC_FALLBACK.
* add -DWC_AES_C_DYNAMIC_FALLBACK when ENABLED_LINUXKM_DEFAULTS.
* add 3 new interdependency checks: "ECCSI requires ECC.", "SAKKE requires ECC.", "WOLFSSH requires HMAC."

wolfcrypt/src/asn.c: tweak gating to accommodate defined(NO_RSA) && !defined(HAVE_ECC).

wolfcrypt/src/evp.c: tweak gating to accommodate defined(NO_HMAC).

wolfcrypt/src/logging.c: remove DEBUG_VECTOR_REGISTER_ACCESS code (moved to memory.c).

wolfcrypt/src/memory.c: change #include of settings.h to types.h; adopt DEBUG_VECTOR_REGISTER_ACCESS code from logging.c; add implementation of SAVE_VECTOR_REGISTERS2_fuzzer().

wolfcrypt/src/pwdbased.c: add explanatory #error scrypt requires HMAC.

wolfcrypt/test/test.c:
* add DEBUG_VECTOR_REGISTER_ACCESS clauses to aes_xts_128_test(), aesecb_test(), aesctr_test(), aes_test() CBC section, aes256_test() CBC section, and aesgcm_default_test_helper()
* remove duplicate wc_AesEcbDecrypt() in aesecb_test().
* add gating for pbkdf2_test().
* fix cleanup code in dsa_test().
* fix gating in pkcs7authenveloped_run_vectors() to accommodate !defined(HAVE_AESGCM).
* fix gating in cryptocb_test() to accommodate defined(NO_HMAC).

wolfssl/wolfcrypt/cryptocb.h: remove gates around "pk" sub-struct of struct wc_CryptoInfo -- wc_CryptoInfo.pk.type (an int) is used unconditionally when --enable-debug, and is used with DH.

wolfssl/wolfcrypt/error-crypt.h: fix whitespace.
2023-11-17 01:15:28 -06:00
Lealem Amedie
2c7248492f Rename macro 2023-11-15 10:27:24 -07:00
Lealem Amedie
ac89c90afd Add RESET_MULTI_VALUE_STATS_VARS macro 2023-11-15 10:26:03 -07:00
Lealem Amedie
b464a277c1 Refactor logic to remove MAX_SAMPLE_RUNS 2023-11-13 13:40:07 -07:00
Lealem Amedie
138d699cc7 Apply changes to new srtp-kdf code 2023-11-08 11:09:00 -07:00
Lealem Amedie
c0f3fe4434 Benchmarks: use clock_gettime() for ns resolution 2023-11-08 10:45:51 -07:00
Lealem Amedie
2cde843093 Measure max & min durations within the confines of MAX_SAMPLE_RUNS 2023-11-08 10:45:51 -07:00
Lealem Amedie
1303c0512c Extract some code blocks into macros 2023-11-08 10:45:51 -07:00
Lealem Amedie
46a5465c3f Remove redundant macro 2023-11-08 10:45:51 -07:00
Lealem Amedie
16ecc9b5f8 Address feedback and don't print avg ms if mean is displayed 2023-11-08 10:45:51 -07:00
Lealem Amedie
86a2b050fe Gate on NO_FILESYSTEM 2023-11-08 10:45:50 -07:00
Lealem Amedie
a40de50be2 Add ADVANCED_STATS in benchmark.c 2023-11-08 10:45:50 -07:00
Lealem Amedie
9006dd5edd Document new macro 2023-11-08 10:45:50 -07:00
Lealem Amedie
2ea0c2cae8 Run benchmarks at microsecond level 2023-11-08 10:45:50 -07:00
JacobBarthelmeh
8921a720a1 Merge pull request #6888 from SparkiDev/srtp_kdf
SRTP/SRTCP KDF: add implementation
2023-11-07 10:11:43 -07:00
Sean Parkinson
8c3e1dbf48 SRTP/SRTCP KDF: add implementation
Add implementation of SRTP KDF and SRTCP KDF.
One shot APIs compatible with SP 800-135 and ACVP testing.
Tests added to test.c.
Benchmarking added.
Doxygen added.
2023-11-07 10:33:14 +10:00
Andras Fekete
42c241dbbf Avoid use of uninitialized array 2023-10-27 15:38:46 -04:00
jordan
46b1a030a7 XMSS/XMSSMT hooks support: fix g++ warnings, and small cleanup for review. 2023-10-13 18:01:07 -05:00
jordan
60fea5ee5c XMSS/XMSSMT hooks support: small update for requested changes. 2023-10-11 21:29:45 -05:00
jordan
33d4b331fb Add XMSS/XMSSMT wolfCrypt hooks. 2023-10-05 09:18:50 -05:00
Chris Conlon
5bc5b8a99b Merge pull request #6768 from miyazakh/renesas_rz
Renesas RZN2L support
2023-09-19 14:38:03 -06:00
Hideki Miyazaki
5e97b9fde8 addressed review comments 2023-09-15 13:22:35 +09:00
JacobBarthelmeh
624cb5e2bb Merge pull request #6744 from res0nance/windows-benchmark-config
windows: fix x64 benchmark release builds
2023-09-13 15:52:27 -06:00
Hideki Miyazaki
1c9afb8b12 initial commit for RZN2L board Support 2023-09-13 09:22:55 +09:00
jordan
b36c312ef3 LMS verify-only support: fix clang warning, rename define. 2023-08-31 21:46:00 -05:00
res0nance
3dec8279a0 windows: fix x64 benchmark release builds
The linker should use the x64 option for 64-bit builds
2023-08-31 20:02:37 +08:00
jordan
8662312ecf LMS verify only support. 2023-08-29 15:46:18 -05:00
David Garske
88ad5ce6b0 Merge pull request #6607 from SparkiDev/curve25519_thumb2
Thumb2 ASM, Curve25519
2023-08-24 08:29:54 -07:00
Sean Parkinson
36b92a4cef Thumb2 ASM, Curve25519
Add support for compiling ASM for Thumb2
Add Curve25519 ASM for Thumb2
Limit assembly code compiled when Ed25519 not required.
Rework all assembly implementations to replace ge_*() functions instead
of having fe_ge_*() versions that take many parameters.
Get ARM32 inline asm working.
2023-08-24 17:43:03 +10:00
Anthony Hu
1608cb8b45 More ating on HAVE_SPHINCS in benchmarks 2023-08-23 14:03:22 -04:00
jordan
779b87f03a Tiny cleanup to benchmark print usage. 2023-08-10 09:47:07 -05:00
Juliusz Sosinowicz
67d6d438c5 Port testing to wolfSSL threading interface 2023-08-04 10:49:39 +02:00
billphipps
10adca1a45 Add CryptoCb features (#6636)
* Update to support invoking cryptocb during un/register.
2023-07-27 13:16:43 -07:00
JacobBarthelmeh
1285ae7816 Merge pull request #6506 from DimitriPapadopoulos/codespell
Fix typos found by codespell
2023-07-24 10:34:29 -06:00
JacobBarthelmeh
8065ba18f9 Merge pull request #6620 from douzzer/20230714-WC_DO_NOTHING
20230714-WC_DO_NOTHING
2023-07-18 17:04:02 -06:00
JacobBarthelmeh
a026d843cf Merge pull request #6564 from philljj/add_lms_hooks
Add LMS/HSS wolfCrypt hooks.
2023-07-14 14:33:25 -06:00
jordan
a747e7773c LMS: comments, SMALL_STACK, cleanup, etc. 2023-07-14 11:27:59 -05:00
Daniel Pouzzner
f6f8d2eda3 add WC_DO_NOTHING macro to wolfssl/wolfcrypt/types.h, with default expansion "do {} while (0)", and globally refactor to use the macro where appropriate, annotating intended-null macros-with-args with "/* null expansion */";
tweak several #includes of settings.h to include types.h instead (all of these are for clarity, as types.h is indirectly included by later #includes), and add #include <wolfssl/wolfcrypt/types.h> where missing;

remove trailing semicolons from PRAGMA*() macro invocations as they are unneeded and can be harmful (inducing frivolous -Wdeclaration-after-statement etc.).
2023-07-14 09:50:01 -05:00
Iyán Méndez Veiga
7c14ea67ae Rename sphincs algs to follow upstream
This also adds new keys for SPHINCS+. The reason is that SPHINCS+
was updated to 3.1 in liboqs (open-quantum-safe/liboqs/pull/1420),
and old keys are incompatible with the new implementation.

Keys were generated using the oqs-provider for OpenSSL 3

openssl genpkey \
    -provider default -provider oqsprovider \
    -algorithm sphincsshake128fsimple \
    -outform der \
    -out bench_sphincs_fast_level1_key.der

And certs_test.h was updated using xxd

xxd -i -c 10 -u bench_sphincs_fast_level1_key.der

This was repeated for the 6 variants of SPHINCS+ that wolfSSL supports.
2023-07-10 18:31:07 +02:00
jordan
55bbd5865c LMS/HSS: cleanup, and safer write/read callbacks 2023-07-07 15:30:50 -05:00