diff options
author | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-08-02 02:49:24 +0000 |
---|---|---|
committer | tye1 <tye1@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-08-02 02:49:24 +0000 |
commit | dda39f3a5850458391aaab330971d46bc9c2b690 (patch) | |
tree | 132b654595f2506ddc335ffb283df036a6eeb0ce /CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c | |
parent | a08dcb2ab16fbb496ff837d5c55c4cb22343aaa5 (diff) | |
download | edk2-dda39f3a5850458391aaab330971d46bc9c2b690.tar.gz edk2-dda39f3a5850458391aaab330971d46bc9c2b690.tar.bz2 edk2-dda39f3a5850458391aaab330971d46bc9c2b690.zip |
Fix several issues in BaseCryptLib:
1. Add input length check for several APIs in BaseCryptLib.
2. Add return status check when calling OpensslLib functions
3. Adjust BaseCryptLib API to match description of wrapped OpensslLib API.
4. Update INF file to add missed RuntimeServicesTableLib.
5. Fix return status issue of APIs in CryptX509.c that incorrect when error occurs.
Signed-off-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Dong Guo <guo.dong@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13579 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c')
-rw-r--r-- | CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c b/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c index 319ad59ecc..078a960d58 100644 --- a/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c +++ b/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c @@ -86,17 +86,24 @@ RsaGetPrivateKeyFromPem ( return FALSE;
}
- Status = FALSE;
- PemBio = NULL;
-
//
// Add possible block-cipher descriptor for PEM data decryption.
// NOTE: Only support most popular ciphers (3DES, AES) for the encrypted PEM.
//
- EVP_add_cipher (EVP_des_ede3_cbc ());
- EVP_add_cipher (EVP_aes_128_cbc ());
- EVP_add_cipher (EVP_aes_192_cbc ());
- EVP_add_cipher (EVP_aes_256_cbc ());
+ if (EVP_add_cipher (EVP_des_ede3_cbc ()) == 0) {
+ return FALSE;
+ }
+ if (EVP_add_cipher (EVP_aes_128_cbc ()) == 0) {
+ return FALSE;
+ }
+ if (EVP_add_cipher (EVP_aes_192_cbc ()) == 0) {
+ return FALSE;
+ }
+ if (EVP_add_cipher (EVP_aes_256_cbc ()) == 0) {
+ return FALSE;
+ }
+
+ Status = FALSE;
//
// Read encrypted PEM Data.
|