From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C65E8C43217 for ; Fri, 4 Nov 2022 18:34:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232108AbiKDSeB (ORCPT ); Fri, 4 Nov 2022 14:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbiKDSd6 (ORCPT ); Fri, 4 Nov 2022 14:33:58 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8877F45EFA for ; Fri, 4 Nov 2022 11:33:56 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id e129so5070089pgc.9 for ; Fri, 04 Nov 2022 11:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cHlujkwLHQA1OWRlitXKA2okTr4nOrBSjZdPzF8hE5c=; b=fYGdM/Tg8Tza7nWYNx1gvE5AjwWtFIuP2aMr7NSPrgUEcKXetw2efj4K9ltVVjew/O hfXJ6HTPJXObLs10g0NdIXaQf1I9XXduYXsuLGv+V9dxSo0TvDryLnn2dlG70bCeTkio Mvw0wCqrgxfpNUxlYb3257rRnrsy7wsaQJrD0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cHlujkwLHQA1OWRlitXKA2okTr4nOrBSjZdPzF8hE5c=; b=LVayhd3Fw7jHIVhvN67Ur7vgawbYJV2PIZUjBRrEVw+SbEnCBl8t+4a7aYAJYzQI1l b5hedgtRs/Uy1e4tBKaRKukWbCL4g6My7XuB7MpkiAvtZMwbdFFutk4gM5k/BJ8oZUSL l1FYNb4CK1mGw7ZgokFowsSzsF1rrrKoYahKM0iqXD+UPKqcF2dmNhSUN9hysWj9UNam orEB6UtW26jZ593jLc9O1tWDTxFCgi69dXLyJYMcTrauKKVwpsGDIGewyZAr/1pHvQYh yf4ulT7Z9+4lpoUnU1TmAEJp636deohW2sqGy13bogMYBIDIWPTie9OPEzXtf0NezUwp 5aDw== X-Gm-Message-State: ACrzQf36fcr6iSjgRQ9r7JpG34o4boOLV5HtaB9EvKecdp3hbG1wNHFK 0DhoxpYMEcvhUR0mpXDoEVfW0w== X-Google-Smtp-Source: AMsMyM6rQqEYsHld7hqlGdxSuOaXH5JXb85iYTOBX6NHfyLfqeh7au3t/GuMFJWcTQ45Yl98zYA5gw== X-Received: by 2002:a63:c65:0:b0:470:cb4:aca3 with SMTP id 37-20020a630c65000000b004700cb4aca3mr11424330pgm.389.1667586835979; Fri, 04 Nov 2022 11:33:55 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g8-20020a17090a640800b00205fafa6768sm1990807pjj.6.2022.11.04.11.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 11:33:55 -0700 (PDT) Date: Fri, 4 Nov 2022 11:33:54 -0700 From: Kees Cook To: Evan Green Cc: linux-kernel@vger.kernel.org, corbet@lwn.net, linux-pm@vger.kernel.org, rjw@rjwysocki.net, gwendal@chromium.org, apronin@chromium.org, Pavel Machek , Matthew Garrett , linux-integrity@vger.kernel.org, jejb@linux.ibm.com, zohar@linux.ibm.com, dlunev@google.com, Eric Biggers , Ben Boeckel , jarkko@kernel.org, David Howells , James Morris , Paul Moore , "Serge E. Hallyn" , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH v4 04/11] security: keys: trusted: Include TPM2 creation data Message-ID: <202211041132.E8CB636@keescook> References: <20221103180120.752659-1-evgreen@chromium.org> <20221103105558.v4.4.Ieb1215f598bc9df56b0e29e5977eae4fcca25e15@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221103105558.v4.4.Ieb1215f598bc9df56b0e29e5977eae4fcca25e15@changeid> Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org On Thu, Nov 03, 2022 at 11:01:12AM -0700, Evan Green wrote: > In addition to the private key and public key, the TPM2_Create > command may also return creation data, a creation hash, and a creation > ticket. These fields allow the TPM to attest to the contents of a > specified set of PCRs at the time the trusted key was created. Encrypted > hibernation will use this to ensure that PCRs settable only by the > kernel were set properly at the time of creation, indicating this is an > authentic hibernate key. > > Encode these additional parameters into the ASN.1 created to represent > the key blob. The new fields are made optional so that they don't bloat > key blobs which don't need them, and to ensure interoperability with > old blobs. > > Signed-off-by: Evan Green There's a lot of open-coded math for the bounds checking. I didn't immediately see any problems, but it'd be nice if there was a way to hook a fuzzer up to this, or at least write some KUnit tests to check boundary conditions explicitly. Reviewed-by: Kees Cook -- Kees Cook