/* If Cert is NULL, then return FALSE. If SingleX509Cert is NULL, then return FALSE. */
BOOLEAN EFIAPI X509ConstructCertificate(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **SingleX509Cert)
/* If Cert is NULL, then return FALSE. If SingleX509Cert is NULL, then return FALSE. */
BOOLEAN EFIAPI X509ConstructCertificate(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **SingleX509Cert)
{
  X509         *X509Cert;
  CONST UINT8  *Temp;
  if ((Cert == NULL) || (SingleX509Cert == NULL) || (CertSize > INT_MAX)) {
    return FALSE;
  }
  Temp     = Cert;
  X509Cert = d2i_X509 (NULL, &Temp, (long)CertSize);
  if (X509Cert == NULL) {
    return FALSE;
  }
  *SingleX509Cert = (UINT8 *)X509Cert;
  return TRUE;
}