]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptX509Null.c
Add interfaces to several library instances of BaseCryptLib.
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLibRuntimeCryptProtocol / Pk / CryptX509Null.c
diff --git a/CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptX509Null.c b/CryptoPkg/Library/BaseCryptLibRuntimeCryptProtocol/Pk/CryptX509Null.c
new file mode 100644 (file)
index 0000000..5dbddca
--- /dev/null
@@ -0,0 +1,180 @@
+/** @file\r
+  X.509 Certificate Handler Wrapper Implementation which does not provide\r
+  real capabilities.\r
+\r
+Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "InternalCryptLib.h"\r
+\r
+/**\r
+  Construct a X509 object from DER-encoded certificate data.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in]  Cert            Pointer to the DER-encoded certificate data.\r
+  @param[in]  CertSize        The size of certificate data in bytes.\r
+  @param[out] SingleX509Cert  The generated X509 object.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+X509ConstructCertificate (\r
+  IN   CONST UINT8  *Cert,\r
+  IN   UINTN        CertSize,\r
+  OUT  UINT8        **SingleX509Cert\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Construct a X509 stack object from a list of DER-encoded certificate data.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  X509Stack  On input, pointer to an existing X509 stack object.\r
+                              On output, pointer to the X509 stack object with new\r
+                              inserted X509 certificate.\r
+  @param           ...        A list of DER-encoded single certificate data followed\r
+                              by certificate size. A NULL terminates the list. The\r
+                              pairs are the arguments to X509ConstructCertificate().\r
+                                 \r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+X509ConstructCertificateStack (\r
+  IN OUT  UINT8  **X509Stack,\r
+  ...  \r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Release the specified X509 object.\r
+\r
+  If the interface is not supported, then ASSERT().\r
+\r
+  @param[in]  X509Cert  Pointer to the X509 object to be released.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+X509Free (\r
+  IN  VOID  *X509Cert\r
+  )\r
+{ \r
+  ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+  Release the specified X509 stack object.\r
+\r
+  If the interface is not supported, then ASSERT().\r
+\r
+  @param[in]  X509Stack  Pointer to the X509 stack object to be released.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+X509StackFree (\r
+  IN  VOID  *X509Stack\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+  Retrieve the subject bytes from one X.509 certificate.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in]      Cert         Pointer to the DER-encoded X509 certificate.\r
+  @param[in]      CertSize     Size of the X509 certificate in bytes.\r
+  @param[out]     CertSubject  Pointer to the retrieved certificate subject bytes.\r
+  @param[in, out] SubjectSize  The size in bytes of the CertSubject buffer on input,\r
+                               and the size of buffer returned CertSubject on output.\r
+\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+X509GetSubjectName (\r
+  IN      CONST UINT8  *Cert,\r
+  IN      UINTN        CertSize,\r
+  OUT     UINT8        *CertSubject,\r
+  IN OUT  UINTN        *SubjectSize\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Retrieve the RSA Public Key from one DER-encoded X509 certificate.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in]  Cert         Pointer to the DER-encoded X509 certificate.\r
+  @param[in]  CertSize     Size of the X509 certificate in bytes.\r
+  @param[out] RsaContext   Pointer to new-generated RSA context which contain the retrieved\r
+                           RSA public key component. Use RsaFree() function to free the\r
+                           resource.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+RsaGetPublicKeyFromX509 (\r
+  IN   CONST UINT8  *Cert,\r
+  IN   UINTN        CertSize,\r
+  OUT  VOID         **RsaContext\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Verify one X509 certificate was issued by the trusted CA.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in]      Cert         Pointer to the DER-encoded X509 certificate to be verified.\r
+  @param[in]      CertSize     Size of the X509 certificate in bytes.\r
+  @param[in]      CACert       Pointer to the DER-encoded trusted CA certificate.\r
+  @param[in]      CACertSize   Size of the CA Certificate in bytes.\r
+\r
+  @retval FALSE  This interface is not supported.\r
\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+X509VerifyCert (\r
+  IN  CONST UINT8  *Cert,\r
+  IN  UINTN        CertSize,\r
+  IN  CONST UINT8  *CACert,\r
+  IN  UINTN        CACertSize\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r