Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp931468ybt; Wed, 24 Jun 2020 15:10:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUlaqpkJ9Dv78V7SUxTKVvKX/LSOVNIJOLqflY/W32txQo0zSeWOCiRgFowmZlT7bs+aBK X-Received: by 2002:aa7:c607:: with SMTP id h7mr29494328edq.214.1593036602312; Wed, 24 Jun 2020 15:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593036602; cv=none; d=google.com; s=arc-20160816; b=y3bd0UF597ODeYm3AEa0gWrfjlRMCrWN0wdsqH8Zm3ae8JpTDy+8vRALXtgp3fB0fL Q9Hj8F4CbQ5rHOMRn/6EHBYWbaF4hNm2e8To+YMcCKGVNVDj5kVrjzdvmpBjh+FkTD3h ZJY4u1dBMmm9phGfYBBeUmNHpAbh2iYqGX6EKddQfxkRuuIMBIXiL9nFVw6AGGZJ0XIy DcYqgOOp1E824drO4a4fek2IeaVTk9dzg/5Ex6UYiqfgaQ7KQgSljbzn1bgNh/JGvKyc 3A2/J3+YcXh7PvzSs/+U6/yZEiKiTUPLATjU6nvPnOOYL81ScwKAtolbmmFdoTaOxz5J uAZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:in-reply-to :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=EADfs1ylZAHsiM8IjKqv95Uwk2ZbTva/38FSCFX0Y4Y=; b=gDWNEP+Kr2LqyXsJMZhj70phPe3Tr73+ZTzJXBj+rxJ8Sv4fwjTTvbpTnQSImY8duH JPXl5k4tsiJGHaNXdKEGcTMr7miVXz6hMxib+pAWB6UG4u5HS2lyCLoxpp9jgH+uFaGW RFrnUfDA2F4FDfPSLHHzXzBFZ4bIqOTb7sV49QntDtm3W0I87sXP4//rt5ukrw5ieIal EFwJBo32r031aq/TpkWtG/OQiCk/Z1cOQrw5AM0nz+cmrLTujCRHokGd+EicSiTpYfFu HaIf2OVrsE8CLzZ7+Y8F6lAxCcZJb4r0LZUbQUYgcM1NenzwluXtm4A4QfLL1kVH7iVV lj7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UicxR0JI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si13137933ejp.577.2020.06.24.15.09.38; Wed, 24 Jun 2020 15:10:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@redhat.com header.s=mimecast20190719 header.b=UicxR0JI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405174AbgFXVuY (ORCPT + 99 others); Wed, 24 Jun 2020 17:50:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:36840 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2405141AbgFXVuW (ORCPT ); Wed, 24 Jun 2020 17:50:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593035420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EADfs1ylZAHsiM8IjKqv95Uwk2ZbTva/38FSCFX0Y4Y=; b=UicxR0JIdlQTkMWG8YdMSEybAZHXne/nidKzFa7xww0UTUJa7n4AmCwA8YJlIw2fJUzvnU oztdeahukkL4ozob+fIvI0IfLonqPUwKcfHldSSdtAVUdkkZmOLoV3QiVU4TGc+YEovf9e /1A/78IU6YJ2uNqT515Emkgg5+FH3/k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-JDiVSOwfPXK8klyO4PRXhg-1; Wed, 24 Jun 2020 17:50:15 -0400 X-MC-Unique: JDiVSOwfPXK8klyO4PRXhg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B651880400D; Wed, 24 Jun 2020 21:50:13 +0000 (UTC) Received: from localhost (ovpn-116-62.gru2.redhat.com [10.97.116.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id E954160F8A; Wed, 24 Jun 2020 21:50:12 +0000 (UTC) Date: Wed, 24 Jun 2020 18:50:11 -0300 From: Bruno Meneguele To: Maurizio Drocco Cc: Silviu.Vlasceanu@huawei.com, dmitry.kasatkin@gmail.com, jejb@linux.ibm.com, jmorris@namei.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, mdrocco@linux.vnet.ibm.com, roberto.sassu@huawei.com, serge@hallyn.com, stefanb@linux.ibm.com, zohar@linux.ibm.com Subject: Re: [PATCH v3] ima_evm_utils: extended calc_bootaggr to PCRs 8 - 9 Message-ID: <20200624215011.GC2639@glitch> References: <20200624213345.GB2639@glitch> <20200624213558.4265-1-maurizio.drocco@ibm.com> MIME-Version: 1.0 In-Reply-To: <20200624213558.4265-1-maurizio.drocco@ibm.com> X-PGP-Key: http://keys.gnupg.net/pks/lookup?op=get&search=0x3823031E4660608D X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hOcCNbCCxyk/YU74" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --hOcCNbCCxyk/YU74 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 24, 2020 at 05:35:58PM -0400, Maurizio Drocco wrote: > From: Maurizio >=20 > cal_bootaggr should include PCRs 8-9 in non-SHA1 digests. >=20 > Signed-off-by: Maurizio Drocco > --- > Changelog: > v3: > - Fixed patch description > v2: > - Always include PCRs 8 & 9 to non-sha1 hashes > v1: > - Include non-zero PCRs 8 & 9 to boot aggregates >=20 > src/evmctl.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) >=20 > diff --git a/src/evmctl.c b/src/evmctl.c > index 1d065ce..46b7092 100644 > --- a/src/evmctl.c > +++ b/src/evmctl.c > @@ -1930,6 +1930,16 @@ static void calc_bootaggr(struct tpm_bank_info *ba= nk) > =09=09} > =09} > =20 > +=09if (strcmp(bank->algo_name, "sha1") !=3D 0) { > +=09=09for (i =3D 8; i < 10; i++) { > +=09=09=09err =3D EVP_DigestUpdate(pctx, bank->pcr[i], bank->digest_size)= ; > +=09=09=09if (!err) { > +=09=09=09=09log_err("EVP_DigestUpdate() failed\n"); > +=09=09=09=09return; > +=09=09=09} > +=09=09} > +=09} > + > =09err =3D EVP_DigestFinal(pctx, bank->digest, &mdlen); > =09if (!err) { > =09=09log_err("EVP_DigestFinal() failed\n"); > @@ -1972,8 +1982,9 @@ static int append_bootaggr(char *bootaggr, struct t= pm_bank_info *tpm_banks) > /* > * The IMA measurement list boot_aggregate is the link between the prebo= ot > * event log and the IMA measurement list. Read and calculate all the > - * possible per TPM bank boot_aggregate digests based on the existing > - * PCRs 0 - 7 to validate against the IMA boot_aggregate record. > + * possible per TPM bank boot_aggregate digests based on the existing PC= Rs > + * 0 - 9 to validate against the IMA boot_aggregate record. If the diges= t > + * algorithm is SHA1, only PCRs 0 - 7 are considered to avoid ambiguity. > */ > static int cmd_ima_bootaggr(struct command *cmd) > { > --=20 > 2.17.1 >=20 Reviewed-by: Bruno Meneguele Thanks. --=20 bmeneg=20 PGP Key: http://bmeneg.com/pubkey.txt --hOcCNbCCxyk/YU74 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEdWo6nTbnZdbDmXutYdRkFR+RokMFAl7zypMACgkQYdRkFR+R okOR8QgAqksSST2NxdrLiv6YuDGV9UrvTKoio+IEmlosYWxa/qXi2/oUvH3+zNG3 lnCxXjTkC1MDsyx2OInElaiJpdMdtUp/9J+1UBv3+tuBA3a0GmGKZd1+6rQNxDMG 1m8Saa0JjSD6H+iGuGydVSNkDr5g6IxIP3p6+ZiCEEh2qp4iwhiNS4OkUscdWcNF YEOyE+XEkuaV5oywwo0Oz2Zv3Pb/etl2AoS80mGfAQDQhBXHVVQb5f6tHde11vFw tnDpG8bDkzo2C7w6xiEmYcAuChJZp+/nxn4jSuitHz9XMZBYP79Rdage1mpSwxEA 4/u11ZssxGWuQjrUZ2wRsw4li8ykrg== =ioxk -----END PGP SIGNATURE----- --hOcCNbCCxyk/YU74--