crypto/weakcryptospi/source/bigint/algorithms.h
changeset 19 cd501b96611d
equal deleted inserted replaced
15:da2ae96f639b 19:cd501b96611d
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Bigint algorithms header file
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @internalTechnology
       
    23 */
       
    24  
       
    25 #ifndef __ALGORITHMS_H__
       
    26 #define __ALGORITHMS_H__
       
    27 
       
    28 #include "../common/inlines.h"
       
    29 
       
    30 word Add(word* C, const word* A, const word* B, unsigned int N);
       
    31 word Subtract(word* C, const word* A, const word* B, unsigned int N);
       
    32 int Compare(const word *A, const word *B, unsigned int N);
       
    33 void IncrementNoCarry(word *A, unsigned int N, word B=1);
       
    34 word Increment(word *A, unsigned int N, word B=1);
       
    35 void DecrementNoCarry(word *A, unsigned int N, word B=1);
       
    36 word Decrement(word *A, unsigned int N, word B=1);
       
    37 void TwosComplement(word *A, unsigned int N);
       
    38 void Divide(word* R, word* Q, word* T, const word* A, unsigned int NA,
       
    39 	const word* B, unsigned int NB);
       
    40 unsigned int AlmostInverse(word *R, word *T, const word *A, unsigned int NA, 
       
    41 	const word *M, unsigned int N);
       
    42 void DivideByPower2Mod(word *R, const word *A, unsigned int k, const word *M, 
       
    43 	unsigned int N);
       
    44 void RecursiveInverseModPower2(word *R, word *T, const word *A, unsigned int N);
       
    45 void AsymmetricMultiply(word *R, word *T, const word *A, unsigned int NA, 
       
    46 	const word *B, unsigned int NB);
       
    47 void MontgomeryReduce(word *R, word *T, const word *X, const word *M, 
       
    48 	const word *U, unsigned int N);
       
    49 void RecursiveSquare(word *R, word *T, const word *A, unsigned int N);
       
    50 
       
    51 #endif