Back to index

lightning-sunbird  0.9+nobinonly
ecl-exp.h
Go to the documentation of this file.
00001 /* 
00002  * ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the elliptic curve math library.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Sun Microsystems, Inc.
00019  * Portions created by the Initial Developer are Copyright (C) 2003
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef __ecl_exp_h_
00040 #define __ecl_exp_h_
00041 
00042 /* Curve field type */
00043 typedef enum {
00044        ECField_GFp,
00045        ECField_GF2m
00046 } ECField;
00047 
00048 /* Hexadecimal encoding of curve parameters */
00049 struct ECCurveParamsStr {
00050        char *text;
00051        ECField field;
00052        unsigned int size;
00053        char *irr;
00054        char *curvea;
00055        char *curveb;
00056        char *genx;
00057        char *geny;
00058        char *order;
00059        int cofactor;
00060 };
00061 typedef struct ECCurveParamsStr ECCurveParams;
00062 
00063 /* Named curve parameters */
00064 typedef enum {
00065 
00066        ECCurve_noName = 0,
00067 
00068        /* NIST prime curves */
00069        ECCurve_NIST_P192,
00070        ECCurve_NIST_P224,
00071        ECCurve_NIST_P256,
00072        ECCurve_NIST_P384,
00073        ECCurve_NIST_P521,
00074 
00075        /* NIST binary curves */
00076        ECCurve_NIST_K163,
00077        ECCurve_NIST_B163,
00078        ECCurve_NIST_K233,
00079        ECCurve_NIST_B233,
00080        ECCurve_NIST_K283,
00081        ECCurve_NIST_B283,
00082        ECCurve_NIST_K409,
00083        ECCurve_NIST_B409,
00084        ECCurve_NIST_K571,
00085        ECCurve_NIST_B571,
00086 
00087        /* ANSI X9.62 prime curves */
00088        /* ECCurve_X9_62_PRIME_192V1 == ECCurve_NIST_P192 */
00089        ECCurve_X9_62_PRIME_192V2,
00090        ECCurve_X9_62_PRIME_192V3,
00091        ECCurve_X9_62_PRIME_239V1,
00092        ECCurve_X9_62_PRIME_239V2,
00093        ECCurve_X9_62_PRIME_239V3,
00094        /* ECCurve_X9_62_PRIME_256V1 == ECCurve_NIST_P256 */
00095 
00096        /* ANSI X9.62 binary curves */
00097        ECCurve_X9_62_CHAR2_PNB163V1,
00098        ECCurve_X9_62_CHAR2_PNB163V2,
00099        ECCurve_X9_62_CHAR2_PNB163V3,
00100        ECCurve_X9_62_CHAR2_PNB176V1,
00101        ECCurve_X9_62_CHAR2_TNB191V1,
00102        ECCurve_X9_62_CHAR2_TNB191V2,
00103        ECCurve_X9_62_CHAR2_TNB191V3,
00104        ECCurve_X9_62_CHAR2_PNB208W1,
00105        ECCurve_X9_62_CHAR2_TNB239V1,
00106        ECCurve_X9_62_CHAR2_TNB239V2,
00107        ECCurve_X9_62_CHAR2_TNB239V3,
00108        ECCurve_X9_62_CHAR2_PNB272W1,
00109        ECCurve_X9_62_CHAR2_PNB304W1,
00110        ECCurve_X9_62_CHAR2_TNB359V1,
00111        ECCurve_X9_62_CHAR2_PNB368W1,
00112        ECCurve_X9_62_CHAR2_TNB431R1,
00113 
00114        /* SEC2 prime curves */
00115        ECCurve_SECG_PRIME_112R1,
00116        ECCurve_SECG_PRIME_112R2,
00117        ECCurve_SECG_PRIME_128R1,
00118        ECCurve_SECG_PRIME_128R2,
00119        ECCurve_SECG_PRIME_160K1,
00120        ECCurve_SECG_PRIME_160R1,
00121        ECCurve_SECG_PRIME_160R2,
00122        ECCurve_SECG_PRIME_192K1,
00123        /* ECCurve_SECG_PRIME_192R1 == ECCurve_NIST_P192 */
00124        ECCurve_SECG_PRIME_224K1,
00125        /* ECCurve_SECG_PRIME_224R1 == ECCurve_NIST_P224 */
00126        ECCurve_SECG_PRIME_256K1,
00127        /* ECCurve_SECG_PRIME_256R1 == ECCurve_NIST_P256 */
00128        /* ECCurve_SECG_PRIME_384R1 == ECCurve_NIST_P384 */
00129        /* ECCurve_SECG_PRIME_521R1 == ECCurve_NIST_P521 */
00130 
00131        /* SEC2 binary curves */
00132        ECCurve_SECG_CHAR2_113R1,
00133        ECCurve_SECG_CHAR2_113R2,
00134        ECCurve_SECG_CHAR2_131R1,
00135        ECCurve_SECG_CHAR2_131R2,
00136        /* ECCurve_SECG_CHAR2_163K1 == ECCurve_NIST_K163 */
00137        ECCurve_SECG_CHAR2_163R1,
00138        /* ECCurve_SECG_CHAR2_163R2 == ECCurve_NIST_B163 */
00139        ECCurve_SECG_CHAR2_193R1,
00140        ECCurve_SECG_CHAR2_193R2,
00141        /* ECCurve_SECG_CHAR2_233K1 == ECCurve_NIST_K233 */
00142        /* ECCurve_SECG_CHAR2_233R1 == ECCurve_NIST_B233 */
00143        ECCurve_SECG_CHAR2_239K1,
00144        /* ECCurve_SECG_CHAR2_283K1 == ECCurve_NIST_K283 */
00145        /* ECCurve_SECG_CHAR2_283R1 == ECCurve_NIST_B283 */
00146        /* ECCurve_SECG_CHAR2_409K1 == ECCurve_NIST_K409 */
00147        /* ECCurve_SECG_CHAR2_409R1 == ECCurve_NIST_B409 */
00148        /* ECCurve_SECG_CHAR2_571K1 == ECCurve_NIST_K571 */
00149        /* ECCurve_SECG_CHAR2_571R1 == ECCurve_NIST_B571 */
00150 
00151        /* WTLS curves */
00152        ECCurve_WTLS_1,
00153        /* there is no WTLS 2 curve */
00154        /* ECCurve_WTLS_3 == ECCurve_NIST_K163 */
00155        /* ECCurve_WTLS_4 == ECCurve_SECG_CHAR2_113R1 */
00156        /* ECCurve_WTLS_5 == ECCurve_X9_62_CHAR2_PNB163V1 */
00157        /* ECCurve_WTLS_6 == ECCurve_SECG_PRIME_112R1 */
00158        /* ECCurve_WTLS_7 == ECCurve_SECG_PRIME_160R1 */
00159        ECCurve_WTLS_8,
00160        ECCurve_WTLS_9,
00161        /* ECCurve_WTLS_10 == ECCurve_NIST_K233 */
00162        /* ECCurve_WTLS_11 == ECCurve_NIST_B233 */
00163        /* ECCurve_WTLS_12 == ECCurve_NIST_P224 */
00164 
00165        ECCurve_pastLastCurve
00166 } ECCurveName;
00167 
00168 /* Aliased named curves */
00169 
00170 #define ECCurve_X9_62_PRIME_192V1 ECCurve_NIST_P192
00171 #define ECCurve_X9_62_PRIME_256V1 ECCurve_NIST_P256
00172 #define ECCurve_SECG_PRIME_192R1 ECCurve_NIST_P192
00173 #define ECCurve_SECG_PRIME_224R1 ECCurve_NIST_P224
00174 #define ECCurve_SECG_PRIME_256R1 ECCurve_NIST_P256
00175 #define ECCurve_SECG_PRIME_384R1 ECCurve_NIST_P384
00176 #define ECCurve_SECG_PRIME_521R1 ECCurve_NIST_P521
00177 #define ECCurve_SECG_CHAR2_163K1 ECCurve_NIST_K163
00178 #define ECCurve_SECG_CHAR2_163R2 ECCurve_NIST_B163
00179 #define ECCurve_SECG_CHAR2_233K1 ECCurve_NIST_K233
00180 #define ECCurve_SECG_CHAR2_233R1 ECCurve_NIST_B233
00181 #define ECCurve_SECG_CHAR2_283K1 ECCurve_NIST_K283
00182 #define ECCurve_SECG_CHAR2_283R1 ECCurve_NIST_B283
00183 #define ECCurve_SECG_CHAR2_409K1 ECCurve_NIST_K409
00184 #define ECCurve_SECG_CHAR2_409R1 ECCurve_NIST_B409
00185 #define ECCurve_SECG_CHAR2_571K1 ECCurve_NIST_K571
00186 #define ECCurve_SECG_CHAR2_571R1 ECCurve_NIST_B571
00187 #define ECCurve_WTLS_3 ECCurve_NIST_K163
00188 #define ECCurve_WTLS_4 ECCurve_SECG_CHAR2_113R1
00189 #define ECCurve_WTLS_5 ECCurve_X9_62_CHAR2_PNB163V1
00190 #define ECCurve_WTLS_6 ECCurve_SECG_PRIME_112R1
00191 #define ECCurve_WTLS_7 ECCurve_SECG_PRIME_160R1
00192 #define ECCurve_WTLS_10 ECCurve_NIST_K233
00193 #define ECCurve_WTLS_11 ECCurve_NIST_B233
00194 #define ECCurve_WTLS_12 ECCurve_NIST_P224
00195 
00196 #endif                                           /* __ecl_exp_h_ */