-
Notifications
You must be signed in to change notification settings - Fork 476
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
Disable Stateful Signatures in the build by default #1676
Conversation
When enabled, key and signature generation is disabled by default. Only signature verification is allowed. Key and signature generation can be enabled by defining OQS_ENABLE_SIG_STFL_KEY_SIG_GEN
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.
Thanks for adding this separator (and turning it off by default)! May I ask whether it would be possible to completely replace OQS_SIG_STFL with OQS_SIG if "OQS_ALLOW_SFTL_KEY_AND_SIG_GEN" is not set?
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.
Thanks for putting this together, Norm. Just a few typo/formatting fixes from me and one suggestion regarding test coverage.
@@ -297,7 +298,44 @@ OQS_STATUS sig_stfl_kat(const char *method_name, const char *katfile) { | |||
|
|||
ret = OQS_SUCCESS; | |||
goto cleanup; | |||
#else | |||
/* | |||
* Signature generation is disabled so only signature verification can be tested. |
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.
I know that we don't really have any "unhappy path" tests in liboqs, but I think they would be useful here as a sanity check to make sure that calling keygen / sign does, in fact, result in an error when those operations are disabled in the config.
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.
Thanks. Will do this on another test since the KAT test compares hashes of the expected output to determine success status of the test.
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.
Incorporated some of this in test_sig_stfl.c.
Co-authored-by: Spencer Wilson <[email protected]>
Co-authored-by: Spencer Wilson <[email protected]>
Hi, could you give an example or describe more about how that would look? Thanks. |
Fixed compile error, unused function. Added a negative test when stateful signature is disabled.
Sure, my question is whether it would be possible (for the rest of the code to continue working) when completely wrapping the current definition for OQS_SIG_STFL in "sig_stfl.h" in an #ifdef OQS_ALLOW_SFTL_KEY_AND_SIG_GEN and
in the #else (#ifndef OQS_ALLOW_SFTL_KEY_AND_SIG_GEN) branch. |
@ashman-p I've started fleshing out my proposal above in the branch "mb-stfl-no-sigkeygen", so see e.g. liboqs/src/sig_stfl/sig_stfl.h Lines 181 to 183 in 1499916
Question: What code generator did you use to create the many variants? It's tedious to manually #ifdef the now apparently unneeded replicate references to "oid", "sigs_remaining", "sigs_total"... I started this in the branch to see whether compilation succeeds -- it does: Those structs are apparently only needed in the disabled (under unset OQS_ALLOW_SFTL_KEY_AND_SIG_GEN) If this were successful, XMSS/LMS algs might indeed be used (for verification) just like any other OQS_SIG & no downstream changes appear to be necessary to use this code right out of the box (only if configured without sig/gen). |
I hate commenting my own comment but I have to:
After understanding the code a bit better I'd now see a much simpler solution, doing away with a possible generator and dozens of files and compile jobs, namely #defines for the
Please let me know whether you'd want to adopt this -- or whether I'm overlooking a problem with this. If the former, let me know whether I should prepare a complete PR or you'd rather do it yourself. |
Yes, I agree that this macro would speed things up in general. I am in the process of making an update to address one of Spencer's comments and also fix a build issue. |
OK, that could be facilitated easily by moving those two assignments to the proposed "XMSS_SIGGEN" macro.
Sure. Just wanted to ask whether my thinking in general is OK for you. Thanks for the feedback. |
Allow some key generation tests to run as negative tests when key and sig gen is off
@baentsch, Let me study this a little, get feedback from @ducnguyen-sb and run some tests to try it. |
Yes, that may sound "unconventional" -- but the question seems to be: Is it logically right? And technically doable, i.e., is signature state sufficiently encoded in the signatures to permit verification? If the latter, I don't really see a mismatch: OQS_SIG then (continues to) support state-free signature operations (on all algorithms supporting that) while OQS_SIG_STFL adds functionality for stateful operations (on those algs needing/supporting this).
That would be great: I got stuck a bit trying that in the pre-existing macro machinery loading "external/xmss.c" that you probably understand much better than I do. |
It is an interesting idea... are we using the prefix In the context of key generation, both Granted, I don't have a conclusion at this point, but you made me think. |
I would like to treat this proposal as a separate task. If it is OK, let me merge this branch to 'stateful-sigs' with the stated goal of disabling the feature by default and only enable stateful verification. I will continue the investigation of using OQS_SIG interface as well as converting some macro generated functions. |
Kinda... but I'm not sure I even fully concur with that: Granted, SIG and SIG_STFL both contain one function with pretty much identical signature and functionality (
Thanks. I in turn am also re-thinking my original proposal to activate this OQS_SIG "verify-only" API if "OQS_ALLOW_SFTL_KEY_AND_SIG_GEN" is not set: I now begin to wonder whether this should always be used: This would also make it clear to every user which of the SIG_STFL operations are "different" (not saying dangerous). |
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.
OK with me to merge this and continue to work on the other points in separate PR(s). Thanks, Norm.
Hi @ashman-p , sorry for the late reply. Please let me know if I can help in the next PR. |
* Disable stateful signature as default. When enabled, key and signature generation is disabled by default. Only signature verification is allowed. Key and signature generation can be enabled by defining OQS_ENABLE_SIG_STFL_KEY_SIG_GEN * Fixed format * Address unused variables * Update .CMake/alg_support.cmake Co-authored-by: Spencer Wilson <[email protected]> * Update CONFIGURE.md Co-authored-by: Spencer Wilson <[email protected]> * Update example_sig_stfl.c Fixed compile error, unused function. Added a negative test when stateful signature is disabled. * Fix build error. Allow some key generation tests to run as negative tests when key and sig gen is off * Fix format * Fix build error * Fix build error --------- Co-authored-by: Spencer Wilson <[email protected]>
* Disable stateful signature as default. When enabled, key and signature generation is disabled by default. Only signature verification is allowed. Key and signature generation can be enabled by defining OQS_ENABLE_SIG_STFL_KEY_SIG_GEN * Fixed format * Address unused variables * Update .CMake/alg_support.cmake Co-authored-by: Spencer Wilson <[email protected]> * Update CONFIGURE.md Co-authored-by: Spencer Wilson <[email protected]> * Update example_sig_stfl.c Fixed compile error, unused function. Added a negative test when stateful signature is disabled. * Fix build error. Allow some key generation tests to run as negative tests when key and sig gen is off * Fix format * Fix build error * Fix build error --------- Co-authored-by: Spencer Wilson <[email protected]>
* Disable stateful signature as default. When enabled, key and signature generation is disabled by default. Only signature verification is allowed. Key and signature generation can be enabled by defining OQS_ENABLE_SIG_STFL_KEY_SIG_GEN * Fixed format * Address unused variables * Update .CMake/alg_support.cmake Co-authored-by: Spencer Wilson <[email protected]> * Update CONFIGURE.md Co-authored-by: Spencer Wilson <[email protected]> * Update example_sig_stfl.c Fixed compile error, unused function. Added a negative test when stateful signature is disabled. * Fix build error. Allow some key generation tests to run as negative tests when key and sig gen is off * Fix format * Fix build error * Fix build error --------- Co-authored-by: Spencer Wilson <[email protected]>
* Disable stateful signature as default. When enabled, key and signature generation is disabled by default. Only signature verification is allowed. Key and signature generation can be enabled by defining OQS_ENABLE_SIG_STFL_KEY_SIG_GEN * Fixed format * Address unused variables * Update .CMake/alg_support.cmake Co-authored-by: Spencer Wilson <[email protected]> * Update CONFIGURE.md Co-authored-by: Spencer Wilson <[email protected]> * Update example_sig_stfl.c Fixed compile error, unused function. Added a negative test when stateful signature is disabled. * Fix build error. Allow some key generation tests to run as negative tests when key and sig gen is off * Fix format * Fix build error * Fix build error --------- Co-authored-by: Spencer Wilson <[email protected]>
* Disable stateful signature as default. When enabled, key and signature generation is disabled by default. Only signature verification is allowed. Key and signature generation can be enabled by defining OQS_ENABLE_SIG_STFL_KEY_SIG_GEN * Fixed format * Address unused variables * Update .CMake/alg_support.cmake Co-authored-by: Spencer Wilson <[email protected]> * Update CONFIGURE.md Co-authored-by: Spencer Wilson <[email protected]> * Update example_sig_stfl.c Fixed compile error, unused function. Added a negative test when stateful signature is disabled. * Fix build error. Allow some key generation tests to run as negative tests when key and sig gen is off * Fix format * Fix build error * Fix build error --------- Co-authored-by: Spencer Wilson <[email protected]>
* Disable stateful signature as default. When enabled, key and signature generation is disabled by default. Only signature verification is allowed. Key and signature generation can be enabled by defining OQS_ENABLE_SIG_STFL_KEY_SIG_GEN * Fixed format * Address unused variables * Update .CMake/alg_support.cmake Co-authored-by: Spencer Wilson <[email protected]> * Update CONFIGURE.md Co-authored-by: Spencer Wilson <[email protected]> * Update example_sig_stfl.c Fixed compile error, unused function. Added a negative test when stateful signature is disabled. * Fix build error. Allow some key generation tests to run as negative tests when key and sig gen is off * Fix format * Fix build error * Fix build error --------- Co-authored-by: Spencer Wilson <[email protected]>
commit e356ebf Na lms (#1486) commit 55094c3 LMS H5_W1 (#1513) commit 4d773d7 Convert to use OQS_SIG_STFL_SECRET_KEY struct (#1525) commit 245aede LMS updated to use new SK API (#1533) commit a85a9aa Stateful sigs secret key storage callback (#1553) commit 3934949 Na statful sig lock (#1559) commit 3db6b44 Secret Key Query (#1572) commit 2446c64 Na stateful sigs lms var (#1574) commit 8df2539 Stateful sigs XMSS updates (#1590) commit a7b2987 SHA2 Increment with arbitrary length (non-block sizes) (#1614) commit 2dd9e07 Na lms kat multi level (#1620) commit 982b440 Fix Build Errors (#1635) commit ddae644 Various fixes commit cc50ef0 Fix warning commit cf03392 Update README.md commit 9325713 Update README.md commit a52b217 Update README.md commit d442ac9 Update README.md commit 72ab478 Update README.md commit 5967f12 Update src/CMakeLists.txt commit fc6d512 Update documentation and license text. (#1663) commit e7a83c7 Disable Stateful Signatures in the build by default (#1676) commit 6c81bae Na stateful macro (#1687) Signed-off-by: Norman Ashley <[email protected]>
This commit will disable XMSS and LMS from the build by default. When enabled key and signature generation is also disabled by default. They can be enabled by defining the following variables on the config command.
-DOQS_ENABLE_SIG_STFL_KEY_SIG_GEN=ON
-DOQS_ENABLE_SIG_STFL_XMSS = ON
-DOQS_ENABLE_SIG_STFL_LMS = ON