4272N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 4272N/A * Use is subject to license terms. 4272N/A * This library is free software; you can redistribute it and/or 4272N/A * modify it under the terms of the GNU Lesser General Public 4272N/A * License as published by the Free Software Foundation; either 4272N/A * version 2.1 of the License, or (at your option) any later version. 4272N/A * This library is distributed in the hope that it will be useful, 4272N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 4272N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 4272N/A * Lesser General Public License for more details. 4272N/A * You should have received a copy of the GNU Lesser General Public License 4272N/A * along with this library; if not, write to the Free Software Foundation, 4272N/A * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 4272N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4272N/A/* ********************************************************************* 1674N/A * The Original Code is the Netscape security libraries. 1674N/A * The Initial Developer of the Original Code is 1674N/A * Netscape Communications Corporation. 1674N/A * Portions created by the Initial Developer are Copyright (C) 2000 1674N/A * the Initial Developer. All Rights Reserved. 1674N/A * Sheueling Chang Shantz <sheueling.chang@sun.com>, 1674N/A * Stephen Fung <stephen.fung@sun.com>, and 1674N/A * Douglas Stebila <douglas@stebila.ca> of Sun Laboratories. 1674N/A *********************************************************************** */ 1674N/A/* This file implements moduluar exponentiation using Montgomery's 1674N/A * method for modular reduction. This file implements the method 1674N/A * described as "Improvement 1" in the paper "A Cryptogrpahic Library for 1674N/A * the Motorola DSP56000" by Stephen R. Dusse' and Burton S. Kaliski Jr. 1674N/A * published in "Advances in Cryptology: Proceedings of EUROCRYPT '90" 1674N/A * "Lecture Notes in Computer Science" volume 473, 1991, pg 230-244, 1674N/A * published by Springer Verlag. 1674N/A/* if MP_CHAR_STORE_SLOW is defined, we */ 1674N/A/* need to know endianness of this platform. */ 1674N/A#
error "You must define MP_IS_BIG_ENDIAN or MP_IS_LITTLE_ENDIAN\n" \
1674N/A " if you define MP_CHAR_STORE_SLOW." 1674N/A/* computes T = REDC(T), 2^b == R */ 1674N/A /* T += N * m_i * (MP_RADIX ** i); */ 1674N/A /* Outer loop: Digits of b */ 1674N/A /* Inner product: Digits of a */