Update contrib.
2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
27 #include "randomshim.h"
30 EXPORT_C void RAND_bytes(unsigned char* buf,int bytes)
32 TPtr8 ptr(buf,bytes,bytes);
38 EXPORT_C CRandom::CRandom(void)
42 EXPORT_C CSystemRandom* CSystemRandom::NewL(void)
44 CSystemRandom* self = NewLC();
45 CleanupStack::Pop(self);
49 EXPORT_C CSystemRandom* CSystemRandom::NewLC(void)
51 CSystemRandom* self = new(ELeave)CSystemRandom();
52 CleanupStack::PushL(self);
57 void CSystemRandom::GenerateBytesL(TDes8& aDest)
59 TRAPD(error, iShim->GenerateBytesL(aDest));
60 // This method must leave on low memory conditions.
61 if(error == KErrNoMemory)
67 CSystemRandom::CSystemRandom(void)
71 CSystemRandom::~CSystemRandom()
76 void CSystemRandom::ConstructL()
78 iShim = CRandomShim::NewL();
81 // Methods replace by shim are excluded from coverage.
82 #ifdef _BullseyeCoverage
83 #pragma suppress_warnings on
84 #pragma BullseyeCoverage off
85 #pragma suppress_warnings off
87 EXPORT_C void TRandom::Random(TDes8& aDestination)
89 // Method replaced by shim
90 TRandomShim::Random(aDestination);
93 EXPORT_C void TRandom::RandomL(TDes8& aDestination)
95 // Method replaced by shim
96 TRandomShim::RandomL(aDestination);
99 EXPORT_C void TRandom::SecureRandomL(TDes8& aDestination)
101 // Method replaced by shim
102 TRandomShim::SecureRandomL(aDestination);
105 EXPORT_C RRandomSession::RRandomSession(void)
109 EXPORT_C void RRandomSession::ConnectL(void)
111 // No action required
114 EXPORT_C TInt RRandomSession::GetRandom(TDes8& aDestination)
116 // Method replaced by shim
117 TRandomShim::Random(aDestination);