From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 E539B33ADA0 for ; Sat, 15 Aug 2026 17:10:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786813807; cv=none; b=ZBAc8xXPAB1nt9DVscUEZcZdhumXbFAzDrR9MElXoIjrCsHSXxmsIpK3LvdwPKWFRqOJblR+2z4p3eKjTVGdWGAOxtOAeWi+2k7jzmWNxLLRQI2/LljAXIeTBQr4UGuEp4tJtpEydn/JLzVRqXoR4oSatL4HjEsI0KKn+7iMj5A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786813807; c=relaxed/simple; bh=A5cMqtx4OcUeiHcl+Ll5ywa/XhjXm6ZgG6SDd8eXoBg=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=kA1j64V7do67tGI7hiqRa9zrllF/bGIe6VchPV5eN6wdcokMzmyweQguQr0evddDQ7NE5+iYiRuZ2Yz+4sa8KQGrZzXVV2y9difYRuGX5WWUelV4LmHQB4vvj6qEPurTw1qqpT2h/1bkwg3/bgWA2SehSAPCUyDdUn+nrmWDymM= 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=RgiUkYLL; arc=none smtp.client-ip=209.85.218.52 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="RgiUkYLL" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-c1f758014b8so207276466b.3 for ; Sat, 15 Aug 2026 10:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20251104; t=1786813803; x=1787418603; 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=f8FtYQNvh07cjnyWUEvGsLzktiNV3stpCYLWKZzqamA=; b=RgiUkYLLL0EjcGgBg2tMAXCZe55pmJr+QB8dqX6s9ji/KL/6l8+PyyCNySWlIUhmT7 ds16OH1Kh89BdtdcSnNyePO72tyz1ZBzS1NBAlqLVlhx6zQuUeGOpz9tIfqvpTY0H9uA aoJebSEZ8GCPB/Cglmv6BZV/xziGYRW8bV1tSkGjrfoU54lk+B75wykkIBmZoUlbExWe iYDFsWCyjEHhJ7FoZDParrg12XzbX0eU0pR7IcuiS70/V1HkZAo8clTc1a/WCWPnuxAZ bBDovJmNPQeUzbalp41jV9Y99L09ZRcWJMvRfKYsMYkfyKBXOXlM0SoX3HGYcNJNtAcq ETpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786813803; x=1787418603; 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=f8FtYQNvh07cjnyWUEvGsLzktiNV3stpCYLWKZzqamA=; b=WfmXXg40ubpVQzvLSfZx9WGsmDRFcd7wqzxym34EzPS5gaJGSpDq8f5AsXX66thLdx Y0JIcgoT1KaTKLD2+hq00h/2B8vDs/OJ+xdQchlRMinehGw3i09Y0Xsqx5yPY7esmZOw LLKhpubvXBb4x+W/PA2Cr3q8hp1K+RSo+mj9t1f0o8AokfdDMbJXiwiwT6HUjWFCWOJO aTwZtaL9A9CjnH2YXEukMC6CH1CFtydtNmaeXwo2gEhfeFWIYLWyn5Ttk0uNJp9IAju1 H6NFHRKj0rnnnKX87jHOuqY84zvpaxFwEyvU+MjEEMvSsTiarpwlTcfThYpAc1oTPZ8F rAgA== X-Forwarded-Encrypted: i=1; AHgh+RpjoOlynizoxfPQt9QW/RQTRf45O7eDLYkSntLNbIGjsDoYm0uZLBDkanEeVMGRVPW6Z7MMjyz+F5FDWxc=@vger.kernel.org X-Gm-Message-State: AOJu0YwustneeAXLoS+BER01yDtYe2OT5kGT+VEB5lods8ElZp1p+jP3 QYCfhBPjctZBYB+VrLL2jQix5ZRinPcJhqLECMCcF3k6u8ZpVACjcs2W X-Gm-Gg: AR+sD139JZWro2tNK2sHxfEyYhpDPmWivbpUMt2ItP937lSkACjR8ynU9XtPVIFbhlw g0c3BifhBHmqgkOhOLqvzGhYeDFf4h5uT/RGNfRAjg5xpAHE31Vonfr8kTj/oFfSc8cubJGUu4d PTraIkQg+oa9N1IHQVyuhcRQ/mLzFylqBmCRuuY5CEUrBvl3iUZ3CJcbfYnYOSmO+YEydddrt4x PeCcoK0/5tFvQqi92H9C3s7xIfoc9cAl3mPG+UptM1Yo/mnFs6edCmhDYBWTmHAhqaPenHG9LJB FqTGW/CSnwLbL2wAKx5CHXKxPkssRu50LStbyRuaCRwFTGZC9jiW1vZ6GqQf/I+ANIHQ20+P+v6 eYexEmr6TGaBkIDPbK9riMvY6IhLYyifrw7grIm3CiQIOxxIFawaMTng0KHa8/PSd71Hci5n3v7 aS9jX1/0x++qDvZTcX0T3omPZyp26nJtBmlvSnNJiwsP17Gu73n9ajNt04pERQng1iUV/62cutt ZobFe4dXmQtpW2OLK8= X-Received: by 2002:a17:907:fdca:b0:c08:417e:3696 with SMTP id a640c23a62f3a-c212a0f2e5fmr569257866b.20.1786813803080; Sat, 15 Aug 2026 10:10:03 -0700 (PDT) Received: from david.gall (k10193.upc-k.chello.nl. [62.108.10.193]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2140a8d4a1sm155920866b.26.2026.08.15.10.10.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Aug 2026 10:10:01 -0700 (PDT) Date: Sat, 15 Aug 2026 19:09:58 +0200 From: "David C.C.M. Gall" To: Gilad Ben-Yossef , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org Subject: [PATCH] crypto: ccree - use crypto_memneq() to compare AEAD tag 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 cc_aead_complete() compares the computed MAC against the received ICV with memcmp(), which short-circuits on the first differing byte and leaks tag-match length via timing. Use crypto_memneq() instead. Assisted-by: gregkh_clanker_t1000 Signed-off-by: David C.C.M. Gall --- drivers/crypto/ccree/cc_aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c index 088c4603047f..d57a98f89e53 100644 --- a/drivers/crypto/ccree/cc_aead.c +++ b/drivers/crypto/ccree/cc_aead.c @@ -226,8 +226,8 @@ static void cc_aead_complete(struct device *dev, void *cc_req, int err) goto done; if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) { - if (memcmp(areq_ctx->mac_buf, areq_ctx->icv_virt_addr, - ctx->authsize) != 0) { + if (crypto_memneq(areq_ctx->mac_buf, areq_ctx->icv_virt_addr, + ctx->authsize)) { dev_dbg(dev, "Payload authentication failure, (auth-size=%d, cipher=%d)\n", ctx->authsize, ctx->cipher_mode); /* In case of payload authentication failure, MUST NOT -- 2.43.0