4272N/A/*
4272N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
4272N/A * Use is subject to license terms.
4272N/A *
4272N/A * This library is free software; you can redistribute it and/or
4272N/A * modify it under the terms of the GNU Lesser General Public
4272N/A * License as published by the Free Software Foundation; either
4272N/A * version 2.1 of the License, or (at your option) any later version.
1674N/A *
4272N/A * This library is distributed in the hope that it will be useful,
4272N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
4272N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4272N/A * Lesser General Public License for more details.
1674N/A *
4272N/A * You should have received a copy of the GNU Lesser General Public License
4272N/A * along with this library; if not, write to the Free Software Foundation,
4272N/A * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1674N/A *
4272N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4272N/A * or visit www.oracle.com if you need additional information or have any
4272N/A * questions.
4272N/A */
4272N/A
4272N/A/* *********************************************************************
1674N/A *
1674N/A * The Original Code is the elliptic curve math library.
1674N/A *
1674N/A * The Initial Developer of the Original Code is
1674N/A * Sun Microsystems, Inc.
1674N/A * Portions created by the Initial Developer are Copyright (C) 2003
1674N/A * the Initial Developer. All Rights Reserved.
1674N/A *
1674N/A * Contributor(s):
1674N/A * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
1674N/A *
1674N/A *********************************************************************** */
1674N/A
1674N/A#ifndef _ECL_H
1674N/A#define _ECL_H
1674N/A
1674N/A/* Although this is not an exported header file, code which uses elliptic
1674N/A * curve point operations will need to include it. */
1674N/A
1674N/A#include "ecl-exp.h"
1674N/A#include "mpi.h"
1674N/A
1674N/Astruct ECGroupStr;
1674N/Atypedef struct ECGroupStr ECGroup;
1674N/A
1674N/A/* Construct ECGroup from hexadecimal representations of parameters. */
1674N/AECGroup *ECGroup_fromHex(const ECCurveParams * params, int kmflag);
1674N/A
1674N/A/* Construct ECGroup from named parameters. */
1674N/AECGroup *ECGroup_fromName(const ECCurveName name, int kmflag);
1674N/A
1674N/A/* Free an allocated ECGroup. */
1674N/Avoid ECGroup_free(ECGroup *group);
1674N/A
1674N/A/* Construct ECCurveParams from an ECCurveName */
1674N/AECCurveParams *EC_GetNamedCurveParams(const ECCurveName name, int kmflag);
1674N/A
1674N/A/* Duplicates an ECCurveParams */
1674N/AECCurveParams *ECCurveParams_dup(const ECCurveParams * params, int kmflag);
1674N/A
1674N/A/* Free an allocated ECCurveParams */
1674N/Avoid EC_FreeCurveParams(ECCurveParams * params);
1674N/A
1674N/A/* Elliptic curve scalar-point multiplication. Computes Q(x, y) = k * P(x,
1674N/A * y). If x, y = NULL, then P is assumed to be the generator (base point)
1674N/A * of the group of points on the elliptic curve. Input and output values
1674N/A * are assumed to be NOT field-encoded. */
1674N/Amp_err ECPoint_mul(const ECGroup *group, const mp_int *k, const mp_int *px,
1674N/A const mp_int *py, mp_int *qx, mp_int *qy);
1674N/A
1674N/A/* Elliptic curve scalar-point multiplication. Computes Q(x, y) = k1 * G +
1674N/A * k2 * P(x, y), where G is the generator (base point) of the group of
1674N/A * points on the elliptic curve. Input and output values are assumed to
1674N/A * be NOT field-encoded. */
1674N/Amp_err ECPoints_mul(const ECGroup *group, const mp_int *k1,
1674N/A const mp_int *k2, const mp_int *px, const mp_int *py,
1674N/A mp_int *qx, mp_int *qy);
1674N/A
1674N/A/* Validates an EC public key as described in Section 5.2.2 of X9.62.
1674N/A * Returns MP_YES if the public key is valid, MP_NO if the public key
1674N/A * is invalid, or an error code if the validation could not be
1674N/A * performed. */
1674N/Amp_err ECPoint_validate(const ECGroup *group, const mp_int *px, const
1674N/A mp_int *py);
1674N/A
1674N/A#endif /* _ECL_H */