From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 7C8323112C1; Sat, 30 May 2026 18:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780164431; cv=none; b=bIfKuO0Myrxp2JqynSlx1E+KNYUpzpRdTm4kIoFR1XJiApvItxRVNEyvs3TLL40CfB1JHjI8HEIIW2woZ5nQjGR1pXJjy38bODFwKc1OwUOZu/sDMYMvS0SQukzmWDIKplBDCNUKtMlOd6ihhtOXklDL+N/a41/ObJVagp6MRF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780164431; c=relaxed/simple; bh=3yt9Bszo6BS1ah436x68mdzysPo/E959Mv3DomZX7As=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NlP7uio7RKQCtuRGeFE69LwnUGNUWAui43eCibzDXcUE2W70I2609uxOf7KCKdnsYOFdKhQg0pmOCRMy9fTIDsq/zSgmMoIMP6zDWTffhmFR2+doEPzrn3maYR7fCXPmsx2dvV0jd6NzrlsZlDQTtrgqnfHyd+PIcJ5PmTUhvy8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H6Mzq2Y0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="H6Mzq2Y0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8233C1F00893; Sat, 30 May 2026 18:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780164430; bh=hi/UWteIXCKCyQkj3uhysY0uq6OdMs4MG8/kI7Cb/Vs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H6Mzq2Y0kGLeKMadeQKjoPJddi+N6h2mkRY8rkdGaRP3gIgc62bnZG3vI5bF8KpEB S3+oY2JR+Q956GTfnDx51c/KzSMYY/9TmAnyiwWhMUBrURUFuFb79ua66jhexKZ8qs Oxy5rX1Buo82S4Jbi8ymDBaa7uIi7riZHpiZRPjU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paul Moses , Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 552/776] crypto: ccp - copy IV using skcipher ivsize Date: Sat, 30 May 2026 18:04:26 +0200 Message-ID: <20260530160254.420596535@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Moses [ Upstream commit a7a1f3cdd64d8a165d9b8c9e9ad7fb46ac19dfc4 ] AF_ALG rfc3686-ctr-aes-ccp requests pass an 8-byte IV to the driver. ccp_aes_complete() restores AES_BLOCK_SIZE bytes into the caller's IV buffer while RFC3686 skciphers expose an 8-byte IV, so the restore overruns the provided buffer. Use crypto_skcipher_ivsize() to copy only the algorithm's IV length. Fixes: 2b789435d7f3 ("crypto: ccp - CCP AES crypto API support") Signed-off-by: Paul Moses Reviewed-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/ccp-crypto-aes.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccp/ccp-crypto-aes.c b/drivers/crypto/ccp/ccp-crypto-aes.c index e6dcd8cedd53e..b03ed5e83c3e9 100644 --- a/drivers/crypto/ccp/ccp-crypto-aes.c +++ b/drivers/crypto/ccp/ccp-crypto-aes.c @@ -28,8 +28,11 @@ static int ccp_aes_complete(struct crypto_async_request *async_req, int ret) if (ret) return ret; - if (ctx->u.aes.mode != CCP_AES_MODE_ECB) - memcpy(req->iv, rctx->iv, AES_BLOCK_SIZE); + if (ctx->u.aes.mode != CCP_AES_MODE_ECB) { + size_t ivsize = crypto_skcipher_ivsize(crypto_skcipher_reqtfm(req)); + + memcpy(req->iv, rctx->iv, ivsize); + } return 0; } -- 2.53.0