From 5fbc5b5a3cf1e766f957c454d297913ae39118af Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Wed, 21 Mar 2018 16:12:07 +0000 Subject: [PATCH] cryptosoft(4): Zero plain hash contexts, too An OCF-naive user program could use these primitives to implement HMAC, for example. This would make the freed context sensitive data. Probably other bzeros in this file should be explicit_bzeros as well. Future work. Reviewed by: jhb, markj Differential Revision: https://reviews.freebsd.org/D14662 (minor part of a larger work) --- sys/opencrypto/cryptosoft.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 45897990a865..1b359c8322c6 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1053,8 +1053,10 @@ swcr_freesession_locked(device_t dev, u_int64_t tid) case CRYPTO_SHA1: axf = swd->sw_axf; - if (swd->sw_ictx) + if (swd->sw_ictx) { + explicit_bzero(swd->sw_ictx, axf->ctxsize); free(swd->sw_ictx, M_CRYPTO_DATA); + } break; case CRYPTO_DEFLATE_COMP: