Received: by 10.213.65.68 with SMTP id h4csp658969imn; Fri, 6 Apr 2018 06:55:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx48DVwLbrbp1wOf900HoeBzphROlqsgWgM0vaM4W69zydcMk3Ii0kI8gzbhHDHYi+B1dtv7W X-Received: by 2002:a17:902:9a81:: with SMTP id w1-v6mr27106728plp.148.1523022920930; Fri, 06 Apr 2018 06:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523022920; cv=none; d=google.com; s=arc-20160816; b=G18FAZhQlCuB2WRtNis8QOyYHXl4zaVrULBpVmEbkEdIuQ7resE+SDHJfnQfXBopbn 8tiV++wsh44IiAveuoLB21gRyML9SP3bILR+MAtsM8HqumY/ghm4VJwAYu1oQkhXS8Ef z5DXlMUMNM5VwPaqAjBB8uoTY8XfDIELUR+vFYACQfhQFKGUFMHDNvyE2Y3Th6K6mwfN RLC4Qs/7jeSw8N/df29R93nUtAhSm3sf/5z1uq0U1ii3EIFMHGKnbZkFFK3/bwXFpx9i n+PMsUqxDeaZmBA+CeUbVCrLBIlex+/N1sOXixs8cGUkorIwxQNlmlIicaMLJLymeYhq xs/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=glKlSm8E70c+/4zYYwxHuoaDeMM1VycXQHqutQr+Pic=; b=h8N711J8CJ8a0X53Bwk18jpJvdHTpEINckyqbr/HGftKsgWxmnYaiLw4z9mWobHma7 Kx8AY8+I3/HTx0GmmKRZDtpeLyrbfdz5NewqwEQM/CvYXKLRdNViWZibyfjrpxHiYXxp sokA7Nny5Yqy4YWLRH815O2DPga+sYnItLiDLaWlc0ifinc+HCM89IntQMu4wF2XTToo uQy8MML77VmgGxt0cneSNAnG4wQg0XG6WJpIsD2Wr7l86VUhc5KFKIuY4MmLI1UZEQhC yhPI/+fyH1d9v5YiI6lBRICbjzKQDbOIsf+0etQyL+zWfdMlNrIAtRbQS8vOGGBeTiTn UYnA== 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 e4si8145197pfb.204.2018.04.06.06.55.07; Fri, 06 Apr 2018 06:55:20 -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 S1756910AbeDFNoX (ORCPT + 99 others); Fri, 6 Apr 2018 09:44:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37676 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756900AbeDFNoU (ORCPT ); Fri, 6 Apr 2018 09:44:20 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CE191E06; Fri, 6 Apr 2018 13:44:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gary R Hook , Herbert Xu Subject: [PATCH 4.16 11/31] crypto: ccp - Fill the result buffer only on digest, finup, and final ops Date: Fri, 6 Apr 2018 15:24:36 +0200 Message-Id: <20180406084342.606416182@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084340.999820380@linuxfoundation.org> References: <20180406084340.999820380@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gary R Hook commit 0ee991be4cdd88587aedbf68cdacd1765f57236a upstream. Any change to the result buffer should only happen on final, finup and digest operations. Changes to the buffer for update, import, export, etc, are not allowed. Fixes: 66d7b9f6175e ("crypto: testmgr - test misuse of result in ahash") Signed-off-by: Gary R Hook Cc: Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccp/ccp-crypto-aes-cmac.c | 2 +- drivers/crypto/ccp/ccp-crypto-sha.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c +++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c @@ -46,7 +46,7 @@ static int ccp_aes_cmac_complete(struct } /* Update result area if supplied */ - if (req->result) + if (req->result && rctx->final) memcpy(req->result, rctx->iv, digest_size); e_free: --- a/drivers/crypto/ccp/ccp-crypto-sha.c +++ b/drivers/crypto/ccp/ccp-crypto-sha.c @@ -47,7 +47,7 @@ static int ccp_sha_complete(struct crypt } /* Update result area if supplied */ - if (req->result) + if (req->result && rctx->final) memcpy(req->result, rctx->ctx, digest_size); e_free: