-
Notifications
You must be signed in to change notification settings - Fork 479
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
Update XMSS secret key object APIs, sync with LMS #1588
Update XMSS secret key object APIs, sync with LMS #1588
Conversation
fix astyle fixed all memory errors
6a8fca0
to
77668b9
Compare
…_SECRET_KEY initialization
…s/sig_stfl_lms.c src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c tests/test_sig_stfl.c
I don't know why the test duration increase by 50%. I'll think about it, if we are short on time then increase runtime is another solution. |
@ashman-p , I removed the recursive mutex, it works right away. Other than that I simplify the logic code in |
Yep, this sounds good. Thank you. |
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.
Looks good. Thanks.
* Init * convert all variable length array to malloc/free fix astyle fixed all memory errors * refactor XMSS and XMSS^MT, shorten LOC * clean up unused function * TODO: restore core_hash.c later * Add activate_lock and activate_unlock functions * Add `bool is_locked` to retain lock information, and adjust function signatures * cleanup test_sig_stfl.c * remove const in LMS_serialize_key and add `is_locked` to OQS_SIG_STFL_SECRET_KEY initialization * fix astyle error * fix astyle. I have to update local astyle to 3.4.10 * remove incorrect comments * remove unsued variables * fix if guard * fix const warnings * fix namespace error. revert core_hash.c to original namespace separation * move XMSS_free to internal of XMSS * Fix memory leaks * fix astyle format * fix typo * improve readablity * Update OID comment. * Trim the space * Remove mutex status bool * Remove use of mutex status bool. Use recursive mutex” src/sig_stfl/lms/sig_stfl_lms.c src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c tests/test_sig_stfl.c * rename lock function * simplify the check with 0 * Fix grammar * add `const` back to serialize. Reorder parameters to follow liboqs convention * use inner_serialize to avoid recursive lock * add return code in case pthread API has errors * fix scan_build NULL error --------- Co-authored-by: Norman Ashley <[email protected]>
* Init * convert all variable length array to malloc/free fix astyle fixed all memory errors * refactor XMSS and XMSS^MT, shorten LOC * clean up unused function * TODO: restore core_hash.c later * Add activate_lock and activate_unlock functions * Add `bool is_locked` to retain lock information, and adjust function signatures * cleanup test_sig_stfl.c * remove const in LMS_serialize_key and add `is_locked` to OQS_SIG_STFL_SECRET_KEY initialization * fix astyle error * fix astyle. I have to update local astyle to 3.4.10 * remove incorrect comments * remove unsued variables * fix if guard * fix const warnings * fix namespace error. revert core_hash.c to original namespace separation * move XMSS_free to internal of XMSS * Fix memory leaks * fix astyle format * fix typo * improve readablity * Update OID comment. * Trim the space * Remove mutex status bool * Remove use of mutex status bool. Use recursive mutex” src/sig_stfl/lms/sig_stfl_lms.c src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c tests/test_sig_stfl.c * rename lock function * simplify the check with 0 * Fix grammar * add `const` back to serialize. Reorder parameters to follow liboqs convention * use inner_serialize to avoid recursive lock * add return code in case pthread API has errors * fix scan_build NULL error --------- Co-authored-by: Norman Ashley <[email protected]>
* Init * convert all variable length array to malloc/free fix astyle fixed all memory errors * refactor XMSS and XMSS^MT, shorten LOC * clean up unused function * TODO: restore core_hash.c later * Add activate_lock and activate_unlock functions * Add `bool is_locked` to retain lock information, and adjust function signatures * cleanup test_sig_stfl.c * remove const in LMS_serialize_key and add `is_locked` to OQS_SIG_STFL_SECRET_KEY initialization * fix astyle error * fix astyle. I have to update local astyle to 3.4.10 * remove incorrect comments * remove unsued variables * fix if guard * fix const warnings * fix namespace error. revert core_hash.c to original namespace separation * move XMSS_free to internal of XMSS * Fix memory leaks * fix astyle format * fix typo * improve readablity * Update OID comment. * Trim the space * Remove mutex status bool * Remove use of mutex status bool. Use recursive mutex” src/sig_stfl/lms/sig_stfl_lms.c src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c tests/test_sig_stfl.c * rename lock function * simplify the check with 0 * Fix grammar * add `const` back to serialize. Reorder parameters to follow liboqs convention * use inner_serialize to avoid recursive lock * add return code in case pthread API has errors * fix scan_build NULL error --------- Co-authored-by: Norman Ashley <[email protected]>
* Init * convert all variable length array to malloc/free fix astyle fixed all memory errors * refactor XMSS and XMSS^MT, shorten LOC * clean up unused function * TODO: restore core_hash.c later * Add activate_lock and activate_unlock functions * Add `bool is_locked` to retain lock information, and adjust function signatures * cleanup test_sig_stfl.c * remove const in LMS_serialize_key and add `is_locked` to OQS_SIG_STFL_SECRET_KEY initialization * fix astyle error * fix astyle. I have to update local astyle to 3.4.10 * remove incorrect comments * remove unsued variables * fix if guard * fix const warnings * fix namespace error. revert core_hash.c to original namespace separation * move XMSS_free to internal of XMSS * Fix memory leaks * fix astyle format * fix typo * improve readablity * Update OID comment. * Trim the space * Remove mutex status bool * Remove use of mutex status bool. Use recursive mutex” src/sig_stfl/lms/sig_stfl_lms.c src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c tests/test_sig_stfl.c * rename lock function * simplify the check with 0 * Fix grammar * add `const` back to serialize. Reorder parameters to follow liboqs convention * use inner_serialize to avoid recursive lock * add return code in case pthread API has errors * fix scan_build NULL error --------- Co-authored-by: Norman Ashley <[email protected]>
* Init * convert all variable length array to malloc/free fix astyle fixed all memory errors * refactor XMSS and XMSS^MT, shorten LOC * clean up unused function * TODO: restore core_hash.c later * Add activate_lock and activate_unlock functions * Add `bool is_locked` to retain lock information, and adjust function signatures * cleanup test_sig_stfl.c * remove const in LMS_serialize_key and add `is_locked` to OQS_SIG_STFL_SECRET_KEY initialization * fix astyle error * fix astyle. I have to update local astyle to 3.4.10 * remove incorrect comments * remove unsued variables * fix if guard * fix const warnings * fix namespace error. revert core_hash.c to original namespace separation * move XMSS_free to internal of XMSS * Fix memory leaks * fix astyle format * fix typo * improve readablity * Update OID comment. * Trim the space * Remove mutex status bool * Remove use of mutex status bool. Use recursive mutex” src/sig_stfl/lms/sig_stfl_lms.c src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c tests/test_sig_stfl.c * rename lock function * simplify the check with 0 * Fix grammar * add `const` back to serialize. Reorder parameters to follow liboqs convention * use inner_serialize to avoid recursive lock * add return code in case pthread API has errors * fix scan_build NULL error --------- Co-authored-by: Norman Ashley <[email protected]>
commit 244288f Add XMSS parameter xmss_sha256_h10 (#1482) commit a7e26d9 Add 12 XMSS and 16 XMSSMT parameters. (#1489) commit 4694fc3 Add secret key object to XMSS (#1530) commit 99067be Add XMSS Serialize/Deserialize (#1542) commit 2dbfc40 Update XMSS secret key object APIs, sync with LMS (#1588) commit 47740ad Enforce idx from unsigned int to uint32_t. (#1611) commit 9610576 Fix windows-x86 and arm compiling error. (#1634) commit bb658b7 Address stateful-sigs comments in #1650 (#1656) commit 7db8ddf Update `sig_stfl.h` document for #1650 (#1655) commit c3e5750 Add Apache 2.0 and MIT License to XMSS (#1662) commit e1f02b2 Change XMSS License from `(Apache 2.0 AND MIT)` to `(Apache 2.0 OR MIT) AND CC0-1.0` (#1697) commit 17c12c3 Add return status for XMSS lock/unlock functions. (#1712) commit 1941636 Add return check for lock/unlock function (#1727) commit b45415c Use `abort()` instead of exit to get the trace log. (#1728) commit ba63672 Reduce number of `malloc/free` call in `XMSS/external` (#1724) Signed-off-by: Duc Tri Nguyen <[email protected]>
XMSS changes
Changelogs
main
branch: Remove variable length array inXMSS/external/
by converting them tomalloc/calloc
andOQS_insecure_free()
sign.c
andsign.h
.katfile
to test that takes too long to generate a key pair.sk->secret_key_data
is allocated by default. TheOQS_SECRET_KEY_XMSS_deserialize_key
is simply copy memory, instead of allocation new memory and copy. I think this should also be applied to LMS as well. I see it’s error-prone and inefficient to allocate memory each time thedeserialize
happens.Tests
This code will work with either
OQS_USE_PTHREADS_IN_TESTS
on or off. I tested both cases.