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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/lib/freebl/ecl/ecl.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +/* Although this is not an exported header file, code which uses elliptic
     1.9 + * curve point operations will need to include it. */
    1.10 +
    1.11 +#ifndef __ecl_h_
    1.12 +#define __ecl_h_
    1.13 +
    1.14 +#include "ecl-exp.h"
    1.15 +#include "mpi.h"
    1.16 +
    1.17 +struct ECGroupStr;
    1.18 +typedef struct ECGroupStr ECGroup;
    1.19 +
    1.20 +/* Construct ECGroup from hexadecimal representations of parameters. */
    1.21 +ECGroup *ECGroup_fromHex(const ECCurveParams * params);
    1.22 +
    1.23 +/* Construct ECGroup from named parameters. */
    1.24 +ECGroup *ECGroup_fromName(const ECCurveName name);
    1.25 +
    1.26 +/* Free an allocated ECGroup. */
    1.27 +void ECGroup_free(ECGroup *group);
    1.28 +
    1.29 +/* Construct ECCurveParams from an ECCurveName */
    1.30 +ECCurveParams *EC_GetNamedCurveParams(const ECCurveName name);
    1.31 +
    1.32 +/* Duplicates an ECCurveParams */
    1.33 +ECCurveParams *ECCurveParams_dup(const ECCurveParams * params);
    1.34 +
    1.35 +/* Free an allocated ECCurveParams */
    1.36 +void EC_FreeCurveParams(ECCurveParams * params);
    1.37 +
    1.38 +/* Elliptic curve scalar-point multiplication. Computes Q(x, y) = k * P(x, 
    1.39 + * y).  If x, y = NULL, then P is assumed to be the generator (base point) 
    1.40 + * of the group of points on the elliptic curve. Input and output values
    1.41 + * are assumed to be NOT field-encoded. */
    1.42 +mp_err ECPoint_mul(const ECGroup *group, const mp_int *k, const mp_int *px,
    1.43 +				   const mp_int *py, mp_int *qx, mp_int *qy);
    1.44 +
    1.45 +/* Elliptic curve scalar-point multiplication. Computes Q(x, y) = k1 * G + 
    1.46 + * k2 * P(x, y), where G is the generator (base point) of the group of
    1.47 + * points on the elliptic curve. Input and output values are assumed to
    1.48 + * be NOT field-encoded. */
    1.49 +mp_err ECPoints_mul(const ECGroup *group, const mp_int *k1,
    1.50 +					const mp_int *k2, const mp_int *px, const mp_int *py,
    1.51 +					mp_int *qx, mp_int *qy);
    1.52 +
    1.53 +/* Validates an EC public key as described in Section 5.2.2 of X9.62.
    1.54 + * Returns MP_YES if the public key is valid, MP_NO if the public key
    1.55 + * is invalid, or an error code if the validation could not be
    1.56 + * performed. */
    1.57 +mp_err ECPoint_validate(const ECGroup *group, const mp_int *px, const 
    1.58 +					mp_int *py);
    1.59 +
    1.60 +#endif							/* __ecl_h_ */

mercurial