Skip to content
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

Address stateful-sigs comments in #1650 #1656

Merged
merged 6 commits into from
Jan 11, 2024

Conversation

ducnguyen-sb
Copy link
Contributor

Add checked_malloc and checked_aligned_alloc

As mentioned in #1650 , liboqs has a existing pattern exit(111) when the malloc allocation failed. This PR add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc.
Two APIs will abruptly exit the program, but at least let user know what happens.
For now, it's close to impossible to propagate errors to callers without a lot of rewrite in the library.

Use memcpy instead of for loop

There is a pattern in sha2_armv8.c and sha2_c.c that use the for loop to perform an array copy.
Changed to memcpy. This change enables compiler optimizations.

Add Stateful signature flags to CONFIGURE.md

Fixed minor grammar errors, and add stateful signature flags description.

  • [] Does this PR change the input/output behaviour of a cryptographic algorithm (i.e., does it change known answer test values)? (If so, a version bump will be required from x.y.z to x.(y+1).0.)
  • [] Does this PR change the list of algorithms available -- either adding, removing, or renaming? Does this PR otherwise change an API? (If so, PRs in fully supported downstream projects dependent on these, i.e., oqs-provider and OQS-OpenSSH will also need to be ready for review and merge by the time this is merged.)

CONFIGURE.md Outdated Show resolved Hide resolved
src/common/common.h Outdated Show resolved Hide resolved
Copy link
Member

@baentsch baentsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also thanks for these updates/improvements, @ducnguyen-sb ! Please see single comments.

src/common/common.h Outdated Show resolved Hide resolved
@ducnguyen-sb
Copy link
Contributor Author

Is this PR good to merge? @baentsch @ashman-p @SWilson4

Copy link
Member

@baentsch baentsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an improvement to the current "surprise exit" approach, so good for me. Same caveats as stated in another place, though: Do we want to expose this new API externally? Testing of the new API considered done implicitly by its use in the SHA implementations.

@ducnguyen-sb
Copy link
Contributor Author

@baentsch Ah, I think these APIs should be used internally.

@ducnguyen-sb ducnguyen-sb merged commit 8457c8d into stateful-sigs Jan 11, 2024
52 checks passed
@ducnguyen-sb ducnguyen-sb deleted the address_merge_to_main_comments branch January 11, 2024 17:52
SWilson4 pushed a commit that referenced this pull request Feb 14, 2024
* Add sig_stfl to configure.md

* Add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc

* Use memcpy and checked_malloc
cothan pushed a commit that referenced this pull request Apr 2, 2024
* Add sig_stfl to configure.md

* Add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc

* Use memcpy and checked_malloc
SWilson4 pushed a commit that referenced this pull request Apr 12, 2024
* Add sig_stfl to configure.md

* Add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc

* Use memcpy and checked_malloc
SWilson4 pushed a commit that referenced this pull request Apr 12, 2024
* Add sig_stfl to configure.md

* Add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc

* Use memcpy and checked_malloc
SWilson4 pushed a commit that referenced this pull request Apr 12, 2024
* Add sig_stfl to configure.md

* Add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc

* Use memcpy and checked_malloc
SWilson4 pushed a commit that referenced this pull request May 14, 2024
* Add sig_stfl to configure.md

* Add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc

* Use memcpy and checked_malloc
cothan pushed a commit that referenced this pull request May 14, 2024
* Add sig_stfl to configure.md

* Add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc

* Use memcpy and checked_malloc
SWilson4 pushed a commit that referenced this pull request May 14, 2024
* Address  stateful-sigs comments in #1650 (#1656)

* Add sig_stfl to configure.md

* Add OQS_MEM_checked_malloc and OQS_MEM_checked_aligned_alloc

* Use memcpy and checked_malloc

* Zeroing internal state memory on heap

Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>

* make astyle happy

Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>

* secure free for wots key,sig tree stack

Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>

* revert

* fix markdown link invalid

Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>

* fix markdown link, work with doxygen 1.10

Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>

---------

Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>
Co-authored-by: Duc Nguyen <106774416+ducnguyen-sb@users.noreply.github.com>
cothan added a commit that referenced this pull request May 30, 2024
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 <dnguye69@gmu.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants