crypto/weakcryptospi/source/random/random.cpp
changeset 60 11c66574c2a2
parent 55 581b7c2ef978
equal deleted inserted replaced
56:c11c717470d0 60:11c66574c2a2
     1 /*
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    54 	return self;
    54 	return self;
    55 	}
    55 	}
    56 
    56 
    57 void CSystemRandom::GenerateBytesL(TDes8& aDest)
    57 void CSystemRandom::GenerateBytesL(TDes8& aDest)
    58 	{
    58 	{
    59 	iShim->GenerateBytesL(aDest);
    59 	TRAPD(error, iShim->GenerateBytesL(aDest));
    60 	}
    60     // This method must leave on low memory conditions.
       
    61     if(error == KErrNoMemory)
       
    62         {
       
    63         User::Leave(error); 
       
    64         }
       
    65     }
    61 
    66 
    62 CSystemRandom::CSystemRandom(void)
    67 CSystemRandom::CSystemRandom(void)
    63 	{
    68 	{
    64 	}
    69 	}
    65 
    70 
   101 	{
   106 	{
   102 	}
   107 	}
   103 
   108 
   104 EXPORT_C void RRandomSession::ConnectL(void)
   109 EXPORT_C void RRandomSession::ConnectL(void)
   105 	{
   110 	{
   106 	// All of the ConnectL() code has moved to randomimpl.cpp
   111 	// No action required
   107 	// in the new CryptoSPI pluggable framework. This is just
       
   108 	// a stub now that is retained for binary compatibility.
       
   109 
       
   110 	// Method replaced by shim
       
   111 	ASSERT(EFalse);
       
   112 	}
   112 	}
   113 
   113 
   114 EXPORT_C TInt RRandomSession::GetRandom(TDes8& aDestination)
   114 EXPORT_C TInt RRandomSession::GetRandom(TDes8& aDestination)
   115 	{
   115 	{
   116 	// Method replaced by shim
   116 	// Method replaced by shim