From patchwork Wed Jun 1 10:03:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 577789 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8f0c:0:0:0:0 with SMTP id mq12csp421595mab; Wed, 1 Jun 2022 03:04:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn37k+26jnA2263T3cLFJFKNHPe06iJnKEa9vxOt1QCJWjCbhsZ6K8gHpHYvMCLVIRQ8TF X-Received: by 2002:a05:6602:2c0c:b0:5f0:793f:cb9e with SMTP id w12-20020a0566022c0c00b005f0793fcb9emr27777148iov.122.1654077865727; Wed, 01 Jun 2022 03:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654077865; cv=none; d=google.com; s=arc-20160816; b=egX1UfcACaI37IMWWlkMbdN08Wkp1yfYjduOk+HN/kv4K+OfgRpoWZy272A3TefMkS D8iwVFFBEe6uYWCa5+30gKG8nVv4gs2ob4WvF9bQkhxrtkCG7ZelZH93GWfmZH+7IaGV 2LwTUfd93vqnNN6n1abL1xpabrACZvrOQ9LXyfM2FBm0V1N07WhEbC3xf0eGZpcOM9F8 p9b30O2mq55NrkhdqBNroaDhrTQxYfEidm5KMGq8UCHsEoNSoTDKnQ8Qxcq4i2YZiLpk q4jUIn1EVYwCADhda3Ie1u2o3LHyTBcqPokFAaB85n2I94c/f0sbxyDT+ZpQk/dMcOsC gWUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=gMyVf0z8ELy4OJBY+5pNJ/DtFVWLyBR7Gr3yxzzebhc=; b=CgQwNieogSZi5Giiq6vExpaf+DO6Y0Tpvrxy01wpfV3vK9xorln3K/NVqelVDADwfc sDhwZ4fDUkMMZ+q0nKQILx+fUq+2aG8nUx9k+cMSNo4OV/+swIwt5ktfUBPEqGiA2EEZ vgAwZhsr+mJ6YOTWRdkTEk02Fu0FGeSitWSoSBe+ioCnahMt9JaE9oxJWyNUZrJ+U3Ru uX1B42d64t1H9GPBVb53sEIv+MTZsHk9hHvEVMTZZkReATCZPDe1DIl6JJv/BMbfVC2d zUce03M7dkIEDOS73Upqx2id+QOfG+XZFCcgFRjR6IJnzoZANyk6u6laC1GPgBSLREty va9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P4XMGr1K; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id k4-20020a056e021a8400b002d1a271e716si1525523ilv.44.2022.06.01.03.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 03:04:25 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P4XMGr1K; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AA9B88427B; Wed, 1 Jun 2022 12:04:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="P4XMGr1K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 456AE840D8; Wed, 1 Jun 2022 12:04:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3362C8421F for ; Wed, 1 Jun 2022 12:04:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=loic.poulain@linaro.org Received: by mail-wm1-x335.google.com with SMTP id y24so671002wmq.5 for ; Wed, 01 Jun 2022 03:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gMyVf0z8ELy4OJBY+5pNJ/DtFVWLyBR7Gr3yxzzebhc=; b=P4XMGr1KnSQQGqwnQpT4diGoUTt3mblqAyOHL2F5Sh3HKbj/GFniFeTfZvGQG2oK+w vLW8YARt+ZJaEZ3Hy9Gtq4jdiMcOaAkPyaQ/opilW+EwgcSdnIrF4CyD6Om1P0XesgN5 QP84vzSxM8V76tzcwQ8US1UhKjGmXWZgO05kAYpbQ9ypWBflaKAtMxV8ZYdor5lnlkzQ rMEgbuos0E07kRJAsnJyKk0+NswRN0yotx1e2tJLFG0PAcTvTeBeD36Em3aY4d3ftXtV hsas9/nq8xhQCPOZIsukq7Trw+Lzkvx0dGYFUWg+ELlLymwzH5BrrVHVheSzkrQgRWlg MMHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gMyVf0z8ELy4OJBY+5pNJ/DtFVWLyBR7Gr3yxzzebhc=; b=ywEGy4FHsDT11UsUqorzNuG9CUA3V5ZxqZ1eW+NRYg6PR6Har7fLnXVQSUvc9OEdsL s0RItYnKIoVKiIurPexxVkrgbJaPimk/k+OhsZv8vzJ+DvKtplNB7RIq58Zd/jYORrja LoLBNaYabQn9ICdln+otp26cZZWthJUZNPybh5ODAZCDbN8dOa17hkkDXcdDYJGf7ZMq HhZ67dj2qbpADl8JPq1UuIcXp8ktiOZQixCiicgJYzfDXvO0sVig0p6ksLx2AARNmdFK pWVnHFLxuTgcAHss47JPnZKfSfmNhb4OSpnxMU65baeMdK8skKPhnZ6rN0p0zrwrnE8T JrQg== X-Gm-Message-State: AOAM532KZ96mmTdzhLwS9utZ8vMRcIWhaw82yCj70R6MLoRELXJ2l0lY CdAVy+AlMXYmOHjydy+Lc9MeuA== X-Received: by 2002:a7b:cbda:0:b0:397:48d6:6c9f with SMTP id n26-20020a7bcbda000000b0039748d66c9fmr28035077wmi.10.1654077843661; Wed, 01 Jun 2022 03:04:03 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:82c:5f0:58:ccc3:729d:30c2]) by smtp.gmail.com with ESMTPSA id i12-20020a7bc94c000000b0039736892653sm1468058wml.27.2022.06.01.03.04.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2022 03:04:03 -0700 (PDT) From: Loic Poulain To: trini@konsulko.com, kettenis@openbsd.org Cc: u-boot@lists.denx.de, Loic Poulain Subject: [PATCH 2/3] sha1: Fix digest state size/type Date: Wed, 1 Jun 2022 12:03:58 +0200 Message-Id: <1654077839-29147-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1654077839-29147-1-git-send-email-loic.poulain@linaro.org> References: <1654077839-29147-1-git-send-email-loic.poulain@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean sha1 digest size is 5*32-bit => 160-bit. Using 64-bit unsigned long does not cause issue with the current sha1 implementation, but could be problematic for vectorized access. Signed-off-by: Loic Poulain --- include/u-boot/sha1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/u-boot/sha1.h b/include/u-boot/sha1.h index 283f103..09fee59 100644 --- a/include/u-boot/sha1.h +++ b/include/u-boot/sha1.h @@ -30,7 +30,7 @@ extern const uint8_t sha1_der_prefix[]; typedef struct { unsigned long total[2]; /*!< number of bytes processed */ - unsigned long state[5]; /*!< intermediate digest state */ + uint32_t state[5]; /*!< intermediate digest state */ unsigned char buffer[64]; /*!< data block being processed */ } sha1_context;