Repository navigation
Build fixes for XMSS_VERIFY_ONLY and FIPS v7+ #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -912,7 +912,9 @@ int wolfCLU_sign_data_dilithium (byte* data, char* out, word32 dataSz, char* pri | |
|
|
||
| int wolfCLU_sign_data_xmss(byte* data, char* out, int fSz, char* privKey) | ||
| { | ||
| #ifdef WOLFSSL_HAVE_XMSS | ||
| /* Signing needs wc_XmssKey_Sign() and the private key callbacks, none of | ||
| * which exist in a verify-only wolfSSL build. */ | ||
| #if defined(WOLFSSL_HAVE_XMSS) && !defined(WOLFSSL_XMSS_VERIFY_ONLY) | ||
| int ret = 0; | ||
| int fExtSz = 5; /* size of ".priv" */ | ||
| XFILE outFile = NULL; /* output file */ | ||
|
|
@@ -1080,12 +1082,12 @@ int wolfCLU_sign_data_xmss(byte* data, char* out, int fSz, char* privKey) | |
| (void)privKey; | ||
|
|
||
| return NOT_COMPILED_IN; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOW-3: Sign in a verify-only build fails with only a bare error code, unlike genkey [NIT] (question) In a verify-only build, Code: Recommendation: Either keep the silent behavior to match the sibling sign stubs, or add the same one-line verify-only error to both XMSS sign stubs so genkey and sign behave the same way. |
||
| #endif /* WOLFSSL_HAVE_XMSS */ | ||
| #endif /* WOLFSSL_HAVE_XMSS && !WOLFSSL_XMSS_VERIFY_ONLY */ | ||
| } | ||
|
|
||
| int wolfCLU_sign_data_xmssmt(byte* data, char* out, int fSz, char* privKey) | ||
| { | ||
| #ifdef WOLFSSL_HAVE_XMSS | ||
| #if defined(WOLFSSL_HAVE_XMSS) && !defined(WOLFSSL_XMSS_VERIFY_ONLY) | ||
| int ret = 0; | ||
| int fExtSz = 5; /* size of ".priv" */ | ||
| XFILE outFile = NULL; /* output file */ | ||
|
|
@@ -1274,7 +1276,7 @@ int wolfCLU_sign_data_xmssmt(byte* data, char* out, int fSz, char* privKey) | |
| (void)privKey; | ||
|
|
||
| return NOT_COMPILED_IN; | ||
| #endif /* WOLFSSL_HAVE_XMSS */ | ||
| #endif /* WOLFSSL_HAVE_XMSS && !WOLFSSL_XMSS_VERIFY_ONLY */ | ||
| } | ||
|
|
||
| #endif /* !WOLFCLU_NO_FILESYSTEM */ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,10 +147,12 @@ int wolfCLU_genKey_ML_DSA(WC_RNG* rng, char* fName, int directive, int fmt, | |
| * | ||
| * return WOLFCLU_SUCCESS on success | ||
| */ | ||
| #ifdef WOLFSSL_HAVE_XMSS | ||
| /* A verify-only wolfSSL XMSS build has no private key, so there is nothing | ||
| * for these callbacks to read or write. FIPS builds are verify-only. */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drop the FIPS reference in the comment. This can be derived from the logging change |
||
| #if defined(WOLFSSL_HAVE_XMSS) && !defined(WOLFSSL_XMSS_VERIFY_ONLY) | ||
| enum wc_XmssRc wolfCLU_XmssKey_WriteCb(const byte* priv, word32 privSz, void* context); | ||
| enum wc_XmssRc wolfCLU_XmssKey_ReadCb(byte* priv, word32 privSz, void* context); | ||
| #endif | ||
| #endif /* WOLFSSL_HAVE_XMSS && !WOLFSSL_XMSS_VERIFY_ONLY */ | ||
|
|
||
| /** | ||
| * generate a XMSS key | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to guard this log (and the others) in two ways. One which tests HAVE_FIPS and logs that XMSS key gen is not possible due to FIPS constraints. And the other which says verify only is set so wolfssl would have to be rebuilt appropriately.
Also this can technically be printed even when XMSS is not configured. Add WOLFSSL_HAVE_XMSS