20260713-WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED-etc#10920
Open
douzzer wants to merge 10 commits into
Open
Conversation
wolfssl/wolfcrypt/aes.h: if HAVE_FIPS && !WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED, make wc_AesGcmEncrypt() a WOLFSSL_LOCAL, and if !_WC_BUILDING_AES_C, add a WC_DEPRECATED() attribute to it. wolfssl/wolfcrypt/wc_compat.h, wolfssl/wolfcrypt/include.am, .wolfssl_known_macro_extras: add wc_compat.h: when HAVE_FIPS and !WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED, shim wc_AesGcmEncrypt() to remap it to FIPS-allowed APIs. wolfssl/wolfcrypt/types.h: at the end, #ifndef BUILDING_WOLFSSL, #include <wolfssl/wolfcrypt/wc_compat.h>, to assure transparent shimming of wc_AesGcmEncrypt() for all outside callers. wolfcrypt/src/evp.c, wolfcrypt/src/hpke.c, wolfcrypt/src/pkcs7.c, wolfcrypt/benchmark/benchmark.c, wolfcrypt/test/test.c, wolfssl/ssl.h: #include <wolfssl/wolfcrypt/wc_compat.h> to shim in-library/in-module calls to wc_AesGcmEncrypt(). src/internal.c: in TicketEncDec(), add const attributes to constable input args, and fix swapped out/in in calls to wc_AesGcmEncrypt(). tests/api/test_aes.c: in test_wc_AesGcmEncryptDecrypt(), skip longIV test if WC_TEST_AES_GCM_ENCRYPT_NO_NONSTD_IV (defined by wc_compat.h when needed). wolfssl/wolfcrypt/error-crypt.h, wolfssl/error-ssl.h, wolfcrypt/src/error.c, src/internal.c: * add FIPS_WRONG_API_E; * put several error codes back into sequence in wc_GetErrorString() switch(). * move wc_static_assert()s from headers to corresponding .c files, to eliminate dependency on wolfcrypt/types.h; * remove unneeded #include <wolfssl/wolfcrypt/types.h> from error-crypt.h.
…nd AES-XTS (AesGcmCrypt_1(), km_AesXtsEncrypt(), and km_AesXtsDecrypt()), bypass FIPS wrappers to avoid frivolous overhead, with decisive check after looping by the Final function.
…I, and intel_flags (3f3ebca / wolfSSL#10871) to avoid frivolous atomic access overhead. Also use regular int, not cpuid_flags_atomic_t, for cpuid_flags in the WOLFSSL_ARMASM path, and similarly use a regular int for aes_ppc64_use_crypto in the WOLFSSL_PPC64_ASM_CRYPTO path.
…l_known_macro_extras: * also inhibit recursive evaluation midway through random.h, fips.h, and fips_test.h (circular dependencies). * add WC_FIPS_ENUM_CAST_ID_DEFINED to allow detection of fips_test.h incomplete evaluation.
* add missing null key checks to wc_ed25519_verify_msg_init(), wc_ed25519_verify_msg_update(), and wc_ed25519_verify_msg_final(). * add WC_ARG_NOT_NULL() attributes to args of static functions as appropriate. * add FIPS >v6 gates to new null key tests and a new invalid hash size test in test_wc_ed25519_sign_verify_ctx_ph() and test_wc_ed25519_verify_streaming().
…istant asymmetric algorithms (default: disabled)".
|
…h> where previously #include <wolfssl/wolfcrypt/types.h>, to retain standalone compilability without provoking circular dependencies via wc_compat.h.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10920
Contributor
Author
|
Retest this please |
Contributor
|
Retest this please Jenkins. CAVP self test failed |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10920
Scan targets checked: linuxkm-bugs, linuxkm-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
No new issues found in the changed files. ✅
…at_shim(), restore aes->reg to the supplied IV after wc_AesGcmEncrypt_ex() increments it, supporting the EVP access pattern.
Contributor
Author
|
retest this please |
JacobBarthelmeh
approved these changes
Jul 16, 2026
Contributor
|
Needs fully reviewed for being allowed with FIPS use before merged. |
ejohnstown
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement FIPS shimming for
wc_AesGcmEncrypt():wolfssl/wolfcrypt/aes.h: ifHAVE_FIPS&& !WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED, makewc_AesGcmEncrypt()aWOLFSSL_LOCAL, and if !_WC_BUILDING_AES_C, add aWC_DEPRECATED()attribute to it.wolfssl/wolfcrypt/wc_compat.h,wolfssl/wolfcrypt/include.am, .wolfssl_known_macro_extras: addwc_compat.h: whenHAVE_FIPSand !WC_FIPS_AESGCM_ONE_SHOT_EXT_IV_ALLOWED, shimwc_AesGcmEncrypt()to remap it to FIPS-allowed APIs.wolfssl/wolfcrypt/types.h: at the end,#ifndefBUILDING_WOLFSSL,#include <wolfssl/wolfcrypt/wc_compat.h>, to assure transparent shimming ofwc_AesGcmEncrypt()for all outside callers.wolfcrypt/src/evp.c,wolfcrypt/src/hpke.c,wolfcrypt/src/pkcs7.c,wolfcrypt/benchmark/benchmark.c,wolfcrypt/test/test.c,wolfssl/ssl.h:#include <wolfssl/wolfcrypt/wc_compat.h>to shim in-library/in-module calls towc_AesGcmEncrypt().src/internal.c: inTicketEncDec(), addconstattributes toconstable input args, and fix swapped out/in in calls towc_AesGcmEncrypt().tests/api/test_aes.c: intest_wc_AesGcmEncryptDecrypt(), skiplongIVtest ifWC_TEST_AES_GCM_ENCRYPT_NO_NONSTD_IV(defined bywc_compat.hwhen needed).wolfssl/wolfcrypt/error-crypt.h,wolfssl/error-ssl.h,wolfcrypt/src/error.c,src/internal.c:FIPS_WRONG_API_E;wc_GetErrorString()switch().wc_static_assert()s from headers to corresponding .c files, to eliminate dependency onwolfcrypt/types.h;#include <wolfssl/wolfcrypt/types.h>fromerror-crypt.h.linuxkm/lkcapi_aes_glue.c: in the inner streaming loops for AES-GCM and AES-XTS (AesGcmCrypt_1(),km_AesXtsEncrypt(), andkm_AesXtsDecrypt()), bypass FIPS wrappers to avoid frivolous overhead, with decisive check after looping by the Final function.wolfcrypt/src/aes.c: revert atomic refactor ofcheckedAESNI,haveAESNI, andintel_flags(3f3ebca / #10871) to avoid frivolous atomic access overhead. Also use regularint, notcpuid_flags_atomic_t, forcpuid_flagsin theWOLFSSL_ARMASMpath, and similarly use a regularintforaes_ppc64_use_cryptoin theWOLFSSL_PPC64_ASM_CRYPTOpath.wolfssl/wolfcrypt/wc_compat.h,wolfssl/wolfcrypt/fips_test.h,.wolfssl_known_macro_extras:random.h,fips.h, andfips_test.h(circular dependencies).WC_FIPS_ENUM_CAST_ID_DEFINEDto allow detection offips_test.hincomplete evaluation.wolfcrypt/src/ed25519.c,tests/api/test_ed25519.c:wc_ed25519_verify_msg_init(),wc_ed25519_verify_msg_update(), andwc_ed25519_verify_msg_final().WC_ARG_NOT_NULL()attributes to args of static functions as appropriate.test_wc_ed25519_sign_verify_ctx_ph()andtest_wc_ed25519_verify_streaming().configure.ac: add--enable-all-quantum-crypto"Enable all quantum-resistant asymmetric algorithms (default: disabled)".tested in conjunction with FIPS 20260508-wrapper-signature-harmony and WolfGuard 20260713-wc_AesGcmEncrypt_fips using