From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45B063B05BA for ; Mon, 10 Aug 2026 09:30:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786354239; cv=none; b=DkCPl8rIKwPpjt0JcJ1pFDL69DOec3fCF4Lk3J8vcgsa3uAn9hRXWKOzXPxsgLn57o9cyZK6PINs2sb4ZTgS9PJbLVPqcT4keUpYAl1zS6uNVAZRq0QCizJsy6YxNiE4vdhfF0y5l00CvlVA2M8EbZpp8f6+yWy33VPFiGo39/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786354239; c=relaxed/simple; bh=H51eEndb83vlMBdSKdQPCJs4a0NhTn4ra/iT1GUYwIc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C/KWE7Vt+m8Cs/aRV/1xk7Ui6oivgHclIDf4smHcF2FHqxgeAOywSfQwsnJXQvqM+XSkp6xajQd2rj9YlBdALfZgUX0y0XW8v5p8gYMnoEOJIrce6kQqpiU6uDPygTGfh/E39YA+b/2HVsfiGYx2jh/ADRjJUL/L4ul1woiQAGI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DtdL/DIi; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DtdL/DIi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786354237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UgOea8COfMWPGkNwdk17UcXroZGUrewDpcR0b9Y5VNk=; b=DtdL/DIiyk+9DXpRPS9qvpjVL8CRGVc/HjQQPv3fVLVrUoxhxbmr+SeeTByUamNyYt1i9c UfibudMsCAL3B2RNSEuGIK4rkYMlCcI6GQH31aFuT8eikt83QotTQd93swVFThvnnAQu8b Db+R2xvY/9ULIN6bRQr2dnD3qhDmoQo= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-520-WhMXaSr1MJ-7amixPsaTGA-1; Mon, 10 Aug 2026 05:30:30 -0400 X-MC-Unique: WhMXaSr1MJ-7amixPsaTGA-1 X-Mimecast-MFC-AGG-ID: WhMXaSr1MJ-7amixPsaTGA_1786354229 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5035D180075E; Mon, 10 Aug 2026 09:30:29 +0000 (UTC) Received: from thuth-p1g4.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 306B93001D38; Mon, 10 Aug 2026 09:30:26 +0000 (UTC) From: Thomas Huth To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, Eric Biggers , linux-kernel@vger.kernel.org, Antoine Tenart Subject: [PATCH v5 04/10] crypto: sa2ul - clear the crypto_aes_ctx when done Date: Mon, 10 Aug 2026 11:29:59 +0200 Message-ID: <20260810093009.608090-5-thuth@redhat.com> In-Reply-To: <20260810093009.608090-1-thuth@redhat.com> References: <20260810093009.608090-1-thuth@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 From: Thomas Huth Clear the crypto_aes_ctx structure via __cleanup(aes_zeroize_ctx) when we're done with it to avoid that key data could leak on the stack. Signed-off-by: Thomas Huth --- drivers/crypto/sa2ul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c index d865fd4a098cb..f1a7c2cc7a1af 100644 --- a/drivers/crypto/sa2ul.c +++ b/drivers/crypto/sa2ul.c @@ -465,7 +465,7 @@ static void sa_prepare_iopads(struct algo_data *data, const u8 *key, /* Derive the inverse key used in AES-CBC decryption operation */ static inline int sa_aes_inv_key(u8 *inv_key, const u8 *key, u16 key_sz) { - struct crypto_aes_ctx ctx; + struct crypto_aes_ctx ctx __cleanup(aes_zeroize_ctx); int key_pos; if (aes_expandkey(&ctx, key, key_sz)) { -- 2.55.0