crypto/weakcryptospi/source/bigint/bigint.cpp
branchRCL_3
changeset 58 a5e05e7296f9
parent 41 9b5a3a9fddf8
equal deleted inserted replaced
53:b38692a04122 58:a5e05e7296f9
     1 /*
     1 /*
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2003-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".
  1082 
  1082 
  1083 	// 1.2 
  1083 	// 1.2 
  1084 	// For i from 1 to (2^(k-1) -1) do g2i+1 <- g2i-1 * g2
  1084 	// For i from 1 to (2^(k-1) -1) do g2i+1 <- g2i-1 * g2
  1085 	TUint count = (1 << (slider.WindowSize()-1)) - 1; //2^(k-1) -1
  1085 	TUint count = (1 << (slider.WindowSize()-1)) - 1; //2^(k-1) -1
  1086 	RRArray<RInteger> powerArray(count+1); //+1 because we append g1
  1086 	RRArray<RInteger> powerArray(count+1); //+1 because we append g1
  1087 	User::LeaveIfError(powerArray.Append(g1));
  1087 	powerArray.AppendL(g1);
  1088 	CleanupStack::Pop(); //g1
  1088 	CleanupStack::Pop(); //g1
  1089 	CleanupClosePushL(powerArray);
  1089 	CleanupClosePushL(powerArray);
  1090 	for(TUint k=1; k <= count; k++)
  1090 	for(TUint k=1; k <= count; k++)
  1091 		{
  1091 		{
  1092 		RInteger g2iplus1 = g2.TimesL(powerArray[k-1]);
  1092 		RInteger g2iplus1 = g2.TimesL(powerArray[k-1]);
  1093 		//This append can't fail as the granularity is set high enough
  1093 		powerArray.AppendL(g2iplus1);
  1094 		//plus we've already called Append once which will alloc to the 
       
  1095 		//set granularity
       
  1096 		powerArray.Append(g2iplus1);
       
  1097 		}
  1094 		}
  1098 
  1095 
  1099 	// 2 A <- 1, i <- t
  1096 	// 2 A <- 1, i <- t
  1100 	RInteger A = RInteger::NewL(One());
  1097 	RInteger A = RInteger::NewL(One());
  1101 	CleanupStack::PushL(A);
  1098 	CleanupStack::PushL(A);