35 *
36 * Contributor(s):
37 * Sheueling Chang-Shantz <sheueling.chang@sun.com>,
38 * Stephen Fung <fungstep@hotmail.com>, and
39 * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories.
40 *
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 *********************************************************************** */
54 /*
55 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
56 * Use is subject to license terms.
57 */
58
59 #include "ec2.h"
60 #include "mplogic.h"
61 #include "mp_gf2m.h"
62 #ifndef _KERNEL
63 #include <stdlib.h>
64 #endif
65
66 /* Compute the x-coordinate x/z for the point 2*(x/z) in Montgomery
67 * projective coordinates. Uses algorithm Mdouble in appendix of Lopez, J.
68 * and Dahab, R. "Fast multiplication on elliptic curves over GF(2^m)
69 * without precomputation". modified to not require precomputation of
70 * c=b^{2^{m-1}}. */
71 static mp_err
72 gf2m_Mdouble(mp_int *x, mp_int *z, const ECGroup *group, int kmflag)
73 {
74 mp_err res = MP_OKAY;
75 mp_int t1;
|
35 *
36 * Contributor(s):
37 * Sheueling Chang-Shantz <sheueling.chang@sun.com>,
38 * Stephen Fung <fungstep@hotmail.com>, and
39 * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories.
40 *
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 *********************************************************************** */
54 /*
55 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
56 * Use is subject to license terms.
57 */
58
59 #include "ec2.h"
60 #include "mplogic.h"
61 #include "mp_gf2m.h"
62 #ifndef _KERNEL
63 #include <stdlib.h>
64 #endif
65
66 /* Compute the x-coordinate x/z for the point 2*(x/z) in Montgomery
67 * projective coordinates. Uses algorithm Mdouble in appendix of Lopez, J.
68 * and Dahab, R. "Fast multiplication on elliptic curves over GF(2^m)
69 * without precomputation". modified to not require precomputation of
70 * c=b^{2^{m-1}}. */
71 static mp_err
72 gf2m_Mdouble(mp_int *x, mp_int *z, const ECGroup *group, int kmflag)
73 {
74 mp_err res = MP_OKAY;
75 mp_int t1;
|