]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IpSecDxe/IpSecCryptIo.c
ShellPkg-UefiShellTftpCommandLib: Replace compiler builtin
[mirror_edk2.git] / NetworkPkg / IpSecDxe / IpSecCryptIo.c
index 54607692aaecf99754c624b77bc93d3db9f89251..dca44231be023a18b520d11ea92c181413218994 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Common interfaces to call Security library.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -826,6 +826,8 @@ IpSecCryptoIoAuthDataWithCertificate (
   UINTN         SigSize;\r
    \r
   SigSize   = 0;\r
+  RsaContext = NULL;\r
+\r
   //\r
   // Retrieve RSA Private Key from password-protected PEM data\r
   //\r
@@ -966,7 +968,10 @@ IpSecCryptoIoGetPublicKeyFromCert (
   RsaGetKey (RsaContext, RsaKeyN, NULL, PublicKeyLen);\r
  \r
   *PublicKey = AllocateZeroPool (*PublicKeyLen);\r
-  ASSERT (*PublicKey != NULL);\r
+  if (*PublicKey == NULL) {\r
+    Status = EFI_OUT_OF_RESOURCES;\r
+    goto EXIT;\r
+  }\r
 \r
   if (!RsaGetKey (RsaContext, RsaKeyN, *PublicKey, PublicKeyLen)) {\r
     Status = EFI_INVALID_PARAMETER;\r