<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="auto">
<div>Agree. I will make needed changes to remove CounterId parameter.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards,</div>
<div dir="auto">Nishant<br>
<br>
<div data-smartmail="gmail_signature" dir="auto">Message sent from Phone.</div>
<div class="gmail_extra" dir="auto"><br>
<div class="gmail_quote">On Mar 17, 2020 7:59 PM, "Yao, Jiewen" <jiewen.yao@intel.com> wrote:<br type="attribution">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<p>Thanks Nishant.</p>
<p> </p>
<p>If the platform RPMC driver calls GetRpmcState(), then we should not define it in UEFI, because the variable driver does not have such knowledge.</p>
<p> </p>
<p>I do see the complexity on the counter management requirement. Current API might be either insufficient or unnecessary.</p>
<p> </p>
<p>To keep our work simple, l recommend remove CounterAddr from the API, and force BIOS use single counter.</p>
<p>It does not have to be 0, the RpmcLib can make decision. But the high level driver does not care.</p>
<p> </p>
<p>We can revisit when we see more usage.</p>
<p> </p>
<p>Thank you</p>
<p>Yao Jiewen </p>
<p> </p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1pt;padding:3pt 0in 0in 0in">
<p><b>From:</b> Mistry, Nishant C <nishant.c.mistry@intel.com> <br>
<b>Sent:</b> Wednesday, March 18, 2020 10:53 AM<br>
<b>To:</b> Yao, Jiewen <jiewen.yao@intel.com><br>
<b>Cc:</b> Wang, Jian J <jian.j.wang@intel.com>; devel@edk2.groups.io; Zhang, Chao B <chao.b.zhang@intel.com><br>
<b>Subject:</b> RE: [PATCH v3 1/3] SecurityPkg: add RpmcLib and VariableKeyLib public headers</p>
</div>
</div>
<p> </p>
<div>
<div>
<p>My thoughts below ...</p>
<div>
<p> </p>
</div>
<div>
<p>Regards,</p>
</div>
<div>
<p style="margin-bottom:12pt">Nishant</p>
<div>
<p>Message sent from Phone.</p>
</div>
</div>
<div>
<p> </p>
<div>
<p>On Mar 17, 2020 7:27 PM, "Yao, Jiewen" <<a href="mailto:jiewen.yao@intel.com">jiewen.yao@intel.com</a>> wrote:</p>
<blockquote style="border:none;border-left:solid #cccccc 1pt;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p><a name="BM_BEGIN"></a><span style="font-size:10pt;font-family:'times new roman' , serif">Thanks Jian. Some comments and thought.<br>
<br>
1) RPMC spec uses CounterAddress as the indicator. Can we use the same name instead of CounterId in the API definition? [Nishant] I agree. CounterId is what CSME has defined thus I asked Jian to go with this name. However, we should use industry spec naming.</span><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<div>
<p> </p>
</div>
<div>
<div>
<div>
<blockquote style="border:none;border-left:solid #cccccc 1pt;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p><span style="font-size:10pt;font-family:'times new roman' , serif"><br>
2) How the caller known which CounterAddress it need to fill?<br>
Do we need an API such as GetValidCounterAddress() ?[Nishant] The platform RPMC driver has an GetRpmcStatus() API that indicates how many counters supported as reported by CSME.<br>
<br>
3) What is the value to add CounterAddress? Do can we guarantee that 2 drivers use 2 different counter address?<br>
Or If 2 drivers may use same counter address, why not remove the counter address parameter at all ? [Nishant] It might be simpler to just use one counter Address (i.e. 0) for UEFI firmware. If there is a customer request in future we can introduce the Counter
 Address parameter. At this moment I don't see a value add for BIOS.</span><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<div>
