]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg/BaseCryptLib.h: Add new API VerifyEKUsInPkcs7Signature
authorBret Barkelew <Bret.Barkelew@microsoft.com>
Mon, 25 Mar 2019 04:01:10 +0000 (12:01 +0800)
committerJian J Wang <jian.j.wang@intel.com>
Thu, 18 Apr 2019 05:11:20 +0000 (13:11 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1402

Add a prototype of new API VerifyEKUsInPkcs7Signature.

Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Cc: Gang Wei <gang.wei@intel.com>
Cc: Wang Jian J <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
CryptoPkg/Include/Library/BaseCryptLib.h

index 6183bb0df4455180407a58968df63dde08953405..f9191f6e96d33d2e0c0a2d666e79fa992ca93f9c 100644 (file)
@@ -2593,6 +2593,48 @@ Pkcs7Verify (
   IN  UINTN        DataLength\r
   );\r
 \r
+/**\r
+  This function receives a PKCS7 formatted signature, and then verifies that\r
+  the specified Enhanced or Extended Key Usages (EKU's) are present in the end-entity\r
+  leaf signing certificate.\r
+  Note that this function does not validate the certificate chain.\r
+\r
+  Applications for custom EKU's are quite flexible. For example, a policy EKU\r
+  may be present in an Issuing Certificate Authority (CA), and any sub-ordinate\r
+  certificate issued might also contain this EKU, thus constraining the\r
+  sub-ordinate certificate.  Other applications might allow a certificate\r
+  embedded in a device to specify that other Object Identifiers (OIDs) are\r
+  present which contains binary data specifying custom capabilities that\r
+  the device is able to do.\r
+\r
+  @param[in]  Pkcs7Signature       The PKCS#7 signed information content block. An array\r
+                                   containing the content block with both the signature,\r
+                                   the signer's certificate, and any necessary intermediate\r
+                                   certificates.\r
+  @param[in]  Pkcs7SignatureSize   Number of bytes in Pkcs7Signature.\r
+  @param[in]  RequiredEKUs         Array of null-terminated strings listing OIDs of\r
+                                   required EKUs that must be present in the signature.\r
+  @param[in]  RequiredEKUsSize     Number of elements in the RequiredEKUs string array.\r
+  @param[in]  RequireAllPresent    If this is TRUE, then all of the specified EKU's\r
+                                   must be present in the leaf signer.  If it is\r
+                                   FALSE, then we will succeed if we find any\r
+                                   of the specified EKU's.\r
+\r
+  @retval EFI_SUCCESS              The required EKUs were found in the signature.\r
+  @retval EFI_INVALID_PARAMETER    A parameter was invalid.\r
+  @retval EFI_NOT_FOUND            One or more EKU's were not found in the signature.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+VerifyEKUsInPkcs7Signature (\r
+  IN  CONST UINT8   *Pkcs7Signature,\r
+  IN  CONST UINT32  SignatureSize,\r
+  IN  CONST CHAR8   *RequiredEKUs[],\r
+  IN  CONST UINT32  RequiredEKUsSize,\r
+  IN  BOOLEAN       RequireAllPresent\r
+  );\r
+\r
 /**\r
   Extracts the attached content from a PKCS#7 signed data if existed. The input signed\r
   data could be wrapped in a ContentInfo structure.\r