ec2_test.c revision 2
2N/A/* BEGIN CSTYLED */
1N/A/*
1N/A * ***** BEGIN LICENSE BLOCK *****
1N/A * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1N/A *
1N/A * The contents of this file are subject to the Mozilla Public License Version
1N/A * 1.1 (the "License"); you may not use this file except in compliance with
1N/A * the License. You may obtain a copy of the License at
1N/A * http://www.mozilla.org/MPL/
1N/A *
1N/A * Software distributed under the License is distributed on an "AS IS" basis,
1N/A * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1N/A * for the specific language governing rights and limitations under the
1N/A * License.
1N/A *
1N/A * The Original Code is the elliptic curve math library for binary polynomial field curves.
1N/A *
1N/A * The Initial Developer of the Original Code is
1N/A * Sun Microsystems, Inc.
1N/A * Portions created by the Initial Developer are Copyright (C) 2003
1N/A * the Initial Developer. All Rights Reserved.
1N/A *
1N/A * Contributor(s):
1N/A * Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
1N/A *
1N/A * Alternatively, the contents of this file may be used under the terms of
1N/A * either the GNU General Public License Version 2 or later (the "GPL"), or
1N/A * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1N/A * in which case the provisions of the GPL or the LGPL are applicable instead
1N/A * of those above. If you wish to allow use of your version of this file only
1N/A * under the terms of either the GPL or the LGPL, and not to allow others to
1N/A * use your version of this file under the terms of the MPL, indicate your
1N/A * decision by deleting the provisions above and replace them with the notice
1N/A * and other provisions required by the GPL or the LGPL. If you do not delete
1N/A * the provisions above, a recipient may use your version of this file under
1N/A * the terms of any one of the MPL, the GPL or the LGPL.
1N/A *
1N/A * ***** END LICENSE BLOCK ***** */
2N/A
1N/A/*
2N/A * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
1N/A *
1N/A * Sun elects to use this software under the MPL license.
1N/A */
1N/A
1N/A#ifdef _KERNEL
1N/A#include <sys/types.h>
1N/A#include <sys/systm.h>
1N/A#include <sys/param.h>
1N/A#include <sys/modctl.h>
1N/A#include <sys/ddi.h>
1N/A#include <sys/crypto/spi.h>
1N/A#include <sys/sysmacros.h>
1N/A#include <sys/strsun.h>
1N/A#include <sys/md5.h>
1N/A#include <sys/sha1.h>
1N/A#include <sys/sha2.h>
1N/A#include <sys/conf.h>
1N/A#include <sys/devops.h>
1N/A#include <sys/sunddi.h>
1N/A#include <sys/varargs.h>
1N/A#include <sys/kmem.h>
1N/A#include <sys/kstat.h>
1N/A#include <sys/crypto/common.h>
1N/A#else
1N/A#include <stdio.h>
1N/A#include <string.h>
1N/A#include <strings.h>
1N/A#include <assert.h>
1N/A#include <time.h>
1N/A#include <sys/time.h>
1N/A#include <sys/resource.h>
1N/A#endif /* _KERNEL */
1N/A
1N/A#include "mpi.h"
1N/A#include "mplogic.h"
1N/A#include "mpprime.h"
1N/A#include "mp_gf2m.h"
1N/A#include "ecl.h"
1N/A#include "ecl-curve.h"
1N/A#include "ec2.h"
1N/A#include "ecc_impl.h"
1N/A#include "ec.h"
1N/A
1N/A#ifndef KM_SLEEP
1N/A#define KM_SLEEP 0
1N/A#endif
1N/A
1N/A#ifndef _KERNEL
1N/A/* Time k repetitions of operation op. */
1N/A#define M_TimeOperation(op, k) { \
1N/A double dStart, dNow, dUserTime; \
1N/A struct rusage ru; \
1N/A int i; \
1N/A getrusage(RUSAGE_SELF, &ru); \
1N/A dStart = (double)ru.ru_utime.tv_sec+(double)ru.ru_utime.tv_usec*0.000001; \
1N/A for (i = 0; i < k; i++) { \
1N/A { op; } \
1N/A }; \
1N/A getrusage(RUSAGE_SELF, &ru); \
1N/A dNow = (double)ru.ru_utime.tv_sec+(double)ru.ru_utime.tv_usec*0.000001; \
1N/A dUserTime = dNow-dStart; \
1N/A if (dUserTime) printf(" %-45s k: %6i, t: %6.2f sec\n", #op, k, dUserTime); \
1N/A}
1N/A#else
1N/A#define M_TimeOperation(op, k)
1N/A#endif
1N/A
1N/A/* Test curve using generic field arithmetic. */
1N/A#define ECTEST_GENERIC_GF2M(name_c, name) \
1N/A printf("Testing %s using generic implementation...\n", name_c); \
1N/A params = EC_GetNamedCurveParams(name, KM_SLEEP); \
1N/A if (params == NULL) { \
1N/A printf(" Error: could not construct params.\n"); \
1N/A res = MP_NO; \
1N/A goto CLEANUP; \
1N/A } \
1N/A ECGroup_free(group); \
1N/A group = ECGroup_fromHex(params, KM_SLEEP); \
1N/A if (group == NULL) { \
1N/A printf(" Error: could not construct group.\n"); \
1N/A res = MP_NO; \
1N/A goto CLEANUP; \
1N/A } \
1N/A MP_CHECKOK( ectest_curve_GF2m(group, ectestPrint, ectestTime, 1, KM_SLEEP) ); \
1N/A printf("... okay.\n");
1N/A
1N/A/* Test curve using specific field arithmetic. */
1N/A#define ECTEST_NAMED_GF2M(name_c, name) \
1N/A printf("Testing %s using specific implementation...\n", name_c); \
1N/A ECGroup_free(group); \
1N/A group = ECGroup_fromName(name, KM_SLEEP); \
1N/A if (group == NULL) { \
1N/A printf(" Warning: could not construct group.\n"); \
1N/A printf("... failed; continuing with remaining tests.\n"); \
1N/A } else { \
1N/A MP_CHECKOK( ectest_curve_GF2m(group, ectestPrint, ectestTime, 0, KM_SLEEP) ); \
1N/A printf("... okay.\n"); \
1N/A }
1N/A
1N/A/* Performs basic tests of elliptic curve cryptography over binary
1N/A * polynomial fields. If tests fail, then it prints an error message,
1N/A * aborts, and returns an error code. Otherwise, returns 0. */
1N/Aint
1N/Aectest_curve_GF2m(ECGroup *group, int ectestPrint, int ectestTime,
1N/A int generic, int kmflag)
1N/A{
1N/A
1N/A mp_int one, order_1, gx, gy, rx, ry, n;
1N/A int size;
1N/A mp_err res;
1N/A char s[1000];
1N/A
1N/A /* initialize values */
1N/A MP_CHECKOK(mp_init(&one, kmflag));
1N/A MP_CHECKOK(mp_init(&order_1, kmflag));
1N/A MP_CHECKOK(mp_init(&gx, kmflag));
1N/A MP_CHECKOK(mp_init(&gy, kmflag));
1N/A MP_CHECKOK(mp_init(&rx, kmflag));
1N/A MP_CHECKOK(mp_init(&ry, kmflag));
1N/A MP_CHECKOK(mp_init(&n, kmflag));
1N/A
1N/A MP_CHECKOK(mp_set_int(&one, 1));
1N/A MP_CHECKOK(mp_sub(&group->order, &one, &order_1));
1N/A
1N/A /* encode base point */
1N/A if (group->meth->field_dec) {
1N/A MP_CHECKOK(group->meth->field_dec(&group->genx, &gx, group->meth));
1N/A MP_CHECKOK(group->meth->field_dec(&group->geny, &gy, group->meth));
1N/A } else {
1N/A MP_CHECKOK(mp_copy(&group->genx, &gx));
1N/A MP_CHECKOK(mp_copy(&group->geny, &gy));
1N/A }
1N/A
1N/A if (ectestPrint) {
1N/A /* output base point */
1N/A printf(" base point P:\n");
1N/A MP_CHECKOK(mp_toradix(&gx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&gy, s, 16));
1N/A printf(" %s\n", s);
1N/A if (group->meth->field_enc) {
1N/A printf(" base point P (encoded):\n");
1N/A MP_CHECKOK(mp_toradix(&group->genx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&group->geny, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A }
1N/A
1N/A#ifdef ECL_ENABLE_GF2M_PT_MUL_AFF
1N/A /* multiply base point by order - 1 and check for negative of base
1N/A * point */
1N/A MP_CHECKOK(ec_GF2m_pt_mul_aff
1N/A (&order_1, &group->genx, &group->geny, &rx, &ry, group));
1N/A if (ectestPrint) {
1N/A printf(" (order-1)*P (affine):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A MP_CHECKOK(group->meth->field_add(&ry, &rx, &ry, group->meth));
1N/A if ((mp_cmp(&rx, &group->genx) != 0)
1N/A || (mp_cmp(&ry, &group->geny) != 0)) {
1N/A printf(" Error: invalid result (expected (- base point)).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A#endif
1N/A
1N/A /* multiply base point by order - 1 and check for negative of base
1N/A * point */
1N/A MP_CHECKOK(ec_GF2m_pt_mul_mont
1N/A (&order_1, &group->genx, &group->geny, &rx, &ry, group));
1N/A if (ectestPrint) {
1N/A printf(" (order-1)*P (montgomery):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A MP_CHECKOK(group->meth->field_add(&ry, &rx, &ry, group->meth));
1N/A if ((mp_cmp(&rx, &group->genx) != 0)
1N/A || (mp_cmp(&ry, &group->geny) != 0)) {
1N/A printf(" Error: invalid result (expected (- base point)).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A
1N/A#ifdef ECL_ENABLE_GF2M_PROJ
1N/A /* multiply base point by order - 1 and check for negative of base
1N/A * point */
1N/A MP_CHECKOK(ec_GF2m_pt_mul_proj
1N/A (&order_1, &group->genx, &group->geny, &rx, &ry, group));
1N/A if (ectestPrint) {
1N/A printf(" (order-1)*P (projective):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A MP_CHECKOK(group->meth->field_add(&ry, &rx, &ry, group->meth));
1N/A if ((mp_cmp(&rx, &group->genx) != 0)
1N/A || (mp_cmp(&ry, &group->geny) != 0)) {
1N/A printf(" Error: invalid result (expected (- base point)).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A#endif
1N/A
1N/A /* multiply base point by order - 1 and check for negative of base
1N/A * point */
1N/A MP_CHECKOK(ECPoint_mul(group, &order_1, NULL, NULL, &rx, &ry));
1N/A if (ectestPrint) {
1N/A printf(" (order-1)*P (ECPoint_mul):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A MP_CHECKOK(ec_GF2m_add(&ry, &rx, &ry, group->meth));
1N/A if ((mp_cmp(&rx, &gx) != 0) || (mp_cmp(&ry, &gy) != 0)) {
1N/A printf(" Error: invalid result (expected (- base point)).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A
1N/A /* multiply base point by order - 1 and check for negative of base
1N/A * point */
1N/A MP_CHECKOK(ECPoint_mul(group, &order_1, &gx, &gy, &rx, &ry));
1N/A if (ectestPrint) {
1N/A printf(" (order-1)*P (ECPoint_mul):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A MP_CHECKOK(ec_GF2m_add(&ry, &rx, &ry, group->meth));
1N/A if ((mp_cmp(&rx, &gx) != 0) || (mp_cmp(&ry, &gy) != 0)) {
1N/A printf(" Error: invalid result (expected (- base point)).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A
1N/A#ifdef ECL_ENABLE_GF2M_PT_MUL_AFF
1N/A /* multiply base point by order and check for point at infinity */
1N/A MP_CHECKOK(ec_GF2m_pt_mul_aff
1N/A (&group->order, &group->genx, &group->geny, &rx, &ry,
1N/A group));
1N/A if (ectestPrint) {
1N/A printf(" (order)*P (affine):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A if (ec_GF2m_pt_is_inf_aff(&rx, &ry) != MP_YES) {
1N/A printf(" Error: invalid result (expected point at infinity).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A#endif
1N/A
1N/A /* multiply base point by order and check for point at infinity */
1N/A MP_CHECKOK(ec_GF2m_pt_mul_mont
1N/A (&group->order, &group->genx, &group->geny, &rx, &ry,
1N/A group));
1N/A if (ectestPrint) {
1N/A printf(" (order)*P (montgomery):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A if (ec_GF2m_pt_is_inf_aff(&rx, &ry) != MP_YES) {
1N/A printf(" Error: invalid result (expected point at infinity).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A
1N/A#ifdef ECL_ENABLE_GF2M_PROJ
1N/A /* multiply base point by order and check for point at infinity */
1N/A MP_CHECKOK(ec_GF2m_pt_mul_proj
1N/A (&group->order, &group->genx, &group->geny, &rx, &ry,
1N/A group));
1N/A if (ectestPrint) {
1N/A printf(" (order)*P (projective):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A if (ec_GF2m_pt_is_inf_aff(&rx, &ry) != MP_YES) {
1N/A printf(" Error: invalid result (expected point at infinity).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A#endif
1N/A
1N/A /* multiply base point by order and check for point at infinity */
1N/A MP_CHECKOK(ECPoint_mul(group, &group->order, NULL, NULL, &rx, &ry));
1N/A if (ectestPrint) {
1N/A printf(" (order)*P (ECPoint_mul):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A if (ec_GF2m_pt_is_inf_aff(&rx, &ry) != MP_YES) {
1N/A printf(" Error: invalid result (expected point at infinity).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A
1N/A /* multiply base point by order and check for point at infinity */
1N/A MP_CHECKOK(ECPoint_mul(group, &group->order, &gx, &gy, &rx, &ry));
1N/A if (ectestPrint) {
1N/A printf(" (order)*P (ECPoint_mul):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A if (ec_GF2m_pt_is_inf_aff(&rx, &ry) != MP_YES) {
1N/A printf(" Error: invalid result (expected point at infinity).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A
1N/A /* check that (order-1)P + (order-1)P + P == (order-1)P */
1N/A MP_CHECKOK(ECPoints_mul
1N/A (group, &order_1, &order_1, &gx, &gy, &rx, &ry));
1N/A MP_CHECKOK(ECPoints_mul(group, &one, &one, &rx, &ry, &rx, &ry));
1N/A if (ectestPrint) {
1N/A printf
1N/A (" (order-1)*P + (order-1)*P + P == (order-1)*P (ECPoints_mul):\n");
1N/A MP_CHECKOK(mp_toradix(&rx, s, 16));
1N/A printf(" %s\n", s);
1N/A MP_CHECKOK(mp_toradix(&ry, s, 16));
1N/A printf(" %s\n", s);
1N/A }
1N/A MP_CHECKOK(ec_GF2m_add(&ry, &rx, &ry, group->meth));
1N/A if ((mp_cmp(&rx, &gx) != 0) || (mp_cmp(&ry, &gy) != 0)) {
1N/A printf(" Error: invalid result (expected (- base point)).\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A
1N/A /* test validate_point function */
1N/A if (ECPoint_validate(group, &gx, &gy) != MP_YES) {
1N/A printf(" Error: validate point on base point failed.\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A MP_CHECKOK(mp_add_d(&gy, 1, &ry));
1N/A if (ECPoint_validate(group, &gx, &ry) != MP_NO) {
1N/A printf(" Error: validate point on invalid point passed.\n");
1N/A res = MP_NO;
1N/A goto CLEANUP;
1N/A }
1N/A
1N/A if (ectestTime) {
1N/A /* compute random scalar */
1N/A size = mpl_significant_bits(&group->meth->irr);
1N/A if (size < MP_OKAY) {
1N/A goto CLEANUP;
1N/A }
1N/A MP_CHECKOK(mpp_random_size(&n, (size + ECL_BITS - 1) / ECL_BITS));
1N/A MP_CHECKOK(group->meth->field_mod(&n, &n, group->meth));
1N/A /* timed test */
1N/A if (generic) {
1N/A#ifdef ECL_ENABLE_GF2M_PT_MUL_AFF
1N/A M_TimeOperation(MP_CHECKOK
1N/A (ec_GF2m_pt_mul_aff
1N/A (&n, &group->genx, &group->geny, &rx, &ry,
1N/A group)), 100);
1N/A#endif
1N/A M_TimeOperation(MP_CHECKOK
1N/A (ECPoint_mul(group, &n, NULL, NULL, &rx, &ry)),
1N/A 100);
1N/A M_TimeOperation(MP_CHECKOK
1N/A (ECPoints_mul
1N/A (group, &n, &n, &gx, &gy, &rx, &ry)), 100);
1N/A } else {
1N/A M_TimeOperation(MP_CHECKOK
1N/A (ECPoint_mul(group, &n, NULL, NULL, &rx, &ry)),
1N/A 100);
1N/A M_TimeOperation(MP_CHECKOK
1N/A (ECPoint_mul(group, &n, &gx, &gy, &rx, &ry)),
1N/A 100);
1N/A M_TimeOperation(MP_CHECKOK
1N/A (ECPoints_mul
1N/A (group, &n, &n, &gx, &gy, &rx, &ry)), 100);
1N/A }
1N/A }
1N/A
1N/A CLEANUP:
1N/A mp_clear(&one);
1N/A mp_clear(&order_1);
1N/A mp_clear(&gx);
1N/A mp_clear(&gy);
1N/A mp_clear(&rx);
1N/A mp_clear(&ry);
1N/A mp_clear(&n);
1N/A if (res != MP_OKAY) {
1N/A#ifdef _KERNEL
1N/A printf(" Error: exiting with error value 0x%x\n", res);
1N/A#else
1N/A printf(" Error: exiting with error value %i\n", res);
1N/A#endif
1N/A }
1N/A return res;
1N/A}
1N/A
1N/A/* Performs tests of elliptic curve cryptography over binary polynomial
1N/A * fields. If tests fail, then it prints an error message, aborts, and
1N/A * returns an error code. Otherwise, returns 0. */
1N/Aint
1N/Aec2_test()
1N/A{
1N/A int ectestTime = 0;
1N/A int ectestPrint = 0;
1N/A int i;
1N/A ECGroup *group = NULL;
1N/A ECCurveParams *params = NULL;
1N/A mp_err res;
1N/A
1N/A /* generic arithmetic tests */
1N/A ECTEST_GENERIC_GF2M("SECT-131R1", ECCurve_SECG_CHAR2_131R1);
1N/A
1N/A /* specific arithmetic tests */
1N/A ECTEST_NAMED_GF2M("NIST-K163", ECCurve_NIST_K163);
1N/A ECTEST_NAMED_GF2M("NIST-B163", ECCurve_NIST_B163);
1N/A ECTEST_NAMED_GF2M("NIST-K233", ECCurve_NIST_K233);
1N/A ECTEST_NAMED_GF2M("NIST-B233", ECCurve_NIST_B233);
1N/A ECTEST_NAMED_GF2M("NIST-K283", ECCurve_NIST_K283);
1N/A ECTEST_NAMED_GF2M("NIST-B283", ECCurve_NIST_B283);
1N/A ECTEST_NAMED_GF2M("NIST-K409", ECCurve_NIST_K409);
1N/A ECTEST_NAMED_GF2M("NIST-B409", ECCurve_NIST_B409);
1N/A ECTEST_NAMED_GF2M("NIST-K571", ECCurve_NIST_K571);
1N/A ECTEST_NAMED_GF2M("NIST-B571", ECCurve_NIST_B571);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2PNB163V1", ECCurve_X9_62_CHAR2_PNB163V1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2PNB163V2", ECCurve_X9_62_CHAR2_PNB163V2);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2PNB163V3", ECCurve_X9_62_CHAR2_PNB163V3);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2PNB176V1", ECCurve_X9_62_CHAR2_PNB176V1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2TNB191V1", ECCurve_X9_62_CHAR2_TNB191V1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2TNB191V2", ECCurve_X9_62_CHAR2_TNB191V2);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2TNB191V3", ECCurve_X9_62_CHAR2_TNB191V3);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2PNB208W1", ECCurve_X9_62_CHAR2_PNB208W1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2TNB239V1", ECCurve_X9_62_CHAR2_TNB239V1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2TNB239V2", ECCurve_X9_62_CHAR2_TNB239V2);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2TNB239V3", ECCurve_X9_62_CHAR2_TNB239V3);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2PNB272W1", ECCurve_X9_62_CHAR2_PNB272W1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2PNB304W1", ECCurve_X9_62_CHAR2_PNB304W1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2TNB359V1", ECCurve_X9_62_CHAR2_TNB359V1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2PNB368W1", ECCurve_X9_62_CHAR2_PNB368W1);
1N/A ECTEST_NAMED_GF2M("ANSI X9.62 C2TNB431R1", ECCurve_X9_62_CHAR2_TNB431R1);
1N/A ECTEST_NAMED_GF2M("SECT-113R1", ECCurve_SECG_CHAR2_113R1);
1N/A ECTEST_NAMED_GF2M("SECT-113R2", ECCurve_SECG_CHAR2_113R2);
1N/A ECTEST_NAMED_GF2M("SECT-131R1", ECCurve_SECG_CHAR2_131R1);
1N/A ECTEST_NAMED_GF2M("SECT-131R2", ECCurve_SECG_CHAR2_131R2);
1N/A ECTEST_NAMED_GF2M("SECT-163K1", ECCurve_SECG_CHAR2_163K1);
1N/A ECTEST_NAMED_GF2M("SECT-163R1", ECCurve_SECG_CHAR2_163R1);
1N/A ECTEST_NAMED_GF2M("SECT-163R2", ECCurve_SECG_CHAR2_163R2);
1N/A ECTEST_NAMED_GF2M("SECT-193R1", ECCurve_SECG_CHAR2_193R1);
1N/A ECTEST_NAMED_GF2M("SECT-193R2", ECCurve_SECG_CHAR2_193R2);
1N/A ECTEST_NAMED_GF2M("SECT-233K1", ECCurve_SECG_CHAR2_233K1);
1N/A ECTEST_NAMED_GF2M("SECT-233R1", ECCurve_SECG_CHAR2_233R1);
1N/A ECTEST_NAMED_GF2M("SECT-239K1", ECCurve_SECG_CHAR2_239K1);
1N/A ECTEST_NAMED_GF2M("SECT-283K1", ECCurve_SECG_CHAR2_283K1);
1N/A ECTEST_NAMED_GF2M("SECT-283R1", ECCurve_SECG_CHAR2_283R1);
1N/A ECTEST_NAMED_GF2M("SECT-409K1", ECCurve_SECG_CHAR2_409K1);
1N/A ECTEST_NAMED_GF2M("SECT-409R1", ECCurve_SECG_CHAR2_409R1);
1N/A ECTEST_NAMED_GF2M("SECT-571K1", ECCurve_SECG_CHAR2_571K1);
1N/A ECTEST_NAMED_GF2M("SECT-571R1", ECCurve_SECG_CHAR2_571R1);
1N/A ECTEST_NAMED_GF2M("WTLS-1 (113)", ECCurve_WTLS_1);
1N/A ECTEST_NAMED_GF2M("WTLS-3 (163)", ECCurve_WTLS_3);
1N/A ECTEST_NAMED_GF2M("WTLS-4 (113)", ECCurve_WTLS_4);
1N/A ECTEST_NAMED_GF2M("WTLS-5 (163)", ECCurve_WTLS_5);
1N/A ECTEST_NAMED_GF2M("WTLS-10 (233)", ECCurve_WTLS_10);
1N/A ECTEST_NAMED_GF2M("WTLS-11 (233)", ECCurve_WTLS_11);
1N/A
1N/A CLEANUP:
1N/A EC_FreeCurveParams(params);
1N/A ECGroup_free(group);
1N/A if (res != MP_OKAY) {
1N/A#ifdef _KERNEL
1N/A printf("Error: exiting with error value 0x%x\n", res);
1N/A#else
1N/A printf("Error: exiting with error value %i\n", res);
1N/A#endif
1N/A }
1N/A return res;
1N/A}
2N/A/* END CSTYLED */