• Home
  • History
  • Annotate
  • only in this directory
1/*
2 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
3 * Use is subject to license terms.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24/* *********************************************************************
25 *
26 * The Original Code is the elliptic curve math library.
27 *
28 * The Initial Developer of the Original Code is
29 * Sun Microsystems, Inc.
30 * Portions created by the Initial Developer are Copyright (C) 2003
31 * the Initial Developer. All Rights Reserved.
32 *
33 * Contributor(s):
34 *   Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
35 *
36 *********************************************************************** */
37
38#ifndef _ECL_EXP_H
39#define _ECL_EXP_H
40
41/* Curve field type */
42typedef enum {
43        ECField_GFp,
44        ECField_GF2m
45} ECField;
46
47/* Hexadecimal encoding of curve parameters */
48struct ECCurveParamsStr {
49        char *text;
50        ECField field;
51        unsigned int size;
52        char *irr;
53        char *curvea;
54        char *curveb;
55        char *genx;
56        char *geny;
57        char *order;
58        int cofactor;
59};
60typedef struct ECCurveParamsStr ECCurveParams;
61
62/* Named curve parameters */
63typedef enum {
64
65        ECCurve_noName = 0,
66
67        /* NIST prime curves */
68        ECCurve_NIST_P192,
69        ECCurve_NIST_P224,
70        ECCurve_NIST_P256,
71        ECCurve_NIST_P384,
72        ECCurve_NIST_P521,
73
74        /* NIST binary curves */
75        ECCurve_NIST_K163,
76        ECCurve_NIST_B163,
77        ECCurve_NIST_K233,
78        ECCurve_NIST_B233,
79        ECCurve_NIST_K283,
80        ECCurve_NIST_B283,
81        ECCurve_NIST_K409,
82        ECCurve_NIST_B409,
83        ECCurve_NIST_K571,
84        ECCurve_NIST_B571,
85
86        /* ANSI X9.62 prime curves */
87        /* ECCurve_X9_62_PRIME_192V1 == ECCurve_NIST_P192 */
88        ECCurve_X9_62_PRIME_192V2,
89        ECCurve_X9_62_PRIME_192V3,
90        ECCurve_X9_62_PRIME_239V1,
91        ECCurve_X9_62_PRIME_239V2,
92        ECCurve_X9_62_PRIME_239V3,
93        /* ECCurve_X9_62_PRIME_256V1 == ECCurve_NIST_P256 */
94
95        /* ANSI X9.62 binary curves */
96        ECCurve_X9_62_CHAR2_PNB163V1,
97        ECCurve_X9_62_CHAR2_PNB163V2,
98        ECCurve_X9_62_CHAR2_PNB163V3,
99        ECCurve_X9_62_CHAR2_PNB176V1,
100        ECCurve_X9_62_CHAR2_TNB191V1,
101        ECCurve_X9_62_CHAR2_TNB191V2,
102        ECCurve_X9_62_CHAR2_TNB191V3,
103        ECCurve_X9_62_CHAR2_PNB208W1,
104        ECCurve_X9_62_CHAR2_TNB239V1,
105        ECCurve_X9_62_CHAR2_TNB239V2,
106        ECCurve_X9_62_CHAR2_TNB239V3,
107        ECCurve_X9_62_CHAR2_PNB272W1,
108        ECCurve_X9_62_CHAR2_PNB304W1,
109        ECCurve_X9_62_CHAR2_TNB359V1,
110        ECCurve_X9_62_CHAR2_PNB368W1,
111        ECCurve_X9_62_CHAR2_TNB431R1,
112
113        /* SEC2 prime curves */
114        ECCurve_SECG_PRIME_112R1,
115        ECCurve_SECG_PRIME_112R2,
116        ECCurve_SECG_PRIME_128R1,
117        ECCurve_SECG_PRIME_128R2,
118        ECCurve_SECG_PRIME_160K1,
119        ECCurve_SECG_PRIME_160R1,
120        ECCurve_SECG_PRIME_160R2,
121        ECCurve_SECG_PRIME_192K1,
122        /* ECCurve_SECG_PRIME_192R1 == ECCurve_NIST_P192 */
123        ECCurve_SECG_PRIME_224K1,
124        /* ECCurve_SECG_PRIME_224R1 == ECCurve_NIST_P224 */
125        ECCurve_SECG_PRIME_256K1,
126        /* ECCurve_SECG_PRIME_256R1 == ECCurve_NIST_P256 */
127        /* ECCurve_SECG_PRIME_384R1 == ECCurve_NIST_P384 */
128        /* ECCurve_SECG_PRIME_521R1 == ECCurve_NIST_P521 */
129
130        /* SEC2 binary curves */
131        ECCurve_SECG_CHAR2_113R1,
132        ECCurve_SECG_CHAR2_113R2,
133        ECCurve_SECG_CHAR2_131R1,
134        ECCurve_SECG_CHAR2_131R2,
135        /* ECCurve_SECG_CHAR2_163K1 == ECCurve_NIST_K163 */
136        ECCurve_SECG_CHAR2_163R1,
137        /* ECCurve_SECG_CHAR2_163R2 == ECCurve_NIST_B163 */
138        ECCurve_SECG_CHAR2_193R1,
139        ECCurve_SECG_CHAR2_193R2,
140        /* ECCurve_SECG_CHAR2_233K1 == ECCurve_NIST_K233 */
141        /* ECCurve_SECG_CHAR2_233R1 == ECCurve_NIST_B233 */
142        ECCurve_SECG_CHAR2_239K1,
143        /* ECCurve_SECG_CHAR2_283K1 == ECCurve_NIST_K283 */
144        /* ECCurve_SECG_CHAR2_283R1 == ECCurve_NIST_B283 */
145        /* ECCurve_SECG_CHAR2_409K1 == ECCurve_NIST_K409 */
146        /* ECCurve_SECG_CHAR2_409R1 == ECCurve_NIST_B409 */
147        /* ECCurve_SECG_CHAR2_571K1 == ECCurve_NIST_K571 */
148        /* ECCurve_SECG_CHAR2_571R1 == ECCurve_NIST_B571 */
149
150        /* WTLS curves */
151        ECCurve_WTLS_1,
152        /* there is no WTLS 2 curve */
153        /* ECCurve_WTLS_3 == ECCurve_NIST_K163 */
154        /* ECCurve_WTLS_4 == ECCurve_SECG_CHAR2_113R1 */
155        /* ECCurve_WTLS_5 == ECCurve_X9_62_CHAR2_PNB163V1 */
156        /* ECCurve_WTLS_6 == ECCurve_SECG_PRIME_112R1 */
157        /* ECCurve_WTLS_7 == ECCurve_SECG_PRIME_160R1 */
158        ECCurve_WTLS_8,
159        ECCurve_WTLS_9,
160        /* ECCurve_WTLS_10 == ECCurve_NIST_K233 */
161        /* ECCurve_WTLS_11 == ECCurve_NIST_B233 */
162        /* ECCurve_WTLS_12 == ECCurve_NIST_P224 */
163
164        ECCurve_pastLastCurve
165} ECCurveName;
166
167/* Aliased named curves */
168
169#define ECCurve_X9_62_PRIME_192V1 ECCurve_NIST_P192
170#define ECCurve_X9_62_PRIME_256V1 ECCurve_NIST_P256
171#define ECCurve_SECG_PRIME_192R1 ECCurve_NIST_P192
172#define ECCurve_SECG_PRIME_224R1 ECCurve_NIST_P224
173#define ECCurve_SECG_PRIME_256R1 ECCurve_NIST_P256
174#define ECCurve_SECG_PRIME_384R1 ECCurve_NIST_P384
175#define ECCurve_SECG_PRIME_521R1 ECCurve_NIST_P521
176#define ECCurve_SECG_CHAR2_163K1 ECCurve_NIST_K163
177#define ECCurve_SECG_CHAR2_163R2 ECCurve_NIST_B163
178#define ECCurve_SECG_CHAR2_233K1 ECCurve_NIST_K233
179#define ECCurve_SECG_CHAR2_233R1 ECCurve_NIST_B233
180#define ECCurve_SECG_CHAR2_283K1 ECCurve_NIST_K283
181#define ECCurve_SECG_CHAR2_283R1 ECCurve_NIST_B283
182#define ECCurve_SECG_CHAR2_409K1 ECCurve_NIST_K409
183#define ECCurve_SECG_CHAR2_409R1 ECCurve_NIST_B409
184#define ECCurve_SECG_CHAR2_571K1 ECCurve_NIST_K571
185#define ECCurve_SECG_CHAR2_571R1 ECCurve_NIST_B571
186#define ECCurve_WTLS_3 ECCurve_NIST_K163
187#define ECCurve_WTLS_4 ECCurve_SECG_CHAR2_113R1
188#define ECCurve_WTLS_5 ECCurve_X9_62_CHAR2_PNB163V1
189#define ECCurve_WTLS_6 ECCurve_SECG_PRIME_112R1
190#define ECCurve_WTLS_7 ECCurve_SECG_PRIME_160R1
191#define ECCurve_WTLS_10 ECCurve_NIST_K233
192#define ECCurve_WTLS_11 ECCurve_NIST_B233
193#define ECCurve_WTLS_12 ECCurve_NIST_P224
194
195#endif /* _ECL_EXP_H */
196