Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp808278pxb; Fri, 21 Jan 2022 03:56:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKciSSPgiGKwI8aQj4/DoZFH1NfcERisgVtDizWfDXxCVtuCk9IN5snvPeOZLZ7Mb5qm0A X-Received: by 2002:a63:5b10:: with SMTP id p16mr2649842pgb.230.1642766191023; Fri, 21 Jan 2022 03:56:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642766191; cv=none; d=google.com; s=arc-20160816; b=ZsLJpudo+smD+RIhjWRzE16vhf2NY2pwkWzE98s2vgyF9FIwPt3vUiFiWk65b4qYuw hZkF9OAVgHTKODQs1V2k4ErrN3+MO31rDNuZkMdEnURwUyEiR7h7W2QXT70VLd5j5iUS VXauJtD7FymYjFsybOzaXFIiM+8Cefg5Cs+BwBYj5IjEpRxnLXtQmkY5fbLezvJ9lxnK rs7cPREAHV1LQS/9Ugmcz7PifqyYvjCEmOK851mjM+3XXk18xkWurJJHEESmhrBP02cw m3F7kk2ZAHEnKW8nKOCby+OtjXRNIc68wg9SN+HkHwfv0zynwC0EhM7M4dGTv+OLfS2G 7PQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=F6I7BTc8Ttdsy8znMDaKaxuI/3+htoxSIpUGT/iAniE=; b=KWd/Uohd2hyCJ4AJNCORro5rZyPik5T+HO0m/P3pM8K+xFv7LPr5cUFbDcJwF3kEKT QBkUnJRlGENfNu23uqBT/2+yGYLgea2MTgj+V1FEU1Uhy5jNVI4lYv8BJlra0AcFA82E rLMLsJucY8EQM1DZ/PtY2Hk16Sz+8bCPd04I1OgGdsKfhgnDrFDzZl4R1GCex+en7QAK +p59jofxa9ePd6YmKjIwh1hb1gc7K29hA3tV2OPACyt9VHwvNjTrFN6kcqmujt3D/xqp zIpnQOYhSewlfNI3eNK32QMfqfwU/Un7jacX29FT7zQfqAtropYergJ/9WzIJAcA7kxD LYSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="aXCOo7/I"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d68si1697083pgc.193.2022.01.21.03.56.18; Fri, 21 Jan 2022 03:56:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="aXCOo7/I"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350417AbiASAW0 (ORCPT + 99 others); Tue, 18 Jan 2022 19:22:26 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:60896 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244782AbiASAWZ (ORCPT ); Tue, 18 Jan 2022 19:22:25 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0619D614BB; Wed, 19 Jan 2022 00:22:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32395C340E0; Wed, 19 Jan 2022 00:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642551744; bh=b429HbqqH8lUXICzovtu5109bnCHzy+254BIOm8+Gz0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aXCOo7/IhVJnUEXuLzfd9NklLIMxWxcNE77iGSprLJGG3T31wMa4NekDkA17SDp7T tcD0AeSA/OPu+DvIbFFYc3vL7KCQV96iedLiOMC8xSEelasSW1SZdZpkgniloijiCD rsU0VhazHGqvGd3xCtNX7hqbjm9ywy7yAN+eIXD0DVqFn3UV32ixEXwAdO+gqITgVu TAEVK2rlnvuktSDJIUFqVcY6t9a80dQmjM6XM7FDneWMqq37XkxhE7YQQU+rsMcKrh X889hA2mIBa1nkVXDQmEoxHXVFTupITSRYSRYWX2ZK8ivS+95u8VfaRqyjO7wp6iwU Hl6G8XdIkVKvw== Date: Tue, 18 Jan 2022 16:22:22 -0800 From: Eric Biggers To: Jarkko Sakkinen Cc: keyrings@vger.kernel.org, David Howells , linux-crypto@vger.kernel.org, Marcel Holtmann , Denis Kenzior , stable@vger.kernel.org Subject: Re: [PATCH] KEYS: fix length validation in keyctl_pkey_params_get_2() Message-ID: References: <20220113200454.72609-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Sat, Jan 15, 2022 at 11:26:16PM +0200, Jarkko Sakkinen wrote: > On Sat, Jan 15, 2022 at 11:53:34AM -0800, Eric Biggers wrote: > > On Sat, Jan 15, 2022 at 08:45:03PM +0200, Jarkko Sakkinen wrote: > > > On Thu, Jan 13, 2022 at 12:04:54PM -0800, Eric Biggers wrote: > > > > From: Eric Biggers > > > > > > > > In many cases, keyctl_pkey_params_get_2() is validating the user buffer > > > > lengths against the wrong algorithm properties. Fix it to check against > > > > the correct properties. > > > > > > > > Probably this wasn't noticed before because for all asymmetric keys of > > > > the "public_key" subtype, max_data_size == max_sig_size == max_enc_size > > > > == max_dec_size. However, this isn't necessarily true for the > > > > "asym_tpm" subtype (it should be, but it's not strictly validated). Of > > > > course, future key types could have different values as well. > > > > > > With a quick look, asym_tpm is TPM 1.x only, which only has 2048-bit RSA > > > keys. > > > > The code allows other lengths, as well as the case where the "RSA key size" > > doesn't match the "public key size". Probably both are bugs and they should > > both be 256 bytes (2048 bits) only. Anyway, that would be a separate fix. > > > > - Eric > > I'm fine with the current commit message. E.g. I have no idea at this > point whether there should be in future separate asym_tpm2 or all bundled > to asym_tpm. > > Acked-by: Jarkko Sakkinen > Okay, great. Just to be clear, I'm expecting either you or David (maintainer:KEYS/KEYRINGS) to apply this patch. Acked-by is usually given by a maintainer when someone else applies a patch. - Eric