From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DF7B31AF0BB; Tue, 27 May 2025 17:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748367099; cv=none; b=kDeZUm2NvCBZBXZo7oLklJnXMF4v1CYOawnCV8Wpkthf+79hwcNamSwEowNo0iiITQlbtxmJ9NTyZHJWE1Kg102wX43oZj2u6aM+B+iRLeOu1QFNHg7djnKT4F0TcreZGrh8qD/JVIyHjfoHoN/qU5HYZSgBc4Q78/L42BLXvOQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748367099; c=relaxed/simple; bh=XsZ5GRy8hIiV8FkoQQOVm/xg2zvO0iSfEt+dTeien+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ffIzmC7dA/dvxbu0GZ0U2AVcxqtqFBTC+jiYjhpwvkj8NKEnp+4ha8NZBQzpH0DepfEYAKNz2ARhs/NvzfX8Ug8X0PnfoX7WkY7UTNZgp3RsyR0w7labqDTih+lIAeeCkwg4bhPRYTT2aQRyehs3N9x7Eic6XNzExU00DswId9c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XqpzNHJ/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XqpzNHJ/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7F21C4CEE9; Tue, 27 May 2025 17:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748367098; bh=XsZ5GRy8hIiV8FkoQQOVm/xg2zvO0iSfEt+dTeien+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XqpzNHJ/j0+Lvj/t0YHE9dR+OULE233B8bMNaMKpWeVd7qQJffyoesqwJhQSQtBkW riMHbqxTp2/VwV/D0xBZNjwL3LUUaUaJEJ3ypeRKCmcmfdt1BDoW9+jCONYkIx74rY HsN5jeUVhAXljnhlqYZBmFFJ06qEl8tNJLrlckds= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sven Schwermer , Herbert Xu , Sasha Levin Subject: [PATCH 6.14 250/783] crypto: mxs-dcp - Only set OTP_KEY bit for OTP key Date: Tue, 27 May 2025 18:20:47 +0200 Message-ID: <20250527162523.286092790@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527162513.035720581@linuxfoundation.org> References: <20250527162513.035720581@linuxfoundation.org> User-Agent: quilt/0.68 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 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sven Schwermer [ Upstream commit caa9dbb76ff52ec848a57245062aaeaa07740adc ] While MXS_DCP_CONTROL0_OTP_KEY is set, the CRYPTO_KEY (DCP_PAES_KEY_OTP) is used even if the UNIQUE_KEY (DCP_PAES_KEY_UNIQUE) is selected. This is not clearly documented, but this implementation is consistent with NXP's downstream kernel fork and optee_os. Signed-off-by: Sven Schwermer Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/mxs-dcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c index d94a26c3541a0..133ebc9982362 100644 --- a/drivers/crypto/mxs-dcp.c +++ b/drivers/crypto/mxs-dcp.c @@ -265,12 +265,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, MXS_DCP_CONTROL0_INTERRUPT | MXS_DCP_CONTROL0_ENABLE_CIPHER; - if (key_referenced) - /* Set OTP key bit to select the key via KEY_SELECT. */ - desc->control0 |= MXS_DCP_CONTROL0_OTP_KEY; - else + if (!key_referenced) /* Payload contains the key. */ desc->control0 |= MXS_DCP_CONTROL0_PAYLOAD_KEY; + else if (actx->key[0] == DCP_PAES_KEY_OTP) + /* Set OTP key bit to select the key via KEY_SELECT. */ + desc->control0 |= MXS_DCP_CONTROL0_OTP_KEY; if (rctx->enc) desc->control0 |= MXS_DCP_CONTROL0_CIPHER_ENCRYPT; -- 2.39.5