Home | History | Annotate | Download | only in Pk
      1 /** @file
      2   X.509 Certificate Handler Wrapper Implementation which does not provide
      3   real capabilities.
      4 
      5 Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
      6 This program and the accompanying materials
      7 are licensed and made available under the terms and conditions of the BSD License
      8 which accompanies this distribution.  The full text of the license may be found at
      9 http://opensource.org/licenses/bsd-license.php
     10 
     11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14 **/
     15 
     16 #include "InternalCryptLib.h"
     17 
     18 /**
     19   Construct a X509 object from DER-encoded certificate data.
     20 
     21   Return FALSE to indicate this interface is not supported.
     22 
     23   @param[in]  Cert            Pointer to the DER-encoded certificate data.
     24   @param[in]  CertSize        The size of certificate data in bytes.
     25   @param[out] SingleX509Cert  The generated X509 object.
     26 
     27   @retval FALSE  This interface is not supported.
     28 
     29 **/
     30 BOOLEAN
     31 EFIAPI
     32 X509ConstructCertificate (
     33   IN   CONST UINT8  *Cert,
     34   IN   UINTN        CertSize,
     35   OUT  UINT8        **SingleX509Cert
     36   )
     37 {
     38   ASSERT (FALSE);
     39   return FALSE;
     40 }
     41 
     42 /**
     43   Construct a X509 stack object from a list of DER-encoded certificate data.
     44 
     45   Return FALSE to indicate this interface is not supported.
     46 
     47   @param[in, out]  X509Stack  On input, pointer to an existing or NULL X509 stack object.
     48                               On output, pointer to the X509 stack object with new
     49                               inserted X509 certificate.
     50   @param           ...        A list of DER-encoded single certificate data followed
     51                               by certificate size. A NULL terminates the list. The
     52                               pairs are the arguments to X509ConstructCertificate().
     53 
     54   @retval FALSE  This interface is not supported.
     55 
     56 **/
     57 BOOLEAN
     58 EFIAPI
     59 X509ConstructCertificateStack (
     60   IN OUT  UINT8  **X509Stack,
     61   ...
     62   )
     63 {
     64   ASSERT (FALSE);
     65   return FALSE;
     66 }
     67 
     68 /**
     69   Release the specified X509 object.
     70 
     71   If the interface is not supported, then ASSERT().
     72 
     73   @param[in]  X509Cert  Pointer to the X509 object to be released.
     74 
     75 **/
     76 VOID
     77 EFIAPI
     78 X509Free (
     79   IN  VOID  *X509Cert
     80   )
     81 {
     82   ASSERT (FALSE);
     83 }
     84 
     85 /**
     86   Release the specified X509 stack object.
     87 
     88   If the interface is not supported, then ASSERT().
     89 
     90   @param[in]  X509Stack  Pointer to the X509 stack object to be released.
     91 
     92 **/
     93 VOID
     94 EFIAPI
     95 X509StackFree (
     96   IN  VOID  *X509Stack
     97   )
     98 {
     99   ASSERT (FALSE);
    100 }
    101 
    102 /**
    103   Retrieve the subject bytes from one X.509 certificate.
    104 
    105   Return FALSE to indicate this interface is not supported.
    106 
    107   @param[in]      Cert         Pointer to the DER-encoded X509 certificate.
    108   @param[in]      CertSize     Size of the X509 certificate in bytes.
    109   @param[out]     CertSubject  Pointer to the retrieved certificate subject bytes.
    110   @param[in, out] SubjectSize  The size in bytes of the CertSubject buffer on input,
    111                                and the size of buffer returned CertSubject on output.
    112 
    113 
    114   @retval FALSE  This interface is not supported.
    115 
    116 **/
    117 BOOLEAN
    118 EFIAPI
    119 X509GetSubjectName (
    120   IN      CONST UINT8  *Cert,
    121   IN      UINTN        CertSize,
    122   OUT     UINT8        *CertSubject,
    123   IN OUT  UINTN        *SubjectSize
    124   )
    125 {
    126   ASSERT (FALSE);
    127   return FALSE;
    128 }
    129 
    130 /**
    131   Retrieve the RSA Public Key from one DER-encoded X509 certificate.
    132 
    133   Return FALSE to indicate this interface is not supported.
    134 
    135   @param[in]  Cert         Pointer to the DER-encoded X509 certificate.
    136   @param[in]  CertSize     Size of the X509 certificate in bytes.
    137   @param[out] RsaContext   Pointer to new-generated RSA context which contain the retrieved
    138                            RSA public key component. Use RsaFree() function to free the
    139                            resource.
    140 
    141   @retval FALSE  This interface is not supported.
    142 
    143 **/
    144 BOOLEAN
    145 EFIAPI
    146 RsaGetPublicKeyFromX509 (
    147   IN   CONST UINT8  *Cert,
    148   IN   UINTN        CertSize,
    149   OUT  VOID         **RsaContext
    150   )
    151 {
    152   ASSERT (FALSE);
    153   return FALSE;
    154 }
    155 
    156 /**
    157   Verify one X509 certificate was issued by the trusted CA.
    158 
    159   Return FALSE to indicate this interface is not supported.
    160 
    161   @param[in]      Cert         Pointer to the DER-encoded X509 certificate to be verified.
    162   @param[in]      CertSize     Size of the X509 certificate in bytes.
    163   @param[in]      CACert       Pointer to the DER-encoded trusted CA certificate.
    164   @param[in]      CACertSize   Size of the CA Certificate in bytes.
    165 
    166   @retval FALSE  This interface is not supported.
    167 
    168 **/
    169 BOOLEAN
    170 EFIAPI
    171 X509VerifyCert (
    172   IN  CONST UINT8  *Cert,
    173   IN  UINTN        CertSize,
    174   IN  CONST UINT8  *CACert,
    175   IN  UINTN        CACertSize
    176   )
    177 {
    178   ASSERT (FALSE);
    179   return FALSE;
    180 }
    181 
    182 /**
    183   Retrieve the TBSCertificate from one given X.509 certificate.
    184 
    185   Return FALSE to indicate this interface is not supported.
    186 
    187   @param[in]      Cert         Pointer to the given DER-encoded X509 certificate.
    188   @param[in]      CertSize     Size of the X509 certificate in bytes.
    189   @param[out]     TBSCert      DER-Encoded To-Be-Signed certificate.
    190   @param[out]     TBSCertSize  Size of the TBS certificate in bytes.
    191 
    192   @retval  FALSE  This interface is not supported.
    193 
    194 **/
    195 BOOLEAN
    196 EFIAPI
    197 X509GetTBSCert (
    198   IN  CONST UINT8  *Cert,
    199   IN  UINTN        CertSize,
    200   OUT UINT8        **TBSCert,
    201   OUT UINTN        *TBSCertSize
    202   )
    203 {
    204   ASSERT (FALSE);
    205   return FALSE;
    206 }
    207