Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp606732yba; Thu, 18 Apr 2019 06:45:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnTLpcFkM4gAj9e0aGy/N0cjt+gv/Fd+0MlaFCTNcIVidoktjTbfX9EhBSg4XYhNt/JdOy X-Received: by 2002:a63:f40d:: with SMTP id g13mr90707800pgi.345.1555595103018; Thu, 18 Apr 2019 06:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555595103; cv=none; d=google.com; s=arc-20160816; b=jYrJhs//UdWw/Ow4c8MGpNAEzvXU9WYygpbu/590a4m6utV0mOdYUTn9aZaKPlZ5x5 fqzKRzn792UvHfhc/R4R8r2WbrbOdTsb/znixOE5V+TsS/Z7iurxmFAT76VGEs+apFCb ZuGFizd7qW+7lZ+ACDliGLVEjnTHaUALnrtk17bEeGi1e94Ca7IbYcsT8rqcgIeU9aXt ekNu4rTpeoRAKCm3cZCUx2z46a5GWJ3tAH4jq9lnR1WcZBwo41s8LflbY8r/UD6p1ktJ 98S3j93o+7b/OagbYA67AafLxQTTulqe/3n8MeawQ280tEZuS9MiiOMgni9iSZ4N0KvO 5Wgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=csrECCfVu3zxeskLL/s5BUMKlkqF4YQY9itdP1pmJ0U=; b=bi3MhwYXzQcEH9FuK14AeD/BApxZLHSnb8UNtJLMMQMBjNAdVIAwRbpr6Z/eBgqFMB gwbxypaWAexhb8yi6hJK1GDP4nYJ6W+38m3Em7AtYJvogOfXFU7ajUd/FvWgl2zIrfQr RgLEmFEgxH+GLSx35oZA9P3AYJI7OPPlQfG4yhIZ8+cxVy8M1MOk6qnZuktzY8ZeVJjP eEYscqPyNuIustJH2Q9pVuzJ78pPdM4CKm8G0HVdJFSL8KmMOAfcwmu2mY7mVz/CmjwT +plcSELVLW3FK+98SkfT56LZwW4qsAptmOSZoSglju1boo8RXSKrXyG8urx8tDnsxXuH Ikxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p66si1312852pga.15.2019.04.18.06.44.47; Thu, 18 Apr 2019 06:45:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389458AbfDRNl5 (ORCPT + 99 others); Thu, 18 Apr 2019 09:41:57 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33726 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389226AbfDRNlz (ORCPT ); Thu, 18 Apr 2019 09:41:55 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 22A9C80D; Thu, 18 Apr 2019 06:41:55 -0700 (PDT) Received: from e110176-lin.kfn.arm.com (e110176-lin.kfn.arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A9193F5AF; Thu, 18 Apr 2019 06:41:53 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , stable@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 27/35] crypto: ccree: use correct internal state sizes for export Date: Thu, 18 Apr 2019 16:39:02 +0300 Message-Id: <20190418133913.9122-28-gilad@benyossef.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418133913.9122-1-gilad@benyossef.com> References: <20190418133913.9122-1-gilad@benyossef.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We were computing the size of the import buffer based on the digest size but the 318 and 224 byte variants use 512 and 256 bytes internal state sizes respectfully, thus causing the import buffer to overrun. Fix it by using the right sizes. Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org # v4.19+ --- drivers/crypto/ccree/cc_hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccree/cc_hash.c b/drivers/crypto/ccree/cc_hash.c index 940101fee68e..36e9fb4141f8 100644 --- a/drivers/crypto/ccree/cc_hash.c +++ b/drivers/crypto/ccree/cc_hash.c @@ -1633,7 +1633,7 @@ static struct cc_hash_template driver_hash[] = { .setkey = cc_hash_setkey, .halg = { .digestsize = SHA224_DIGEST_SIZE, - .statesize = CC_STATE_SIZE(SHA224_DIGEST_SIZE), + .statesize = CC_STATE_SIZE(SHA256_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA224, @@ -1660,7 +1660,7 @@ static struct cc_hash_template driver_hash[] = { .setkey = cc_hash_setkey, .halg = { .digestsize = SHA384_DIGEST_SIZE, - .statesize = CC_STATE_SIZE(SHA384_DIGEST_SIZE), + .statesize = CC_STATE_SIZE(SHA512_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA384, -- 2.21.0