]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c
1. Remove conducting ASSERT in BaseCryptLib.
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pem / CryptPem.c
index 0b37adc33e81ab6c9716c791762dd394dabb716e..2c3a97b2c0f91539d5e3113e96cf9b0fd65ce4d2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   PEM (Privacy Enhanced Mail) Format Handler Wrapper Implementation over OpenSSL.\r
 \r
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 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
@@ -60,8 +60,8 @@ PasswordCallback (
                            RSA private key component. Use RsaFree() function to free the\r
                            resource.\r
 \r
-  If PemData is NULL, then ASSERT().\r
-  If RsaContext is NULL, then ASSERT().\r
+  If PemData is NULL, then return FALSE.\r
+  If RsaContext is NULL, then return FALSE.\r
 \r
   @retval  TRUE   RSA Private Key was retrieved successfully.\r
   @retval  FALSE  Invalid PEM key data or incorrect password.\r
@@ -80,11 +80,11 @@ RsaGetPrivateKeyFromPem (
   BIO      *PemBio;\r
 \r
   //\r
-  // ASSERT if PemData is NULL or RsaContext is NULL.\r
+  // Check input parameters.\r
   //\r
-  ASSERT (PemData    != NULL);\r
-  ASSERT (RsaContext != NULL);\r
-  ASSERT (PemSize    <= INT_MAX);\r
+  if (PemData == NULL || RsaContext == NULL || PemSize > INT_MAX) {\r
+    return FALSE;\r
+  }\r
 \r
   Status = FALSE;\r
   PemBio = NULL;\r