crypto/weakcryptospi/source/spi/cryptospiutil.cpp
changeset 94 0e6c5a9328b5
parent 8 35751d3474b7
child 96 a71299154b21
child 108 ca9a0fc2f082
equal deleted inserted replaced
90:8c545fea2798 94:0e6c5a9328b5
    83 	CleanupStack::PopAndDestroy(&rBuf);
    83 	CleanupStack::PopAndDestroy(&rBuf);
    84 	}
    84 	}
    85 
    85 
    86 TInt CryptoSpiUtil::RetrieveCharacteristicsL(TInt32 aInterface, RDesReadStream& aStream, RBuf8& aBuf, TInt& aCount)
    86 TInt CryptoSpiUtil::RetrieveCharacteristicsL(TInt32 aInterface, RDesReadStream& aStream, RBuf8& aBuf, TInt& aCount)
    87 	{
    87 	{
    88 	TBuf8<KMaxFileName> buf;
    88 	// first we are only trying to retrieve the length of the buffer
       
    89 	TBuf8<sizeof(TInt32)> buf;
    89 	TInt testResult = RProperty::Get(KCryptoSpiPropertyCat, aInterface, buf);
    90 	TInt testResult = RProperty::Get(KCryptoSpiPropertyCat, aInterface, buf);
    90 	if (testResult==KErrNotFound)
    91 	if (testResult==KErrNotFound)
    91 		{
    92 		{
    92 		//run the exe to Publish the properties
    93 		//run the exe to Publish the properties
    93 		RunCryptoSpiPropertySetupExe();
    94 		RunCryptoSpiPropertySetupExe();
       
    95 		// testresult would be checked outside the loop
    94 		testResult = RProperty::Get(KCryptoSpiPropertyCat, aInterface, buf);
    96 		testResult = RProperty::Get(KCryptoSpiPropertyCat, aInterface, buf);
    95 		if (testResult==KErrNotFound)
    97 		}
    96 			{
    98 	
    97 			//Error
    99 	// overflow will occur as we are only retrieving the length first.
    98 			User::Leave(testResult);
   100 	// any other error we should leave
    99 			}
   101 	if(testResult != KErrOverflow)
   100 		}
   102 		{
   101 	
   103 		User::LeaveIfError(testResult);
   102 	//Try to read the length first
   104 		}
       
   105 	
       
   106 	//read the length
   103 	RDesReadStream rStream(buf);
   107 	RDesReadStream rStream(buf);
   104 	TInt32 len=rStream.ReadInt32L();
   108 	TInt32 len=rStream.ReadInt32L();
   105 	
   109 	
   106 	//If the property is empty
   110 	//If the property is empty
   107 	if (len<=4)
   111 	if (len<=4)