crypto/weakcrypto/source/bigint/algorithms.h
changeset 0 2c201484c85f
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     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 
       
    22 /**
       
    23  @file 
       
    24  @internalTechnology
       
    25 */
       
    26  
       
    27 #ifndef __ALGORITHMS_H__
       
    28 #define __ALGORITHMS_H__
       
    29 
       
    30 #include "../common/inlines.h"
       
    31 
       
    32 word Add(word* C, const word* A, const word* B, unsigned int N);
       
    33 word Subtract(word* C, const word* A, const word* B, unsigned int N);
       
    34 int Compare(const word *A, const word *B, unsigned int N);
       
    35 void IncrementNoCarry(word *A, unsigned int N, word B=1);
       
    36 word Increment(word *A, unsigned int N, word B=1);
       
    37 void DecrementNoCarry(word *A, unsigned int N, word B=1);
       
    38 word Decrement(word *A, unsigned int N, word B=1);
       
    39 void TwosComplement(word *A, unsigned int N);
       
    40 void Divide(word* R, word* Q, word* T, const word* A, unsigned int NA,
       
    41 	const word* B, unsigned int NB);
       
    42 unsigned int AlmostInverse(word *R, word *T, const word *A, unsigned int NA, 
       
    43 	const word *M, unsigned int N);
       
    44 void DivideByPower2Mod(word *R, const word *A, unsigned int k, const word *M, 
       
    45 	unsigned int N);
       
    46 void RecursiveInverseModPower2(word *R, word *T, const word *A, unsigned int N);
       
    47 void AsymmetricMultiply(word *R, word *T, const word *A, unsigned int NA, 
       
    48 	const word *B, unsigned int NB);
       
    49 void MontgomeryReduce(word *R, word *T, const word *X, const word *M, 
       
    50 	const word *U, unsigned int N);
       
    51 void RecursiveSquare(word *R, word *T, const word *A, unsigned int N);
       
    52 
       
    53 #endif