-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Using memset vs platform zeroize #9844
Comments
There are two reasons to clear data that is no longer in use:
Here, the slot doesn't directly contain any sensitive memory, so we don't need the zeroize. We only want to ensure that if the slot is reused and the library code forgets to update part of it, the slot won't get into an inconsistent state. Mind you, here, you could argue that |
Thanks for clarifications.
This kind of suggests that it might be fine if the data was not wiped clean. Maybe this phrase should be removed. |
mbedtls/tf-psa-crypto/core/psa_crypto.c
Lines 1256 to 1260 in 99ed26e
The given reason is strange. Non-sensitive data needs no wiping; sensitive data must be cleared. According to the comment, this
memset
was supposed to reset slot's state, but it would never happen if the call was optimized away.Maybe in most cases
memset(..., 0, ...)
should be replaced with the reliable zeroize call.The text was updated successfully, but these errors were encountered: