security/nss/lib/freebl/ecl/ecl.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 /* Although this is not an exported header file, code which uses elliptic
michael@0 6 * curve point operations will need to include it. */
michael@0 7
michael@0 8 #ifndef __ecl_h_
michael@0 9 #define __ecl_h_
michael@0 10
michael@0 11 #include "ecl-exp.h"
michael@0 12 #include "mpi.h"
michael@0 13
michael@0 14 struct ECGroupStr;
michael@0 15 typedef struct ECGroupStr ECGroup;
michael@0 16
michael@0 17 /* Construct ECGroup from hexadecimal representations of parameters. */
michael@0 18 ECGroup *ECGroup_fromHex(const ECCurveParams * params);
michael@0 19
michael@0 20 /* Construct ECGroup from named parameters. */
michael@0 21 ECGroup *ECGroup_fromName(const ECCurveName name);
michael@0 22
michael@0 23 /* Free an allocated ECGroup. */
michael@0 24 void ECGroup_free(ECGroup *group);
michael@0 25
michael@0 26 /* Construct ECCurveParams from an ECCurveName */
michael@0 27 ECCurveParams *EC_GetNamedCurveParams(const ECCurveName name);
michael@0 28
michael@0 29 /* Duplicates an ECCurveParams */
michael@0 30 ECCurveParams *ECCurveParams_dup(const ECCurveParams * params);
michael@0 31
michael@0 32 /* Free an allocated ECCurveParams */
michael@0 33 void EC_FreeCurveParams(ECCurveParams * params);
michael@0 34
michael@0 35 /* Elliptic curve scalar-point multiplication. Computes Q(x, y) = k * P(x,
michael@0 36 * y). If x, y = NULL, then P is assumed to be the generator (base point)
michael@0 37 * of the group of points on the elliptic curve. Input and output values
michael@0 38 * are assumed to be NOT field-encoded. */
michael@0 39 mp_err ECPoint_mul(const ECGroup *group, const mp_int *k, const mp_int *px,
michael@0 40 const mp_int *py, mp_int *qx, mp_int *qy);
michael@0 41
michael@0 42 /* Elliptic curve scalar-point multiplication. Computes Q(x, y) = k1 * G +
michael@0 43 * k2 * P(x, y), where G is the generator (base point) of the group of
michael@0 44 * points on the elliptic curve. Input and output values are assumed to
michael@0 45 * be NOT field-encoded. */
michael@0 46 mp_err ECPoints_mul(const ECGroup *group, const mp_int *k1,
michael@0 47 const mp_int *k2, const mp_int *px, const mp_int *py,
michael@0 48 mp_int *qx, mp_int *qy);
michael@0 49
michael@0 50 /* Validates an EC public key as described in Section 5.2.2 of X9.62.
michael@0 51 * Returns MP_YES if the public key is valid, MP_NO if the public key
michael@0 52 * is invalid, or an error code if the validation could not be
michael@0 53 * performed. */
michael@0 54 mp_err ECPoint_validate(const ECGroup *group, const mp_int *px, const
michael@0 55 mp_int *py);
michael@0 56
michael@0 57 #endif /* __ecl_h_ */

mercurial