|
1 /* |
|
2 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. |
|
3 * Use is subject to license terms. |
|
4 * |
|
5 * This library is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU Lesser General Public |
|
7 * License as published by the Free Software Foundation; either |
|
8 * version 2.1 of the License, or (at your option) any later version. |
|
9 * |
|
10 * This library is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 * Lesser General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Lesser General Public License |
|
16 * along with this library; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
1 /* ********************************************************************* |
24 /* ********************************************************************* |
2 * |
|
3 * Sun elects to have this file available under and governed by the |
|
4 * Mozilla Public License Version 1.1 ("MPL") (see |
|
5 * http://www.mozilla.org/MPL/ for full license text). For the avoidance |
|
6 * of doubt and subject to the following, Sun also elects to allow |
|
7 * licensees to use this file under the MPL, the GNU General Public |
|
8 * License version 2 only or the Lesser General Public License version |
|
9 * 2.1 only. Any references to the "GNU General Public License version 2 |
|
10 * or later" or "GPL" in the following shall be construed to mean the |
|
11 * GNU General Public License version 2 only. Any references to the "GNU |
|
12 * Lesser General Public License version 2.1 or later" or "LGPL" in the |
|
13 * following shall be construed to mean the GNU Lesser General Public |
|
14 * License version 2.1 only. However, the following notice accompanied |
|
15 * the original version of this file: |
|
16 * |
|
17 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|
18 * |
|
19 * The contents of this file are subject to the Mozilla Public License Version |
|
20 * 1.1 (the "License"); you may not use this file except in compliance with |
|
21 * the License. You may obtain a copy of the License at |
|
22 * http://www.mozilla.org/MPL/ |
|
23 * |
|
24 * Software distributed under the License is distributed on an "AS IS" basis, |
|
25 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
26 * for the specific language governing rights and limitations under the |
|
27 * License. |
|
28 * |
25 * |
29 * The Original Code is the Netscape security libraries. |
26 * The Original Code is the Netscape security libraries. |
30 * |
27 * |
31 * The Initial Developer of the Original Code is |
28 * The Initial Developer of the Original Code is |
32 * Netscape Communications Corporation. |
29 * Netscape Communications Corporation. |
36 * Contributor(s): |
33 * Contributor(s): |
37 * Sheueling Chang Shantz <sheueling.chang@sun.com>, |
34 * Sheueling Chang Shantz <sheueling.chang@sun.com>, |
38 * Stephen Fung <stephen.fung@sun.com>, and |
35 * Stephen Fung <stephen.fung@sun.com>, and |
39 * Douglas Stebila <douglas@stebila.ca> of Sun Laboratories. |
36 * Douglas Stebila <douglas@stebila.ca> of Sun Laboratories. |
40 * |
37 * |
41 * Alternatively, the contents of this file may be used under the terms of |
|
42 * either the GNU General Public License Version 2 or later (the "GPL"), or |
|
43 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
44 * in which case the provisions of the GPL or the LGPL are applicable instead |
|
45 * of those above. If you wish to allow use of your version of this file only |
|
46 * under the terms of either the GPL or the LGPL, and not to allow others to |
|
47 * use your version of this file under the terms of the MPL, indicate your |
|
48 * decision by deleting the provisions above and replace them with the notice |
|
49 * and other provisions required by the GPL or the LGPL. If you do not delete |
|
50 * the provisions above, a recipient may use your version of this file under |
|
51 * the terms of any one of the MPL, the GPL or the LGPL. |
|
52 * |
|
53 *********************************************************************** */ |
38 *********************************************************************** */ |
54 /* |
|
55 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. |
|
56 * Use is subject to license terms. |
|
57 */ |
|
58 |
|
59 /* $Id: mpmontg.c,v 1.20 2006/08/29 02:41:38 nelson%bolyard.com Exp $ */ |
|
60 |
39 |
61 /* This file implements moduluar exponentiation using Montgomery's |
40 /* This file implements moduluar exponentiation using Montgomery's |
62 * method for modular reduction. This file implements the method |
41 * method for modular reduction. This file implements the method |
63 * described as "Improvement 1" in the paper "A Cryptogrpahic Library for |
42 * described as "Improvement 1" in the paper "A Cryptogrpahic Library for |
64 * the Motorola DSP56000" by Stephen R. Dusse' and Burton S. Kaliski Jr. |
43 * the Motorola DSP56000" by Stephen R. Dusse' and Burton S. Kaliski Jr. |