diff -r 675a964f4eb5 -r 35751d3474b7 crypto/weakcryptospi/test/tbigint/tutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/crypto/weakcryptospi/test/tbigint/tutils.cpp Thu Sep 10 14:01:51 2009 +0300 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "tutils.h" +#include +#include "t_output.h" + +void Utils::DumpInteger(Output& aOut, const TDesC& aDesc, + const RInteger& aThat) + { + aOut.writeString(aDesc); + HBufC8* buf = aThat.BufferLC(); + aOut.writeOctetString(*buf); + aOut.writeNewLine(); + CleanupStack::PopAndDestroy(buf); + } + + +/* CRandomSetSource */ +CRandomSetSource::CRandomSetSource(const TDesC8& aSource) + { + SetSource(aSource); + } + +void CRandomSetSource::GenerateBytesL(TDes8& aDest) + { + TInt i=0; + //Reverse the string by bytes up to the point of the end of the given string + //of "random" bytes. + for (i=0; iCounter >= 0 && i< aDest.Length(); ++i,--iCounter) + { + aDest[i] = iValue[iCounter]; + } + //Then fill the remaining (if any) bytes in aDest with 0's. This is all to + //allow the stuff to work with bigint style integers; we're writing straight + //into a RInteger.Ptr() here + for(;i