33 * Portions created by the Initial Developer are Copyright (C) 2003
34 * the Initial Developer. All Rights Reserved.
35 *
36 * Contributor(s):
37 * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
38 *
39 * Alternatively, the contents of this file may be used under the terms of
40 * either the GNU General Public License Version 2 or later (the "GPL"), or
41 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
42 * in which case the provisions of the GPL or the LGPL are applicable instead
43 * of those above. If you wish to allow use of your version of this file only
44 * under the terms of either the GPL or the LGPL, and not to allow others to
45 * use your version of this file under the terms of the MPL, indicate your
46 * decision by deleting the provisions above and replace them with the notice
47 * and other provisions required by the GPL or the LGPL. If you do not delete
48 * the provisions above, a recipient may use your version of this file under
49 * the terms of any one of the MPL, the GPL or the LGPL.
50 *
51 *********************************************************************** */
52 /*
53 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
54 * Use is subject to license terms.
55 */
56
57 #include "mpi.h"
58 #include "mplogic.h"
59 #include "ecl.h"
60 #include "ecl-priv.h"
61 #ifndef _KERNEL
62 #include <stdlib.h>
63 #endif
64
65 /* Elliptic curve scalar-point multiplication. Computes R(x, y) = k * P(x,
66 * y). If x, y = NULL, then P is assumed to be the generator (base point)
67 * of the group of points on the elliptic curve. Input and output values
68 * are assumed to be NOT field-encoded. */
69 mp_err
70 ECPoint_mul(const ECGroup *group, const mp_int *k, const mp_int *px,
71 const mp_int *py, mp_int *rx, mp_int *ry)
72 {
73 mp_err res = MP_OKAY;
|
33 * Portions created by the Initial Developer are Copyright (C) 2003
34 * the Initial Developer. All Rights Reserved.
35 *
36 * Contributor(s):
37 * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
38 *
39 * Alternatively, the contents of this file may be used under the terms of
40 * either the GNU General Public License Version 2 or later (the "GPL"), or
41 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
42 * in which case the provisions of the GPL or the LGPL are applicable instead
43 * of those above. If you wish to allow use of your version of this file only
44 * under the terms of either the GPL or the LGPL, and not to allow others to
45 * use your version of this file under the terms of the MPL, indicate your
46 * decision by deleting the provisions above and replace them with the notice
47 * and other provisions required by the GPL or the LGPL. If you do not delete
48 * the provisions above, a recipient may use your version of this file under
49 * the terms of any one of the MPL, the GPL or the LGPL.
50 *
51 *********************************************************************** */
52 /*
53 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
54 * Use is subject to license terms.
55 */
56
57 #include "mpi.h"
58 #include "mplogic.h"
59 #include "ecl.h"
60 #include "ecl-priv.h"
61 #ifndef _KERNEL
62 #include <stdlib.h>
63 #endif
64
65 /* Elliptic curve scalar-point multiplication. Computes R(x, y) = k * P(x,
66 * y). If x, y = NULL, then P is assumed to be the generator (base point)
67 * of the group of points on the elliptic curve. Input and output values
68 * are assumed to be NOT field-encoded. */
69 mp_err
70 ECPoint_mul(const ECGroup *group, const mp_int *k, const mp_int *px,
71 const mp_int *py, mp_int *rx, mp_int *ry)
72 {
73 mp_err res = MP_OKAY;
|