crypto/weakcryptospi/source/padding/padding.cpp
branchRCL_3
changeset 41 9b5a3a9fddf8
parent 19 cd501b96611d
equal deleted inserted replaced
37:721a5e5fe251 41:9b5a3a9fddf8
   293 	
   293 	
   294 	aOutput[0]=0;
   294 	aOutput[0]=0;
   295 	TInt startOfData=BlockSize()-aInput.Length();
   295 	TInt startOfData=BlockSize()-aInput.Length();
   296 	aOutput[1]=2;				// Block type 2 (public key operation)
   296 	aOutput[1]=2;				// Block type 2 (public key operation)
   297 	TBuf8<256> rnd(256);
   297 	TBuf8<256> rnd(256);
   298 	GenerateRandomBytesL(rnd);
   298 	TRAPD(err, GenerateRandomBytesL(rnd));
       
   299 	if((err != KErrNone) && (err != KErrNotSecure))
       
   300 	    User::Leave(err);
   299 
   301 
   300 	TInt i = 2;
   302 	TInt i = 2;
   301 	TInt j = 0;
   303 	TInt j = 0;
   302 	for (; i<(startOfData-1);)
   304 	for (; i<(startOfData-1);)
   303 		{
   305 		{
   305 			{
   307 			{
   306 			aOutput[i++]=rnd[j];
   308 			aOutput[i++]=rnd[j];
   307 			}
   309 			}
   308 		if (++j==256)
   310 		if (++j==256)
   309 			{
   311 			{
   310 			GenerateRandomBytesL(rnd);
   312 			TRAP(err, GenerateRandomBytesL(rnd));
       
   313 			if((err != KErrNone) && (err != KErrNotSecure))
       
   314 				User::Leave(err);
   311 			j=0;
   315 			j=0;
   312 			}
   316 			}
   313 		}
   317 		}
   314 
   318 
   315 	j=0;
   319 	j=0;