From nobody Sat Feb 7 06:20:54 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org ARC-Seal: i=1; a=rsa-sha256; t=1585369576; cv=none; d=zohomail.com; s=zohoarc; b=QFGhLkNGx8oOf2DJwmHi15buOxomJklDawTzJgiDCMpyIbWMzUW38DFrmCW2UODW/pLCHvxazqhWgNq+ueqtpMbuI+94sBL6pLE3BE75kxfKcAvYmiUVM32FLcXTApFVNBbZvYqV1P2wCNJM+CSSMiEtxAumqmFTiW7NVr0gbXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585369576; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=QfVkIr+Hk/wAC23r6tyr/kHJd//GDCqi2cwIVfTRhYY=; b=diLD+L3Q0THwHcoGgim+1zWbB6o9w3DaSwCGnO2IYKESVsdfBFVI55Q6RpHQQx3f9B2JOb/P/UmAzWwFcV9cJdu14PvGyilAK2UiQoT7Ee6brfLLM6kRAD4C7p+fWR6QXKitWk6Pc9AxUnSsrbB2SAbW0QHeg2VENAZj+lQTXYU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 158536957678760.73494693373857; Fri, 27 Mar 2020 21:26:16 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 3C77EB01A30; Sat, 28 Mar 2020 04:26:13 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id ABF29B00165 for ; Sat, 28 Mar 2020 04:25:54 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02S33d1W125666; Fri, 27 Mar 2020 23:27:37 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywd8hgv4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Mar 2020 23:27:37 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by ppma01dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02S3ROKX017531; Sat, 28 Mar 2020 03:27:36 GMT Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by ppma01dal.us.ibm.com with ESMTP id 301x768722-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 28 Mar 2020 03:27:36 +0000 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02S3RZft14090796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 28 Mar 2020 03:27:35 GMT Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by IMSVA (Postfix) with ESMTP id 35B3AB205F; Sat, 28 Mar 2020 03:27:35 +0000 (GMT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by IMSVA (Postfix) with ESMTP id 1EB96B2065; Sat, 28 Mar 2020 03:27:35 +0000 (GMT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Sat, 28 Mar 2020 03:27:35 +0000 (GMT) From: Stefan Berger To: seabios@seabios.org, kevin@koconnor.net Date: Fri, 27 Mar 2020 23:27:33 -0400 Message-Id: <20200328032733.841258-4-stefanb@linux.vnet.ibm.com> In-Reply-To: <20200328032733.841258-1-stefanb@linux.vnet.ibm.com> References: <20200328032733.841258-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-27_09:2020-03-27,2020-03-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003280023 X-Spam-Level: *** Message-ID-Hash: 5KKOPOV2VZVYQI74UWTNF35MHCPB5YSU X-Message-ID-Hash: 5KKOPOV2VZVYQI74UWTNF35MHCPB5YSU X-MailFrom: stefanb@linux.vnet.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Stefan Berger X-Mailman-Version: 3.3.1 Precedence: list Subject: [SeaBIOS] [PATCH 3/3] tcgbios: Add support for SHA3 type of algorithms List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / Content-Type: text/plain; charset="utf-8" Add support for SHA3 type of algorithms that a TPM2 may support some time in the future. Signed-off-by: Stefan Berger Reviewed-by: Marc-Andr=C3=A9 Lureau --- src/std/tcg.h | 9 +++++++++ src/tcgbios.c | 22 +++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/std/tcg.h b/src/std/tcg.h index 1c9eeb4..98cca49 100644 --- a/src/std/tcg.h +++ b/src/std/tcg.h @@ -8,6 +8,9 @@ #define SHA384_BUFSIZE 48 #define SHA512_BUFSIZE 64 #define SM3_256_BUFSIZE 32 +#define SHA3_256_BUFSIZE 32 +#define SHA3_384_BUFSIZE 48 +#define SHA3_512_BUFSIZE 64 =20 =20 /**************************************************************** @@ -335,12 +338,18 @@ struct tpm_res_sha1complete { #define TPM2_ALG_SHA384 0x000c #define TPM2_ALG_SHA512 0x000d #define TPM2_ALG_SM3_256 0x0012 +#define TPM2_ALG_SHA3_256 0x0027 +#define TPM2_ALG_SHA3_384 0x0028 +#define TPM2_ALG_SHA3_512 0x0029 =20 #define TPM2_ALG_SHA1_FLAG (1 << 0) #define TPM2_ALG_SHA256_FLAG (1 << 1) #define TPM2_ALG_SHA384_FLAG (1 << 2) #define TPM2_ALG_SHA512_FLAG (1 << 3) #define TPM2_ALG_SM3_256_FLAG (1 << 4) +#define TPM2_ALG_SHA3_256_FLAG (1 << 5) +#define TPM2_ALG_SHA3_384_FLAG (1 << 6) +#define TPM2_ALG_SHA3_512_FLAG (1 << 7) =20 /* TPM 2 command tags */ #define TPM2_ST_NO_SESSIONS 0x8001 diff --git a/src/tcgbios.c b/src/tcgbios.c index 99005b9..25ae0c8 100644 --- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -156,9 +156,10 @@ static struct tpml_pcr_selection *tpm20_pcr_selection; struct tpm_log_entry { struct tpm_log_header hdr; u8 pad[sizeof(struct tpm2_digest_values) - + 5 * sizeof(struct tpm2_digest_value) + + 8 * sizeof(struct tpm2_digest_value) + SHA1_BUFSIZE + SHA256_BUFSIZE + SHA384_BUFSIZE - + SHA512_BUFSIZE + SM3_256_BUFSIZE]; + + SHA512_BUFSIZE + SM3_256_BUFSIZE + SHA3_256_BUFSIZE + + SHA3_384_BUFSIZE + SHA3_512_BUFSIZE]; } PACKED; =20 static const struct hash_parameters { @@ -192,6 +193,21 @@ static const struct hash_parameters { .hashalg_flag =3D TPM2_ALG_SM3_256_FLAG, .hash_buffersize =3D SM3_256_BUFSIZE, .name =3D "SM3-256", + }, { + .hashalg =3D TPM2_ALG_SHA3_256, + .hashalg_flag =3D TPM2_ALG_SHA3_256_FLAG, + .hash_buffersize =3D SHA3_256_BUFSIZE, + .name =3D "SHA3-256", + }, { + .hashalg =3D TPM2_ALG_SHA3_384, + .hashalg_flag =3D TPM2_ALG_SHA3_384_FLAG, + .hash_buffersize =3D SHA3_384_BUFSIZE, + .name =3D "SHA3-384", + }, { + .hashalg =3D TPM2_ALG_SHA3_512, + .hashalg_flag =3D TPM2_ALG_SHA3_512_FLAG, + .hash_buffersize =3D SHA3_512_BUFSIZE, + .name =3D "SHA3-512", } }; =20 @@ -252,7 +268,7 @@ tpm20_write_EfiSpecIdEventStruct(void) =20 struct { struct TCG_EfiSpecIdEventStruct hdr; - u8 pad[256]; + u8 pad[sizeof(struct tpm_log_entry)]; } event =3D { .hdr.signature =3D "Spec ID Event03", .hdr.platformClass =3D TPM_TCPA_ACPI_CLASS_CLIENT, --=20 2.24.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org