public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Zhang, Chao B" <chao.b.zhang@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Zhang, Chao B" <chao.b.zhang@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH 1/2] SecurityPkg: Tcg2Dxe: Log Startup Locality Event
Date: Mon, 23 Jan 2017 15:25:16 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A8E467A@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20170123085155.21056-1-chao.b.zhang@intel.com>

Hi
StartupLocality is a platform policy. We should not hardcode it.

We may use one of below ways:
1) Define a new PCD.
2) Detect if there is an startuplocality event hob reported in PEI phase.

Thank you
Yao Jiewen

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zhang,
> Chao B
> Sent: Monday, January 23, 2017 4:52 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zhang, Chao B
> <chao.b.zhang@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH 1/2] SecurityPkg: Tcg2Dxe: Log Startup Locality Event
>
> Log Startup Locality Event according to TCG PC Client PFP 00.21.
> Event should be placed before any extend to PCR[0]
> http://www.trustedcomputinggroup.org/wp-content/uploads/PC-ClientSpecific
> _Platform_Profile_for_TPM_2p0_Systems_v21.pdf
>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Yao Jiewen <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
> ---
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 48
> ++++++++++++++++++++++++++++++---------
>  1 file changed, 37 insertions(+), 11 deletions(-)
>
> diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> index 3534fd1..2658944 100644
> --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> @@ -1381,11 +1381,12 @@ SetupEventLog (
>    UINT32                          HashAlgorithmMaskCopied;
>    TCG_EfiSpecIDEventStruct        *TcgEfiSpecIdEventStruct;
>    UINT8
> TempBuf[sizeof(TCG_EfiSpecIDEventStruct) + sizeof(UINT32) + (HASH_COUNT *
> sizeof(TCG_EfiSpecIdEventAlgorithmSize)) + sizeof(UINT8)];
> -  TCG_PCR_EVENT_HDR               FirstPcrEvent;
> +  TCG_PCR_EVENT_HDR               NoActionEvent;
>    TCG_EfiSpecIdEventAlgorithmSize *DigestSize;
>    TCG_EfiSpecIdEventAlgorithmSize *TempDigestSize;
>    UINT8                           *VendorInfoSize;
>    UINT32                          NumberOfAlgorithms;
> +  TCG_EfiStartupLocalityEvent     StartupLocalityEvent;
>
>    DEBUG ((EFI_D_INFO, "SetupEventLog\n"));
>
> @@ -1468,24 +1469,49 @@ SetupEventLog (
>          VendorInfoSize = (UINT8 *)TempDigestSize;
>          *VendorInfoSize = 0;
>
> +        NoActionEvent.PCRIndex = 0;
> +        NoActionEvent.EventType = EV_NO_ACTION;
> +        ZeroMem (&NoActionEvent.Digest, sizeof(NoActionEvent.Digest));
> +        NoActionEvent.EventSize = (UINT32)GetTcgEfiSpecIdEventStructSize
> (TcgEfiSpecIdEventStruct);
> +
>          //
> -        // FirstPcrEvent
> +        // Log TcgEfiSpecIdEventStruct as the first Event
> +        //   TCG PC Client PFP spec. Section 9.2 Measurement Event Entries
> and Log
>          //
> -        FirstPcrEvent.PCRIndex = 0;
> -        FirstPcrEvent.EventType = EV_NO_ACTION;
> -        ZeroMem (&FirstPcrEvent.Digest, sizeof(FirstPcrEvent.Digest));
> -        FirstPcrEvent.EventSize = (UINT32)GetTcgEfiSpecIdEventStructSize
> (TcgEfiSpecIdEventStruct);
> +        Status = TcgDxeLogEvent (
> +                   mTcg2EventInfo[Index].LogFormat,
> +                   &NoActionEvent,
> +                   sizeof(NoActionEvent),
> +                   (UINT8 *)TcgEfiSpecIdEventStruct,
> +                   NoActionEvent.EventSize
> +                   );
>
>          //
> -        // Record
> +        // EfiStartupLocalityEvent
> +        //
> +        CopyMem (StartupLocalityEvent.Signature,
> TCG_EfiStartupLocalityEvent_SIGNATURE,
> sizeof(StartupLocalityEvent.Signature));
> +        //
> +        // SRTM uses Locality 0 to access the TPM according to PC Client PFP
> spec 2.2.1
> +        //
> +        StartupLocalityEvent.StartupLocality = LOCALITY_0_INDICATOR;
> +
> +        NoActionEvent.PCRIndex = 0;
> +        NoActionEvent.EventType = EV_NO_ACTION;
> +        ZeroMem (&NoActionEvent.Digest, sizeof(NoActionEvent.Digest));
> +        NoActionEvent.EventSize = sizeof(StartupLocalityEvent);
> +
> +        //
> +        // Log EfiStartupLocalityEvent as the second Event
> +        //   TCG PC Client PFP spec. Section 9.3.4.3 Startup Locality Event
>          //
>          Status = TcgDxeLogEvent (
>                     mTcg2EventInfo[Index].LogFormat,
> -                   &FirstPcrEvent,
> -                   sizeof(FirstPcrEvent),
> -                   (UINT8 *)TcgEfiSpecIdEventStruct,
> -                   FirstPcrEvent.EventSize
> +                   &NoActionEvent,
> +                   sizeof(NoActionEvent),
> +                   (UINT8 *)&StartupLocalityEvent,
> +                   NoActionEvent.EventSize
>                     );
> +
>        }
>      }
>    }
> --
> 1.9.5.msysgit.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  parent reply	other threads:[~2017-01-23 15:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23  8:51 [PATCH 1/2] SecurityPkg: Tcg2Dxe: Log Startup Locality Event Zhang, Chao B
2017-01-23  8:51 ` [PATCH 2/2] MdePkg : UefiTcgPlatform.h: Define Startup Locality Event & Indicator Zhang, Chao B
2017-01-23 15:25 ` Yao, Jiewen [this message]
2017-01-24  0:20   ` [PATCH 1/2] SecurityPkg: Tcg2Dxe: Log Startup Locality Event Zhang, Chao B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74D8A39837DF1E4DA445A8C0B3885C503A8E467A@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox