Skip to content

Entropy MemUse: fix for when block size less than update bits#8675

Merged
dgarske merged 2 commits intowolfSSL:masterfrom
SparkiDev:entropy_memuse_fix
Apr 17, 2025
Merged

Entropy MemUse: fix for when block size less than update bits#8675
dgarske merged 2 commits intowolfSSL:masterfrom
SparkiDev:entropy_memuse_fix

Conversation

@SparkiDev
Copy link
Copy Markdown
Contributor

@SparkiDev SparkiDev commented Apr 16, 2025

Description

When the block size is less than the number of update bits, adding the update value will make the index larger than ENTROPY_NUM_WORDS. The update bits, ENTROPY_NUM_UPDATES_BITS, should be less than or equal to ENTROPY_BLOCK_SZ but is not practical.
Add extra elements to the entropy state to accomadate this.

Call the custom high resolution time function when CUSTOM_ENTROPY_TIMEHIRES is defined with the function name.

Fixes zd#19728, zd#19727

Testing

./configure --disable-shared --enable-debug --enable-entropy-memuse 'CFLAGS=-DENTROPY_NUM_WORDS_BITS=9 -DWOLFSSL_DEBUG_ENTROPY_MEMUSE' 'CC=clang -fsanitize=address'
./wolfccrypt/test/testwolfcrypt

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

When the block size is less than the number of update bits, adding the
update value will make the index larger than ENTROPY_NUM_WORDS.
The update bits, ENTROPY_NUM_UPDATES_BITS, should be less than or equal
to ENTROPY_BLOCK_SZ but is not practical.
Add extra elements to the entropy state to accomadate this.
@SparkiDev SparkiDev self-assigned this Apr 16, 2025
dgarske
dgarske previously approved these changes Apr 16, 2025
@SparkiDev SparkiDev requested a review from dgarske April 16, 2025 01:14
@SparkiDev SparkiDev added the For This Release Release version 5.9.1 label Apr 16, 2025
@SparkiDev SparkiDev force-pushed the entropy_memuse_fix branch from f35ee3e to 1619029 Compare April 16, 2025 05:51
@SparkiDev
Copy link
Copy Markdown
Contributor Author

retest this please

Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

Feedback from the ticket

Comment thread wolfcrypt/src/random.c
@SparkiDev SparkiDev force-pushed the entropy_memuse_fix branch 3 times, most recently from 16de51c to e2e2e51 Compare April 16, 2025 23:30
Call the custom high resolution time function when
CUSTOM_ENTROPY_TIMEHIRES is defined with the function name.
@SparkiDev SparkiDev force-pushed the entropy_memuse_fix branch from e2e2e51 to a34284e Compare April 16, 2025 23:30
@SparkiDev
Copy link
Copy Markdown
Contributor Author

SparkiDev commented Apr 17, 2025

retest this please

@SparkiDev SparkiDev removed their assignment Apr 17, 2025
@dgarske dgarske merged commit a9e2146 into wolfSSL:master Apr 17, 2025
186 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants