From: Bret Barkelew <[email protected]>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1401

Add a prototype declaration of the new API X509GetOrganizationName
in the header file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao <[email protected]>
Cc: Ting Ye <[email protected]>
Cc: Gang Wei <[email protected]>
Cc: Wang Jian J <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Sean Brogan <[email protected]>
Cc: Michael Turner <[email protected]>
Cc: Bret Barkelew <[email protected]>
---
 CryptoPkg/Include/Library/BaseCryptLib.h | 35 ++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h 
b/CryptoPkg/Include/Library/BaseCryptLib.h
index 52ab2316db..011e908ee4 100644
--- a/CryptoPkg/Include/Library/BaseCryptLib.h
+++ b/CryptoPkg/Include/Library/BaseCryptLib.h
@@ -2206,6 +2206,41 @@ X509GetCommonName (
   IN OUT  UINTN        *CommonNameSize
   );
 
+/**
+  Retrieve the organization name (ON) string from one X.509 certificate.
+
+  @param[in]      Cert             Pointer to the DER-encoded X509 certificate.
+  @param[in]      CertSize         Size of the X509 certificate in bytes.
+  @param[out]     NameBuffer       Buffer to contain the retrieved certificate 
organization
+                                   name string. At most NameBufferSize bytes 
will be
+                                   written and the string will be null 
terminated. May be
+                                   NULL in order to determine the size buffer 
needed.
+  @param[in,out]  NameBufferSize   The size in bytes of the Name buffer on 
input,
+                                   and the size of buffer returned Name on 
output.
+                                   If NameBuffer is NULL then the amount of 
space needed
+                                   in buffer (including the final null) is 
returned.
+
+  @retval RETURN_SUCCESS           The certificate Organization Name retrieved 
successfully.
+  @retval RETURN_INVALID_PARAMETER If Cert is NULL.
+                                   If NameBufferSize is NULL.
+                                   If NameBuffer is not NULL and 
*CommonNameSize is 0.
+                                   If Certificate is invalid.
+  @retval RETURN_NOT_FOUND         If no Organization Name entry exists.
+  @retval RETURN_BUFFER_TOO_SMALL  If the NameBuffer is NULL. The required 
buffer size
+                                   (including the final null) is returned in 
the
+                                   CommonNameSize parameter.
+  @retval RETURN_UNSUPPORTED       The operation is not supported.
+
+**/
+RETURN_STATUS
+EFIAPI
+X509GetOrganizationName (
+  IN      CONST UINT8   *Cert,
+  IN      UINTN         CertSize,
+  OUT     CHAR8         *NameBuffer,  OPTIONAL
+  IN OUT  UINTN         *NameBufferSize
+  );
+
 /**
   Verify one X509 certificate was issued by the trusted CA.
 
-- 
2.16.2.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to