Skip to content

crypto: Zeroize security keys at function exit points#299

Merged
sidcha merged 1 commit intomasterfrom
zeroize-security-keys
Apr 26, 2026
Merged

crypto: Zeroize security keys at function exit points#299
sidcha merged 1 commit intomasterfrom
zeroize-security-keys

Conversation

@sidcha
Copy link
Copy Markdown
Member

@sidcha sidcha commented Apr 26, 2026

Per OWASP Secure Coding Practices [1]:

"Overwrite any sensitive information stored in allocated memory
at all exit points from the function."

Add osdp_fill_zeros() to each crypto backend (OPENSSL_cleanse, mbedtls_platform_zeroize, and a portable volatile-pointer loop for tinyaes since explicit_bzero() is a glibc/BSD extension not available on bare-metal toolchains like AVR libc), and use it to wipe SCBKs, keyset_pending, intermediate cryptograms, and the secure-channel state on PD/CP teardown.

[1] https://devguide.owasp.org/en/04-design/02-web-app-checklist/08-protect-data/

Fixes #296

Per OWASP Secure Coding Practices [1]:

  "Overwrite any sensitive information stored in allocated memory
   at all exit points from the function."

Add osdp_fill_zeros() to each crypto backend (OPENSSL_cleanse,
mbedtls_platform_zeroize, and a portable volatile-pointer loop for
tinyaes since explicit_bzero() is a glibc/BSD extension not available
on bare-metal toolchains like AVR libc), and use it to wipe SCBKs,
keyset_pending, intermediate cryptograms, and the secure-channel
state on PD/CP teardown.

[1] https://devguide.owasp.org/en/04-design/02-web-app-checklist/08-protect-data/

Fixes #296
@sidcha sidcha mentioned this pull request Apr 26, 2026
@sidcha sidcha merged commit b4def3f into master Apr 26, 2026
11 checks passed
@sidcha sidcha deleted the zeroize-security-keys branch April 26, 2026 09:12
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.

Zeroize scbk

1 participant