From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 213CC2DB798 for ; Sat, 15 Aug 2026 17:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786813708; cv=none; b=SsTOMKDL8yvh9j8qPdNGAkG9+xzBg/JLquWd12qLkqaJI5Xr9KnPyw+Fcg3r8xF16BZIuqKlKKoq/2/CxauTzH1mYXwFlnexz9HnuTrTWGxMD6xmqgeoYfcYKJAzWEFu+bxN/Whuf+LQ3sAN7HUUTNQ742Qs7eeDoqEqHjfSBe8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786813708; c=relaxed/simple; bh=AhtxvJ+EhlvDKp97WYvO0vAsHP5tRb64VcLlZ7gHwTQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=Hwnvm8qUOA02qZ7QXYe9mZV8oq8SH3jPCKyFTMjIDjVT6tR4dOCSr/oz2F3Cr4pItOADL2zgDirCYzGrNe5iXsng5zN0RR8QZpJVEcxlcJgImKRMV/BwYctgyuimAC/vbwStQIRFFoXsJrY3FKHDsvAKgHLQ/sLI8b9pDpv3LKk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com; spf=pass smtp.mailfrom=googlemail.com; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=IhDpYKok; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=googlemail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="IhDpYKok" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-6a36982a875so2486542a12.0 for ; Sat, 15 Aug 2026 10:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20251104; t=1786813705; x=1787418505; darn=vger.kernel.org; h=content-disposition:content-type:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=b/+rLZmsZRuHHc/j7IikqYNJli/WdzMweu24EFXnWyM=; b=IhDpYKokPWPncSkeNLOuF8izTF1FzBnQiTVCcO5zfqt/4YWvIkhAPA+36KO/5mgpqD yLXQyxMVugbHIq8HHWskpXiwtlmp3rVQh7JVV9XpaiCZZedJ0391ZAhCHYiF7OekiVNs MCFVV6G1k7M2UWfw6bl4TLre9Ov7Vro893QBegi5gw8pdpfj7PEPIRZSmG0CkGrvnhoy I/Rk5yqpQjQEQELvLzK00iQav7dzXeWYNXjtvHzzZY+2kcaVYuGnNGzvl3y+IY2SLICC iYEQHmGzJXg/YQj0GOwDxsXmjL57WjvLGLPN/18fKnHWvdxj4S7CFltyEVPuXekCYmJd EFdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786813705; x=1787418505; h=content-disposition:content-type:mime-version:message-id:subject:cc :to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=b/+rLZmsZRuHHc/j7IikqYNJli/WdzMweu24EFXnWyM=; b=iANB/i2yENzi+9k55o4ov3vapKi/2ndOUb25aycOrTJreLQD7Cyfx/ls4TgVH5XZkB Gk0lEEYDQhb9zdo22GXd/RQLmVHxUOLvMtonC7fEqvu8AcL9ZZBTfSrMcimF2QR1Ysef z7M9l3FwXmOsCMWWdyWvinipcOW/aLFjhwnInwRT67dA4ckFZtRmuSjCH6BPyb7PUNXU eUkQmDtdoeRwsUEq05lp+YyyJfZKgXbPVJ8jeWaFdT3dP/Cyt+IBW3MyHpvRZPyvS2Z8 JaRVsSqB2dVK34inAtDz7xaS999Xb0XtLftX4jsNIbQxNXTc8p+4vur3ceEmW3Ee7Ad4 c0sg== X-Forwarded-Encrypted: i=1; AHgh+Ro4d7dqmOhCagcVThbmbTnpQBlGclSzon/xiBsBAZN+JYEaDtfR0dqFVVc0AskMPmaVFNISfU5uDVGJkAc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2pQkzakh3iiu8pZePeCnVkZ+fXlsAB6cbF99VYF2iQaNU9TMn INAKqf0tqBSyTo/ejq6q+SsCZDo12njsvvO6EItyn7rguVJrZFjrTAWr7pUZ91qhSC4= X-Gm-Gg: AR+sD12eGvklgWRryrD1yuzxR5HTHUb4YIR4UhTOqu6ygspbz2VdkU8wIBmCR4GUvVt m4PXzH9YXQs7sbYd95wfdiCYcfXwDbFz2KFyyCMmT/xgct9UqH/AMn1dNg28M8iMCSMBoVKTwM+ 5jco0xA59GBUCtgp/clS+gjBCThpDphKSc6VZTNpp42hGvlep8mPJ9ia8cWNXAm5uMKGF+uU5fy 0gyQObwPjWtb2PhyPvxgfIK5hqYgmf1M4ez9LAHcurA6rV4Tz8QJWbvk4Ko6FV8NzXw0RaE+LUe Eov6I69/YAp7tICKjwHCwUBHcV/Q1MrFiHQmh0NUoUeoev+v0LvEmhwE8OoQ/9cKlrmPVahDujL TTR53VQ94Tfdlg6W9NKb8JfxmaJMOIbIDTWPXGQ28k/x/GGq1OBG6+H9Zy6ZnCtpIOsFBEWolhv WshdgUn735AGITxAZSTVqMVvHQAeA+dcCOb5fIa2ZzSSdSYZrN0IHs0k8qLD0FW8VqzfOgjcNsO 92Q0BJ1Hr5LSYtGtII= X-Received: by 2002:a05:6402:1ed6:b0:6a1:7718:ad44 with SMTP id 4fb4d7f45d1cf-6a38a9b2241mr6060858a12.21.1786813705072; Sat, 15 Aug 2026 10:08:25 -0700 (PDT) Received: from david.gall (k10193.upc-k.chello.nl. [62.108.10.193]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6a38c9d5713sm2072694a12.6.2026.08.15.10.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Aug 2026 10:08:23 -0700 (PDT) Date: Sat, 15 Aug 2026 19:08:21 +0200 From: "David C.C.M. Gall" To: Srujana Challa , Bharat Bhushan , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org Subject: [PATCH] crypto: octeontx2 - use crypto_memneq() to check HMAC for cipher_null authenc Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline validate_hmac_cipher_null() compares the computed and received HMAC with memcmp(), which short-circuits on the first differing byte and leaks tag-match length via timing. Use crypto_memneq() instead. Because for cipher_null the validated payload is un-encrypted, this valid prefix leak allows for authenticated message forgery. Assisted-by: gregkh_clanker_t1000 Signed-off-by: David C.C.M. Gall --- drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c b/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c index 8d9f394d6b50..3ccf17d031c6 100644 --- a/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include "otx2_cptvf.h" @@ -90,9 +91,9 @@ static inline int validate_hmac_cipher_null(struct otx2_cpt_req_info *cpt_req) req = container_of(cpt_req->areq, struct aead_request, base); tfm = crypto_aead_reqtfm(req); rctx = aead_request_ctx_dma(req); - if (memcmp(rctx->fctx.hmac.s.hmac_calc, - rctx->fctx.hmac.s.hmac_recv, - crypto_aead_authsize(tfm)) != 0) + if (crypto_memneq(rctx->fctx.hmac.s.hmac_calc, + rctx->fctx.hmac.s.hmac_recv, + crypto_aead_authsize(tfm))) return -EBADMSG; return 0; -- 2.43.0