HomeFreeBSD

ICP: AES-GCM: Refactor gcm_clear_ctx()

Description

ICP: AES-GCM: Refactor gcm_clear_ctx()

Currently the temporary buffer in which decryption takes place
isn't cleared on context destruction. Further in some routines we
fail to call gcm_clear_ctx() on error exit. Both flaws may result
in leaking sensitive data.

We follow best practices and zero out the plaintext buffer before
freeing the memory holding it. Also move all cleanup into
gcm_clear_ctx() and call it on any context destruction.

The performance impact should be negligible.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Attila Fülöp <attila@fueloep.org>
Closes #14528

Details

Provenance
Attila Fülöp <attila@fueloep.org>Authored on Feb 27 2023, 10:38 PM
GitHub <noreply@github.com>Committed on Feb 27 2023, 10:38 PM
Parents
rG3b9309aabe46: Move zap_attribute_t to the heap in dsl_deadlist_merge
Branches
Unknown
Tags
Unknown