andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: andre@0: #ifndef __ecl_exp_h_ andre@0: #define __ecl_exp_h_ andre@0: andre@0: /* Curve field type */ andre@0: typedef enum { andre@0: ECField_GFp, andre@0: ECField_GF2m andre@0: } ECField; andre@0: andre@0: /* Hexadecimal encoding of curve parameters */ andre@0: struct ECCurveParamsStr { andre@0: char *text; andre@0: ECField field; andre@0: unsigned int size; andre@0: char *irr; andre@0: char *curvea; andre@0: char *curveb; andre@0: char *genx; andre@0: char *geny; andre@0: char *order; andre@0: int cofactor; andre@0: }; andre@0: typedef struct ECCurveParamsStr ECCurveParams; andre@0: andre@0: /* Named curve parameters */ andre@0: typedef enum { andre@0: andre@0: ECCurve_noName = 0, andre@0: andre@0: /* NIST prime curves */ andre@0: ECCurve_NIST_P192, andre@0: ECCurve_NIST_P224, andre@0: ECCurve_NIST_P256, andre@0: ECCurve_NIST_P384, andre@0: ECCurve_NIST_P521, andre@0: andre@0: /* NIST binary curves */ andre@0: ECCurve_NIST_K163, andre@0: ECCurve_NIST_B163, andre@0: ECCurve_NIST_K233, andre@0: ECCurve_NIST_B233, andre@0: ECCurve_NIST_K283, andre@0: ECCurve_NIST_B283, andre@0: ECCurve_NIST_K409, andre@0: ECCurve_NIST_B409, andre@0: ECCurve_NIST_K571, andre@0: ECCurve_NIST_B571, andre@0: andre@0: /* ANSI X9.62 prime curves */ andre@0: /* ECCurve_X9_62_PRIME_192V1 == ECCurve_NIST_P192 */ andre@0: ECCurve_X9_62_PRIME_192V2, andre@0: ECCurve_X9_62_PRIME_192V3, andre@0: ECCurve_X9_62_PRIME_239V1, andre@0: ECCurve_X9_62_PRIME_239V2, andre@0: ECCurve_X9_62_PRIME_239V3, andre@0: /* ECCurve_X9_62_PRIME_256V1 == ECCurve_NIST_P256 */ andre@0: andre@0: /* ANSI X9.62 binary curves */ andre@0: ECCurve_X9_62_CHAR2_PNB163V1, andre@0: ECCurve_X9_62_CHAR2_PNB163V2, andre@0: ECCurve_X9_62_CHAR2_PNB163V3, andre@0: ECCurve_X9_62_CHAR2_PNB176V1, andre@0: ECCurve_X9_62_CHAR2_TNB191V1, andre@0: ECCurve_X9_62_CHAR2_TNB191V2, andre@0: ECCurve_X9_62_CHAR2_TNB191V3, andre@0: ECCurve_X9_62_CHAR2_PNB208W1, andre@0: ECCurve_X9_62_CHAR2_TNB239V1, andre@0: ECCurve_X9_62_CHAR2_TNB239V2, andre@0: ECCurve_X9_62_CHAR2_TNB239V3, andre@0: ECCurve_X9_62_CHAR2_PNB272W1, andre@0: ECCurve_X9_62_CHAR2_PNB304W1, andre@0: ECCurve_X9_62_CHAR2_TNB359V1, andre@0: ECCurve_X9_62_CHAR2_PNB368W1, andre@0: ECCurve_X9_62_CHAR2_TNB431R1, andre@0: andre@0: /* SEC2 prime curves */ andre@0: ECCurve_SECG_PRIME_112R1, andre@0: ECCurve_SECG_PRIME_112R2, andre@0: ECCurve_SECG_PRIME_128R1, andre@0: ECCurve_SECG_PRIME_128R2, andre@0: ECCurve_SECG_PRIME_160K1, andre@0: ECCurve_SECG_PRIME_160R1, andre@0: ECCurve_SECG_PRIME_160R2, andre@0: ECCurve_SECG_PRIME_192K1, andre@0: /* ECCurve_SECG_PRIME_192R1 == ECCurve_NIST_P192 */ andre@0: ECCurve_SECG_PRIME_224K1, andre@0: /* ECCurve_SECG_PRIME_224R1 == ECCurve_NIST_P224 */ andre@0: ECCurve_SECG_PRIME_256K1, andre@0: /* ECCurve_SECG_PRIME_256R1 == ECCurve_NIST_P256 */ andre@0: /* ECCurve_SECG_PRIME_384R1 == ECCurve_NIST_P384 */ andre@0: /* ECCurve_SECG_PRIME_521R1 == ECCurve_NIST_P521 */ andre@0: andre@0: /* SEC2 binary curves */ andre@0: ECCurve_SECG_CHAR2_113R1, andre@0: ECCurve_SECG_CHAR2_113R2, andre@0: ECCurve_SECG_CHAR2_131R1, andre@0: ECCurve_SECG_CHAR2_131R2, andre@0: /* ECCurve_SECG_CHAR2_163K1 == ECCurve_NIST_K163 */ andre@0: ECCurve_SECG_CHAR2_163R1, andre@0: /* ECCurve_SECG_CHAR2_163R2 == ECCurve_NIST_B163 */ andre@0: ECCurve_SECG_CHAR2_193R1, andre@0: ECCurve_SECG_CHAR2_193R2, andre@0: /* ECCurve_SECG_CHAR2_233K1 == ECCurve_NIST_K233 */ andre@0: /* ECCurve_SECG_CHAR2_233R1 == ECCurve_NIST_B233 */ andre@0: ECCurve_SECG_CHAR2_239K1, andre@0: /* ECCurve_SECG_CHAR2_283K1 == ECCurve_NIST_K283 */ andre@0: /* ECCurve_SECG_CHAR2_283R1 == ECCurve_NIST_B283 */ andre@0: /* ECCurve_SECG_CHAR2_409K1 == ECCurve_NIST_K409 */ andre@0: /* ECCurve_SECG_CHAR2_409R1 == ECCurve_NIST_B409 */ andre@0: /* ECCurve_SECG_CHAR2_571K1 == ECCurve_NIST_K571 */ andre@0: /* ECCurve_SECG_CHAR2_571R1 == ECCurve_NIST_B571 */ andre@0: andre@0: /* WTLS curves */ andre@0: ECCurve_WTLS_1, andre@0: /* there is no WTLS 2 curve */ andre@0: /* ECCurve_WTLS_3 == ECCurve_NIST_K163 */ andre@0: /* ECCurve_WTLS_4 == ECCurve_SECG_CHAR2_113R1 */ andre@0: /* ECCurve_WTLS_5 == ECCurve_X9_62_CHAR2_PNB163V1 */ andre@0: /* ECCurve_WTLS_6 == ECCurve_SECG_PRIME_112R1 */ andre@0: /* ECCurve_WTLS_7 == ECCurve_SECG_PRIME_160R1 */ andre@0: ECCurve_WTLS_8, andre@0: ECCurve_WTLS_9, andre@0: /* ECCurve_WTLS_10 == ECCurve_NIST_K233 */ andre@0: /* ECCurve_WTLS_11 == ECCurve_NIST_B233 */ andre@0: /* ECCurve_WTLS_12 == ECCurve_NIST_P224 */ andre@0: andre@0: ECCurve_pastLastCurve andre@0: } ECCurveName; andre@0: andre@0: /* Aliased named curves */ andre@0: andre@0: #define ECCurve_X9_62_PRIME_192V1 ECCurve_NIST_P192 andre@0: #define ECCurve_X9_62_PRIME_256V1 ECCurve_NIST_P256 andre@0: #define ECCurve_SECG_PRIME_192R1 ECCurve_NIST_P192 andre@0: #define ECCurve_SECG_PRIME_224R1 ECCurve_NIST_P224 andre@0: #define ECCurve_SECG_PRIME_256R1 ECCurve_NIST_P256 andre@0: #define ECCurve_SECG_PRIME_384R1 ECCurve_NIST_P384 andre@0: #define ECCurve_SECG_PRIME_521R1 ECCurve_NIST_P521 andre@0: #define ECCurve_SECG_CHAR2_163K1 ECCurve_NIST_K163 andre@0: #define ECCurve_SECG_CHAR2_163R2 ECCurve_NIST_B163 andre@0: #define ECCurve_SECG_CHAR2_233K1 ECCurve_NIST_K233 andre@0: #define ECCurve_SECG_CHAR2_233R1 ECCurve_NIST_B233 andre@0: #define ECCurve_SECG_CHAR2_283K1 ECCurve_NIST_K283 andre@0: #define ECCurve_SECG_CHAR2_283R1 ECCurve_NIST_B283 andre@0: #define ECCurve_SECG_CHAR2_409K1 ECCurve_NIST_K409 andre@0: #define ECCurve_SECG_CHAR2_409R1 ECCurve_NIST_B409 andre@0: #define ECCurve_SECG_CHAR2_571K1 ECCurve_NIST_K571 andre@0: #define ECCurve_SECG_CHAR2_571R1 ECCurve_NIST_B571 andre@0: #define ECCurve_WTLS_3 ECCurve_NIST_K163 andre@0: #define ECCurve_WTLS_4 ECCurve_SECG_CHAR2_113R1 andre@0: #define ECCurve_WTLS_5 ECCurve_X9_62_CHAR2_PNB163V1 andre@0: #define ECCurve_WTLS_6 ECCurve_SECG_PRIME_112R1 andre@0: #define ECCurve_WTLS_7 ECCurve_SECG_PRIME_160R1 andre@0: #define ECCurve_WTLS_10 ECCurve_NIST_K233 andre@0: #define ECCurve_WTLS_11 ECCurve_NIST_B233 andre@0: #define ECCurve_WTLS_12 ECCurve_NIST_P224 andre@0: andre@0: #endif /* __ecl_exp_h_ */