From patchwork Wed Apr 14 02:55:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 421083 Delivered-To: patch@linaro.org Received: by 2002:a02:c4d2:0:0:0:0:0 with SMTP id h18csp3172227jaj; Tue, 13 Apr 2021 19:59:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpq3JJmX4612q3XIZ80EQQjTUuyi6VBhClQt9H1Hakyeam/JNKmE+LSpN5VaoHiyULkISp X-Received: by 2002:a17:907:3f8b:: with SMTP id hr11mr36122800ejc.477.1618369161837; Tue, 13 Apr 2021 19:59:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618369161; cv=none; d=google.com; s=arc-20160816; b=SOixPBcXD268aPz9wlGUW7wQxVOlxvHEQYywDuXMPw0FykCsDWnuK2gJjTl1C23mWN kFhkwKJzcgsdJw1HGKQKblp795e9f58fHKUbIpdnFu0Rw0GoUfNRn6RAtRMl4CZ5t6/e EEm63DRVlp2Tglr46for1SennRu1W8OQ1bocA1NnmuJ3AV6BsOSz09g52tIcmNZooIuE upkCHDAIWwBeuYmGWyLHTq655aD/2ZUl/9uPCscJBQLMM6OL+f0PgrBwCVNWXb/WxnSV cEqGVm5hnz8/sgimWnnUrBJpiIsaW6fqA/zJ2vJZuZIROwVBRMrbuzpOVKADLI1pmMNW WQEg== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=Cqo4wG5QSvm9mQL40mhAm7DCw6/PrCxfNXEOt2hOBZc=; b=LDrkQ2ilYi78fJjmjGsWbImBUiokUV8WT4bIlm6TPBi4p3xq7NxC6OrZedt0iVtzaq ayxRrjoqMuHh6SPzsC0LPNxKx0bUDm2BMIKuH33iZ0SG/kj5IhQjzrC4wxZ/OB2igADX /XSkCwrJTJCvvqTokEZ/1xPfjVgqK6NGHqOLgD3JCg/+abTdCC1fhDl+YyEBnl6tBv7l WRtJTUxQc0uKnSpwhO9gpYD/xbb227r+4i76M576FvJVS8sr8yTnrj/yrYrPctp2xb72 F1jMuInq35/oXC98eoM+A1smqNTK8JiLWANpsWbQA3M/kQqi4C8O7Bv+wOvzMPg+D/rv CL4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=krMbTaox; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id dy26si11091696edb.174.2021.04.13.19.59.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 19:59:21 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=krMbTaox; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 9E4BB81D09; Wed, 14 Apr 2021 04:59:16 +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="krMbTaox"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E88AF81D0B; Wed, 14 Apr 2021 04:50:20 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 BDE4081CE7 for ; Wed, 14 Apr 2021 04:50:16 +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=masahisa.kojima@linaro.org Received: by mail-pj1-x1030.google.com with SMTP id lt13so655006pjb.1 for ; Tue, 13 Apr 2021 19:50:16 -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; bh=Cqo4wG5QSvm9mQL40mhAm7DCw6/PrCxfNXEOt2hOBZc=; b=krMbTaoxhy5Pw7Canuuzc0CYckD5LlOF0IzXHdSPuFPK1yVp9As4xi8fCaUkuOmjmh qLgrYh2gPMvwL90bqoLUwM11YfiSfn7Hqben37EprtPkRFzfq+3AqrlT5ynifjGTYtI/ DI5rLK0Q0iqTyM9KsNXnacha3RuQd9tCBUdvC2Q48eq8KQKKhCxUEDbGgtfoQITLnX+0 RxYD7ubqSCaWotUCDkU0aQsM0hWm3esIMi/WuimE071AMD8QUvGCbFRJeH3IMHU6eFn/ rX7NoHkMFt4v9D/HmYi6g12KjE1BAJiX8GUB0wj7nVwowRm62ax5hIgYUmLoeNCuyxmW jV5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Cqo4wG5QSvm9mQL40mhAm7DCw6/PrCxfNXEOt2hOBZc=; b=A8RnsTZPvS2R9bMiTPRyazccYcGvpAhdjdImbb39m0/9nTNtHShDfVWuLc/cXwGYAW 3npcuN+whGC8dLZ2cUOW1LrvzDGnogsgDli5vvj4i7Eci4C8kydacX12K0lN4ZNYBLiN S1mAaSCpBM/s5KAiIaumDce2+itjloLEVLkonEbFUFVBMlZAqlAUfRzbHgnr/TLPfA7+ Ug+RK3AKFG5MA3KE0aLPVN64lMlzaPnI1cKHn41/KHVY4/Oq8vIG2OLajwGrUMN/U23X boT1MweGNtYTNIlX2p2YpfPf+zMF16RM2DjL+Shq27oO+cTb1DnOBUmqlztwkOvgJ0T/ 1xfA== X-Gm-Message-State: AOAM530N3EWNT8MUuH6zVzklczgde4SgSMbJoYO6B5SHeMXd+NCujHal NsJc5lRjbBYLKGT0MUmj7KuP6w== X-Received: by 2002:a17:90a:4406:: with SMTP id s6mr972487pjg.93.1618368614125; Tue, 13 Apr 2021 19:50:14 -0700 (PDT) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id t184sm15757149pgt.32.2021.04.13.19.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 19:50:13 -0700 (PDT) From: Masahisa Kojima To: xypron.glpk@gmx.de Cc: agraf@csgraf.de, u-boot@lists.denx.de, ilias.apalodimas@linaro.org, Masahisa Kojima Subject: [PATCH] efi_loader: fix possible buffer overflow Date: Wed, 14 Apr 2021 11:55:49 +0900 Message-Id: <20210414025549.7403-1-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Wed, 14 Apr 2021 04:59:15 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Variable "final" will have SHA512 digest, but currently the array size is not sufficient. Let's fix it. Signed-off-by: Masahisa Kojima --- lib/efi_loader/efi_tcg2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index ed86a220fb..d5eca68769 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -515,7 +515,7 @@ static efi_status_t tcg2_create_digest(const u8 *input, u32 length, sha1_context ctx; sha256_context ctx_256; sha512_context ctx_512; - u8 final[TPM2_ALG_SHA512]; + u8 final[TPM2_SHA512_DIGEST_SIZE]; efi_status_t ret; u32 active; int i;