cryptoservices/certificateandkeymgmt/twtlscert/CorruptionTest.cpp
branchRCL_3
changeset 41 9b5a3a9fddf8
parent 8 35751d3474b7
--- a/cryptoservices/certificateandkeymgmt/twtlscert/CorruptionTest.cpp	Tue Jan 26 13:18:49 2010 +0200
+++ b/cryptoservices/certificateandkeymgmt/twtlscert/CorruptionTest.cpp	Sat Feb 20 00:36:18 2010 +0200
@@ -27,6 +27,7 @@
 
 #include <bigint.h>
 #include <hash.h>
+#include <securityerr.h>
 
 TInt CCorruptionTest::nInstances = 0;
 _LIT(KCorruptLogFile, "WTLSCERTCorruptLog.txt");
@@ -172,7 +173,9 @@
 			HBufC8* rand = HBufC8::NewLC(5);
 			TPtr8 pRand = rand->Des();
 			pRand.SetLength(5);
-			random->GenerateBytesL(pRand);
+			TRAPD(err, random->GenerateBytesL(pRand));
+			if((err != KErrNone) && (err != KErrNotSecure))
+				User::Leave(err);
 			TUint num = 0;
 			for (TInt k = 0; k < 4 ; k++)
 				{
@@ -197,7 +200,7 @@
 			iCorruptOut->writeNewLine();
 			//try to make corrupt cert
 			CWTLSCertificate* cert = NULL;
-			TRAPD(err, cert = CWTLSCertificate::NewL(pBuf));
+			TRAP(err, cert = CWTLSCertificate::NewL(pBuf));
 			CleanupStack::PushL(cert);
 			if (err == KErrNone)
 				{