diff options
author | Ye Ting <ting.ye@intel.com> | 2013-08-07 08:11:14 +0000 |
---|---|---|
committer | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-08-07 08:11:14 +0000 |
commit | 5b2956ea6340be09abdd1d1881c76919de345a97 (patch) | |
tree | 978423c187cedc51eb9a9acd7ac882c4c3a16bdc /CryptoPkg/Library/BaseCryptLib/Pem | |
parent | 6dafb3030d1f5a7c281a7cba6c6f7914b5a3b065 (diff) | |
download | edk2-5b2956ea6340be09abdd1d1881c76919de345a97.tar.gz edk2-5b2956ea6340be09abdd1d1881c76919de345a97.tar.bz2 edk2-5b2956ea6340be09abdd1d1881c76919de345a97.zip |
Enhance error handling code after calling BIO_new in BaseCryptLib.
Signed-off-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14528 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'CryptoPkg/Library/BaseCryptLib/Pem')
-rw-r--r-- | CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c b/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c index 078a960d58..51e648b736 100644 --- a/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c +++ b/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c @@ -1,7 +1,7 @@ /** @file
PEM (Privacy Enhanced Mail) Format Handler Wrapper Implementation over OpenSSL.
-Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -109,11 +109,14 @@ RsaGetPrivateKeyFromPem ( // Read encrypted PEM Data.
//
PemBio = BIO_new (BIO_s_mem ());
- BIO_write (PemBio, PemData, (int) PemSize);
if (PemBio == NULL) {
goto _Exit;
}
+ if (BIO_write (PemBio, PemData, (int) PemSize) <= 0) {
+ goto _Exit;
+ }
+
//
// Retrieve RSA Private Key from encrypted PEM data.
//
|