<div>
<div>
<blockquote style="border:none;border-left:solid #cccccc 1pt;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p style="margin-bottom:12pt"><span style="font-size:10pt;font-family:'times new roman' , serif"><br>
Thank you<br>
Yao Jiewen<br>
<br>
<br>
<br>
> -----Original Message-----<br>
> From: Wang, Jian J <<a href="mailto:jian.j.wang@intel.com">jian.j.wang@intel.com</a>><br>
> Sent: Wednesday, March 18, 2020 10:13 AM<br>
> To: <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a><br>
> Cc: Yao, Jiewen <<a href="mailto:jiewen.yao@intel.com">jiewen.yao@intel.com</a>>; Zhang, Chao B<br>
> <<a href="mailto:chao.b.zhang@intel.com">chao.b.zhang@intel.com</a>>; Mistry, Nishant C <<a href="mailto:nishant.c.mistry@intel.com">nishant.c.mistry@intel.com</a>><br>
> Subject: [PATCH v3 1/3] SecurityPkg: add RpmcLib and VariableKeyLib public<br>
> headers<br>
> <br>
> > v3: update retval description in RpmcLib.h<br>
> <br>
> REF: <a href="https://bugzilla.tianocore.org/show_bug.cgi?id=2594">https://bugzilla.tianocore.org/show_bug.cgi?id=2594</a><br>
> <br>
> RpmcLib.h and VariableKeyLib.h are header files required to access RPMC<br>
> device and Key generator from platform. They will be used to ensure the<br>
> integrity and confidentiality of NV variables.<br>
> <br>
> Cc: Jiewen Yao <<a href="mailto:jiewen.yao@intel.com">jiewen.yao@intel.com</a>><br>
> Cc: Chao Zhang <<a href="mailto:chao.b.zhang@intel.com">chao.b.zhang@intel.com</a>><br>
> Cc: Nishant C Mistry <<a href="mailto:nishant.c.mistry@intel.com">nishant.c.mistry@intel.com</a>><br>
> Signed-off-by: Jian J Wang <<a href="mailto:jian.j.wang@intel.com">jian.j.wang@intel.com</a>><br>
> ---<br>
>  SecurityPkg/Include/Library/RpmcLib.h        | 46 +++++++++++++++<br>
>  SecurityPkg/Include/Library/VariableKeyLib.h | 59 ++++++++++++++++++++<br>
>  SecurityPkg/SecurityPkg.dec                  |  8 +++<br>
>  3 files changed, 113 insertions(+)<br>
>  create mode 100644 SecurityPkg/Include/Library/RpmcLib.h<br>
>  create mode 100644 SecurityPkg/Include/Library/VariableKeyLib.h<br>
> <br>
> diff --git a/SecurityPkg/Include/Library/RpmcLib.h<br>
> b/SecurityPkg/Include/Library/RpmcLib.h<br>
> new file mode 100644<br>
> index 0000000000..f548ad2c9f<br>
> --- /dev/null<br>
> +++ b/SecurityPkg/Include/Library/RpmcLib.h<br>
> @@ -0,0 +1,46 @@<br>
> +/** @file<br>
> <br>
> +  Public definitions for the Replay Protected Monotonic Counter (RPMC) Library.<br>
> <br>
> +<br>
> <br>
> +Copyright (c) 2020, Intel Corporation. All rights reserved.<BR><br>
> <br>
> +SPDX-License-Identifier: BSD-2-Clause-Patent<br>
> <br>
> +<br>
> <br>
> +**/<br>
> <br>
> +<br>
> <br>
> +#ifndef _RPMC_LIB_H_<br>
> <br>
> +#define _RPMC_LIB_H_<br>
> <br>
> +<br>
> <br>
> +#include <Uefi/UefiBaseType.h><br>
> <br>
> +<br>
> <br>
> +/**<br>
> <br>
> +  Requests the current monotonic counter from the designated RPMC counter.<br>
> <br>
> +<br>
> <br>
> +  @param[in]    CounterId               Monotonic Counter Id.<br>
> <br>
> +  @param[out]   CounterValue            A pointer to a buffer to store the RPMC<br>
> value.<br>
> <br>
> +<br>
> <br>
> +  @retval       EFI_SUCCESS             The operation completed successfully.<br>
> <br>
> +  @retval       EFI_DEVICE_ERROR        A device error occurred while attempting<br>
> to update the counter.<br>
> <br>
> +  @retval       EFI_UNSUPPORTED         The operation is un-supported.<br>
> <br>
> +**/<br>
> <br>
> +EFI_STATUS<br>
> <br>
> +EFIAPI<br>
> <br>
> +RequestMonotonicCounter (<br>
> <br>
> +  IN  UINT8   CounterId,<br>
> <br>
> +  OUT UINT32  *CounterValue<br>
> <br>
> +  );<br>
> <br>
> +<br>
> <br>
> +/**<br>
> <br>
> +  Increments the designated monotonic counter in the SPI flash device by 1.<br>
> <br>
> +<br>
> <br>
> +  @param[in]    CounterId              Monotonic Counter Id.<br>
> <br>
> +<br>
> <br>
> +  @retval       EFI_SUCCESS             The operation completed successfully.<br>
> <br>
> +  @retval       EFI_DEVICE_ERROR        A device error occurred while attempting<br>
> to update the counter.<br>
> <br>
> +  @retval       EFI_UNSUPPORTED         The operation is un-supported.<br>
> <br>
> +**/<br>
> <br>
> +EFI_STATUS<br>
> <br>
> +EFIAPI<br>
> <br>
> +IncrementMonotonicCounter (<br>
> <br>
> +  IN  UINT8   CounterId<br>
> <br>
> +  );<br>
> <br>
> +<br>
> <br>
> +#endif<br>
> \ No newline at end of file<br>
> diff --git a/SecurityPkg/Include/Library/VariableKeyLib.h<br>
> b/SecurityPkg/Include/Library/VariableKeyLib.h<br>
> new file mode 100644<br>
> index 0000000000..fe642b3d66<br>
> --- /dev/null<br>
> +++ b/SecurityPkg/Include/Library/VariableKeyLib.h<br>
> @@ -0,0 +1,59 @@<br>
> +/** @file<br>
> <br>
> +  Public definitions for Variable Key Library.<br>
> <br>
> +<br>
> <br>
> +Copyright (c) 2020, Intel Corporation. All rights reserved.<BR><br>
> <br>
> +SPDX-License-Identifier: BSD-2-Clause-Patent<br>
> <br>
> +<br>
> <br>
> +**/<br>
> <br>
> +<br>
> <br>
> +#ifndef _VARIABLE_KEY_LIB_H_<br>
> <br>
> +#define _VARIABLE_KEY_LIB_H_<br>
> <br>
> +<br>
> <br>
> +#include <Uefi/UefiBaseType.h><br>
> <br>
> +<br>
> <br>
> +/**<br>
> <br>
> +  Retrieves the variable root key.<br>
> <br>
> +<br>
> <br>
> +  @param[out]     VariableRootKey         A pointer to pointer for the variable<br>
> root key buffer.<br>
> <br>
> +  @param[in,out]  VariableRootKeySize     The size in bytes of the variable root<br>
> key.<br>
> <br>
> +<br>
> <br>
> +  @retval       EFI_SUCCESS             The variable root key was returned.<br>
> <br>
> +  @retval       EFI_DEVICE_ERROR        An error occurred while attempting to get<br>
> the variable root key.<br>
> <br>
> +  @retval       EFI_ACCESS_DENIED       The function was invoked after locking<br>
> the key interface.<br>
> <br>
> +  @retval       EFI_UNSUPPORTED         The variable root key is not supported in<br>
> the current boot configuration.<br>
> <br>
> +**/<br>
> <br>
> +EFI_STATUS<br>
> <br>
> +EFIAPI<br>
> <br>
> +GetVariableRootKey (<br>
> <br>
> +      OUT VOID    **VariableRootKey,<br>
> <br>
> +  IN  OUT UINTN   *VariableRootKeySize<br>
> <br>
> +  );<br>
> <br>
> +<br>
> <br>
> +/**<br>
> <br>
> +  Regenerates the variable root key.<br>
> <br>
> +<br>
> <br>
> +  @retval       EFI_SUCCESS             The variable root key was regenerated<br>
> successfully.<br>
> <br>
> +  @retval       EFI_DEVICE_ERROR        An error occurred while attempting to<br>
> regenerate the root key.<br>
> <br>
> +  @retval       EFI_ACCESS_DENIED       The function was invoked after locking<br>
> the key interface.<br>
> <br>
> +  @retval       EFI_UNSUPPORTED         Key regeneration is not supported in the<br>
> current boot configuration.<br>
> <br>
> +**/<br>
> <br>
> +EFI_STATUS<br>
> <br>
> +EFIAPI<br>
> <br>
> +RegenerateKey (<br>
> <br>
> +  VOID<br>
> <br>
> +  );<br>
> <br>
> +<br>
> <br>
> +/**<br>
> <br>
> +  Locks the regenerate key interface.<br>
> <br>
> +<br>
> <br>
> +  @retval       EFI_SUCCESS             The key interface was locked successfully.<br>
> <br>
> +  @retval       EFI_UNSUPPORTED         Locking the key interface is not supported<br>
> in the current boot configuration.<br>
> <br>
> +  @retval       Others                  An error occurred while attempting to lock the<br>
> key interface.<br>
> <br>
> +**/<br>
> <br>
> +EFI_STATUS<br>
> <br>
> +EFIAPI<br>
> <br>
> +LockKeyInterface (<br>
> <br>
> +  VOID<br>
> <br>
> +  );<br>
> <br>
> +<br>
> <br>
> +#endif<br>
> \ No newline at end of file<br>
> diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec<br>
> index 5335cc5397..2cdfb02cc5 100644<br>
> --- a/SecurityPkg/SecurityPkg.dec<br>
> +++ b/SecurityPkg/SecurityPkg.dec<br>
> @@ -76,6 +76,14 @@<br>
>    #<br>
> <br>
>    TcgStorageOpalLib|Include/Library/TcgStorageOpalLib.h<br>
> <br>
> <br>
> <br>
> +  ## @libraryclass  Provides interfaces to access RPMC device.<br>
> <br>
> +  #<br>
> <br>
> +  RpmcLib|Include/Library/RpmcLib.h<br>
> <br>
> +<br>
> <br>
> +  ## @libraryclass  Provides interfaces to access variable root key.<br>
> <br>
> +  #<br>
> <br>
> +  VariableKeyLib|Include/Library/VariableKeyLib.h<br>
> <br>
> +<br>
> <br>
>  [Guids]<br>
> <br>
>    ## Security package token space guid.<br>
> <br>
>    # Include/Guid/SecurityPkgTokenSpace.h<br>
> <br>
> --<br>
> 2.24.0.windows.2</span><span style="font-size:12pt;font-family:'times new roman' , serif"></span></p>
</div>
</div>
</blockquote>
</div>
<p> </p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>


You receive all messages sent to this group.



<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/55972">View/Reply Online (#55972)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/72040979/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>