Received: by 10.223.185.116 with SMTP id b49csp8837861wrg; Fri, 2 Mar 2018 08:46:57 -0800 (PST) X-Google-Smtp-Source: AG47ELvaBLmbUJnbHIP7Azaw1U+h4WLq7S0GBU13CEEkeKO1bvnEFKtdH0EByTu2qQWTJn4qFAl6 X-Received: by 2002:a17:902:b787:: with SMTP id e7-v6mr5832542pls.317.1520009217801; Fri, 02 Mar 2018 08:46:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520009217; cv=none; d=google.com; s=arc-20160816; b=vN5P+IKfC+6NjkIxpkoe6hTg+lHMyiqCmZdOZ2xRetoRJBbwaFeHKfat2o864t50vO kV1uknibcFf5YIpW8CjaQesYzeOQz5aEDATZRnKMQnrJTJqDdlixC4KgMyhQzHAYBcnl PS15tbI2XZqpZESWSqguH8zPQyOk141t1d4ZENYz/y5zr8mrK9lZSAhgG1Gws2384lWp +2VoTOQFmIxrRUvgxRlAvpYeYX0WMmbF2OldmxRZvfchEfm+uUNj3R1kin778jvbLEES h9HnvVvjcMyl8DRaJaqmcH9X+ACVW9cOz20pVpaMFVkChlZmxGWOYqU8Hrom18MIkqLi wyng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=eLq+khp3dtFp04kFnS6BAMYyn97+6fy1valmgANNCIA=; b=fRVnEdQ/B34sbhR99AW5ABG3EagpRyqvcGngzmwyvYCVXxI5tpxhXvFVGORbWdObGW jxr9TlRRseZBEKCJ86edV8+pmNM+1HrCn68oHdzWXR5iocN43sn1PrMRWaLASX0SAQQ2 X1zYLxxTb4QZRYub8TRUb9C8PxCEKD3Loi3lX+ntj3iD/ZBZ0CWdm2NftQbbIOksSafH GpD0udwf26G6TIw5LxpxmoR2R6TQeE/zC+x5nFmjVeWWQCNEsujs16UYhy0fHVnNK7XT nDyAJjgwfUP42j4PAeIMmvQtv+rn9ygf4bsxOp/Pf6TLX6+H+yyARalbwv0PfDanPq/m k7ww== 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 y5si4188252pgb.43.2018.03.02.08.46.43; Fri, 02 Mar 2018 08:46:57 -0800 (PST) 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 S968061AbeCBQpH (ORCPT + 99 others); Fri, 2 Mar 2018 11:45:07 -0500 Received: from orcrist.hmeau.com ([104.223.48.154]:59318 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966382AbeCBQpE (ORCPT ); Fri, 2 Mar 2018 11:45:04 -0500 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.84_2 #2 (Debian)) id 1ernni-00015e-TH; Sat, 03 Mar 2018 00:44:54 +0800 Received: from herbert by gondobar with local (Exim 4.84_2) (envelope-from ) id 1ernnf-0005kR-GY; Sat, 03 Mar 2018 00:44:51 +0800 Date: Sat, 3 Mar 2018 00:44:51 +0800 From: Herbert Xu To: "Maciej S. Szmigiero" Cc: "David S. Miller" , David Howells , Tom Lendacky , Gary Hook , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] crypto: ccp - return an actual key size from RSA max_size callback Message-ID: <20180302164451.GJ21579@gondor.apana.org.au> References: <51c265e4-6153-3e5e-316a-ebef059ac36a@maciej.szmigiero.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51c265e4-6153-3e5e-316a-ebef059ac36a@maciej.szmigiero.name> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 24, 2018 at 05:03:21PM +0100, Maciej S. Szmigiero wrote: > rsa-pkcs1pad uses a value returned from a RSA implementation max_size > callback as a size of an input buffer passed to the RSA implementation for > encrypt and sign operations. > > CCP RSA implementation uses a hardware input buffer which size depends only > on the current RSA key length, so it should return this key length in > the max_size callback, too. > This also matches what the kernel software RSA implementation does. > > Previously, the value returned from this callback was always the maximum > RSA key size the CCP hardware supports. > This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even > for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd() > tried to copy this large input buffer into a RSA key length-sized hardware > input buffer. > > Signed-off-by: Maciej S. Szmigiero > Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP") > Cc: stable@vger.kernel.org Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt