Message ID | 20231106171915.292787-1-Chaitanya.Tata@nordicsemi.no |
---|---|
State | Accepted |
Headers | show
Return-Path: <hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=I+5YezxZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=PSnf7vq7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SPJ5k4kKWz1yQK for <incoming@patchwork.ozlabs.org>; Tue, 7 Nov 2023 04:20:40 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0uNx81aUWj79hVppkqGy7ZghiFhTtMN8STXRfVYhlNE=; b=I+5YezxZeAifIm DHdzPL13wFq4rhNV1175OOnedvrrlHUxp7YZyIYVY1I4iXF7upq1leWUmawAV5tFiF9HssQ89RwWS xGHkUWcvTyumD4BQc3GVmr0TZSieBlg/x6iDDFb+J5GEnfzYUn3b8FEC9dhxodP3ckfWTqoFSF9Le d631ihr7J7cE/EbkF5deV1tBu4jmPywZ3If+/Inyt4oIHkWPXyIubnVPq7NI8yFd46FqAoVZvuz7+ wsDAI7wW8znuIvb0IO2ewlppDaVGOhvskkePIvAahlay2K8TP2uAo8e7vxMBFSxU6OcgIGDt9U9Gy iLH874CdwXeZMtYnZ2KA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r03G3-00HDKq-2C; Mon, 06 Nov 2023 17:19:27 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r03G0-00HDJb-1W for hostap@lists.infradead.org; Mon, 06 Nov 2023 17:19:25 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6b3c2607d9bso3833277b3a.1 for <hostap@lists.infradead.org>; Mon, 06 Nov 2023 09:19:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699291161; x=1699895961; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=QRhCnsaITcAGLeDHqnWKQx2vEPw8nqbz+mkCSlD5Ujc=; b=PSnf7vq7WEyZuklC9CO9ecTrM4EQyt0Vazm4Z5meBNAWjtlKqQZTsBgzoExtM/fM0i jHy0tby4OZJdo02NQumQAMQ1Wh28UR5eByNGr2wBxwwdx+XZUsqfSNCb5LXVtl0dk+Bl UIJ42dEk6Ay4Ah5he7vCGizlXTx/PmBoHQ6sml9XQ5YWlvAvUkOMo4cn7ePTWE62Wcky RSP0pbcTIj07msv63hP+YHMKE0tyWmQAXMddWE+dMbYA7zlaAHvjWwA3Xe5aBIAWtLrR iHsfLrOjpzcyvKnuxE6de2rDYfRCRCurMLsRpQdz50iNvJY72vZ/k3Pli7qHS42U1V07 doeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699291161; x=1699895961; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QRhCnsaITcAGLeDHqnWKQx2vEPw8nqbz+mkCSlD5Ujc=; b=cfKP+VeNJhVxk+yum3VCG2/8sslweA5SvvwquYl5UTt/58ExCCzf43+1x+SBK8tp6L l2pcipon8NiBIEGqJxT5ludoc3sQ8VyyndWkioP6xiFsOuIbb3r3oXEWQa/Y7OsUGtk/ DGbGZ5VsLS2NCHWJRYpTHzpY6AkuCnGJZa13ND1k5cNJu8qzwT+ZjsW0JfStpkklK1Ip d94XP0+X4Z2CQsfylkX3Os+i7xz0v41FMTHhuVpTxBR5gvTpCDLF1DiAb6wccIMvucoV HZnCKHZ5976rhTbGqgGKBBdlher5AYBK15HohwFqGQB9NsZKMpeaP1BMvzvUVOd7rBr/ olew== X-Gm-Message-State: AOJu0YxnEpUdovBXNO3PRedh6wQWdaURAOdSY845pxoAmSvTooLEOEA3 UJJR6GUtcSm/LYb3ee0WOgcZL4pFhjoT5A== X-Google-Smtp-Source: AGHT+IF2RTuknoSJHFMEt6GfdmHe7p5w9GXRh+wBOCE7z79WQulitSwVeVzN4+AGbdVAwG31Ky6jTg== X-Received: by 2002:a05:6a20:1595:b0:17b:3822:e5ea with SMTP id h21-20020a056a20159500b0017b3822e5eamr29893134pzj.19.1699291161449; Mon, 06 Nov 2023 09:19:21 -0800 (PST) Received: from smtp.gmail.com ([49.205.253.113]) by smtp.gmail.com with ESMTPSA id w2-20020a1709027b8200b001b567bbe82dsm6139187pll.150.2023.11.06.09.19.20 for <hostap@lists.infradead.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 09:19:21 -0800 (PST) From: Chaitanya Tata <chaitanya.mgit@gmail.com> X-Google-Original-From: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no> To: hostap@lists.infradead.org Subject: [PATCH] dragonfly: Fix legendre symbol calculation failure handling Date: Mon, 6 Nov 2023 22:49:15 +0530 Message-Id: <20231106171915.292787-1-Chaitanya.Tata@nordicsemi.no> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231106_091924_506289_A6FE8C77 X-CRM114-Status: GOOD ( 12.62 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In case of low-memory conditions, the computation for legendre symbol can fail and return -2 as per documentation, but the check for that was missed here. And this can can cause an infinite loop searc [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:431 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [chaitanya.mgit[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <hostap.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/hostap>, <mailto:hostap-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/hostap/> List-Post: <mailto:hostap@lists.infradead.org> List-Help: <mailto:hostap-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/hostap>, <mailto:hostap-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Hostap" <hostap-bounces@lists.infradead.org> Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
dragonfly: Fix legendre symbol calculation failure handling
|
expand
|
On Mon, Nov 06, 2023 at 10:49:15PM +0530, Chaitanya Tata wrote: > In case of low-memory conditions, the computation for legendre symbol > can fail and return -2 as per documentation, but the check for that > was missed here. And this can can cause an infinite loop searching for > qr and qnr. > > Break the loop if calculation fails, we can leave retry to the callers > or user. Thanks, applied.
diff --git a/src/common/dragonfly.c b/src/common/dragonfly.c index 1e8427166..a0befe537 100644 --- a/src/common/dragonfly.c +++ b/src/common/dragonfly.c @@ -71,8 +71,11 @@ int dragonfly_get_random_qr_qnr(const struct crypto_bignum *prime, *qr = tmp; else if (res == -1 && !(*qnr)) *qnr = tmp; - else + else { crypto_bignum_deinit(tmp, 0); + if (res == -2) + break; + } } if (*qr && *qnr)
In case of low-memory conditions, the computation for legendre symbol can fail and return -2 as per documentation, but the check for that was missed here. And this can can cause an infinite loop searching for qr and qnr. Break the loop if calculation fails, we can leave retry to the callers or user. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no> --- src/common/dragonfly.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)