From 4bd0658ce5c2b04d87f854dc037f7e10eb34a462 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Tue, 10 Mar 2026 23:00:45 +0100 Subject: [PATCH] Automatically turn on LMS / XMSS full hash When WOLFSSL_NO_HASH_RAW is definied due to hardware hash offload, turn on LMS anx XMSS full hash. Without this they will not compile automatically when there is hardware SHA acceleration. --- wolfssl/wolfcrypt/wc_lms.h | 6 ++++++ wolfssl/wolfcrypt/wc_xmss.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/wolfssl/wolfcrypt/wc_lms.h b/wolfssl/wolfcrypt/wc_lms.h index 8726a7b4cb..18a13c8697 100644 --- a/wolfssl/wolfcrypt/wc_lms.h +++ b/wolfssl/wolfcrypt/wc_lms.h @@ -95,6 +95,12 @@ #include #include +/* When hash struct internals are not accessible (hardware SHA acceleration), + * fall back to full hash API calls. */ +#if defined(WOLFSSL_NO_HASH_RAW) && !defined(WC_LMS_FULL_HASH) + #define WC_LMS_FULL_HASH +#endif + #ifdef WOLFSSL_LMS_MAX_LEVELS /* Maximum number of levels of trees supported by implementation. */ #define LMS_MAX_LEVELS WOLFSSL_LMS_MAX_LEVELS diff --git a/wolfssl/wolfcrypt/wc_xmss.h b/wolfssl/wolfcrypt/wc_xmss.h index db7ba44167..c9b4265805 100644 --- a/wolfssl/wolfcrypt/wc_xmss.h +++ b/wolfssl/wolfcrypt/wc_xmss.h @@ -34,6 +34,12 @@ #include #include +/* When hash struct internals are not accessible (hardware SHA acceleration), + * fall back to full hash API calls. */ +#if defined(WOLFSSL_NO_HASH_RAW) && !defined(WC_XMSS_FULL_HASH) + #define WC_XMSS_FULL_HASH +#endif + #if !defined(WOLFSSL_WC_XMSS) #error "This code is incompatible with external implementation of XMSS." #endif