pkiutilities/PKCS12/CrPkcs12/Src/crpkcs12.cpp
branchCompilerCompatibility
changeset 8 150a5dd64ae5
parent 5 3b17fc5c9564
--- a/pkiutilities/PKCS12/CrPkcs12/Src/crpkcs12.cpp	Mon Mar 08 21:44:12 2010 +0000
+++ b/pkiutilities/PKCS12/CrPkcs12/Src/crpkcs12.cpp	Sun Mar 14 13:12:09 2010 +0000
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2004, 2010 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -1130,10 +1130,17 @@
                 }
             }
         }
+
+    if( !pkcs7EncryptedDataBuf )
+        {
+        CleanupStack::PopAndDestroy(numberOfItemsInCStack); // set
+        numberOfItemsInCStack = 0;
+        return EFalse;
+        }
+
     // OK, now we have buffer to be decrypted, used algorithm, salt and
     // an iteration count. Next we decrypt buffer and append it to iBags.
-	
-	DecryptPkcs7EncryptedDataL( pkcs7EncryptedDataBuf,salt,iter,algorithm );
+	DecryptPkcs7EncryptedDataL( pkcs7EncryptedDataBuf, salt, iter, algorithm );
 
     CleanupStack::PopAndDestroy(numberOfItemsInCStack);
     numberOfItemsInCStack = 0;
@@ -1309,7 +1316,6 @@
     {
     TInt numberOfItemsinCStack = 0;
     CCrBerSet* set = NULL;
-    TInt errData = KErrNone;
 
     set = CCrBerSet::NewLC( 1 );
     ++numberOfItemsinCStack;
@@ -1403,11 +1409,6 @@
     CleanupStack::PushL(encryptedPrivateKeyInfo);
     ++numberOfItemsinCStack;
     
-    if ( errData < KErrNone )
-        {
-        User::Leave(KErrArgument);
-        }
-
     // Decrypt
     if ( !DecryptPrivateKeyL( encryptedPrivateKeyInfo,
                                                  salt,