Back to index

lightning-sunbird  0.9+nobinonly
ecl-curve.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 #include "ecl-exp.h"
00040 #include <stdlib.h>
00041 
00042 #ifndef __ecl_curve_h_
00043 #define __ecl_curve_h_
00044 
00045 #ifdef NSS_ECC_MORE_THAN_SUITE_B
00046 #error This source file is for Basic ECC only .
00047 #endif
00048 
00049 static const ECCurveParams ecCurve_NIST_P256 = {
00050        "NIST-P256", ECField_GFp, 256,
00051        "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF",
00052        "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC",
00053        "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B",
00054        "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296",
00055        "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",
00056        "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", 1
00057 };
00058 
00059 static const ECCurveParams ecCurve_NIST_P384 = {
00060        "NIST-P384", ECField_GFp, 384,
00061        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF",
00062        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC",
00063        "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF",
00064        "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7",
00065        "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F",
00066        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973",
00067        1
00068 };
00069 
00070 static const ECCurveParams ecCurve_NIST_P521 = {
00071        "NIST-P521", ECField_GFp, 521,
00072        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
00073        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC",
00074        "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00",
00075        "00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66",
00076        "011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650",
00077        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409",
00078        1
00079 };
00080 
00081 /* mapping between ECCurveName enum and pointers to ECCurveParams */
00082 static const ECCurveParams *ecCurve_map[] = {
00083        NULL,                /* ECCurve_noName */
00084        NULL,                /* ECCurve_NIST_P192 */
00085        NULL,                /* ECCurve_NIST_P224 */
00086        &ecCurve_NIST_P256,  /* ECCurve_NIST_P256 */
00087        &ecCurve_NIST_P384,  /* ECCurve_NIST_P384 */
00088        &ecCurve_NIST_P521,  /* ECCurve_NIST_P521 */
00089        NULL,                /* ECCurve_NIST_K163 */
00090        NULL,                /* ECCurve_NIST_B163 */
00091        NULL,                /* ECCurve_NIST_K233 */
00092        NULL,                /* ECCurve_NIST_B233 */
00093        NULL,                /* ECCurve_NIST_K283 */
00094        NULL,                /* ECCurve_NIST_B283 */
00095        NULL,                /* ECCurve_NIST_K409 */
00096        NULL,                /* ECCurve_NIST_B409 */
00097        NULL,                /* ECCurve_NIST_K571 */
00098        NULL,                /* ECCurve_NIST_B571 */
00099        NULL,                /* ECCurve_X9_62_PRIME_192V2 */
00100        NULL,                /* ECCurve_X9_62_PRIME_192V3 */
00101        NULL,                /* ECCurve_X9_62_PRIME_239V1 */
00102        NULL,                /* ECCurve_X9_62_PRIME_239V2 */
00103        NULL,                /* ECCurve_X9_62_PRIME_239V3 */
00104        NULL,                /* ECCurve_X9_62_CHAR2_PNB163V1 */
00105        NULL,                /* ECCurve_X9_62_CHAR2_PNB163V2 */
00106        NULL,                /* ECCurve_X9_62_CHAR2_PNB163V3 */
00107        NULL,                /* ECCurve_X9_62_CHAR2_PNB176V1 */
00108        NULL,                /* ECCurve_X9_62_CHAR2_TNB191V1 */
00109        NULL,                /* ECCurve_X9_62_CHAR2_TNB191V2 */
00110        NULL,                /* ECCurve_X9_62_CHAR2_TNB191V3 */
00111        NULL,                /* ECCurve_X9_62_CHAR2_PNB208W1 */
00112        NULL,                /* ECCurve_X9_62_CHAR2_TNB239V1 */
00113        NULL,                /* ECCurve_X9_62_CHAR2_TNB239V2 */
00114        NULL,                /* ECCurve_X9_62_CHAR2_TNB239V3 */
00115        NULL,                /* ECCurve_X9_62_CHAR2_PNB272W1 */
00116        NULL,                /* ECCurve_X9_62_CHAR2_PNB304W1 */
00117        NULL,                /* ECCurve_X9_62_CHAR2_TNB359V1 */
00118        NULL,                /* ECCurve_X9_62_CHAR2_PNB368W1 */
00119        NULL,                /* ECCurve_X9_62_CHAR2_TNB431R1 */
00120        NULL,                /* ECCurve_SECG_PRIME_112R1 */
00121        NULL,                /* ECCurve_SECG_PRIME_112R2 */
00122        NULL,                /* ECCurve_SECG_PRIME_128R1 */
00123        NULL,                /* ECCurve_SECG_PRIME_128R2 */
00124        NULL,                /* ECCurve_SECG_PRIME_160K1 */
00125        NULL,                /* ECCurve_SECG_PRIME_160R1 */
00126        NULL,                /* ECCurve_SECG_PRIME_160R2 */
00127        NULL,                /* ECCurve_SECG_PRIME_192K1 */
00128        NULL,                /* ECCurve_SECG_PRIME_224K1 */
00129        NULL,                /* ECCurve_SECG_PRIME_256K1 */
00130        NULL,                /* ECCurve_SECG_CHAR2_113R1 */
00131        NULL,                /* ECCurve_SECG_CHAR2_113R2 */
00132        NULL,                /* ECCurve_SECG_CHAR2_131R1 */
00133        NULL,                /* ECCurve_SECG_CHAR2_131R2 */
00134        NULL,                /* ECCurve_SECG_CHAR2_163R1 */
00135        NULL,                /* ECCurve_SECG_CHAR2_193R1 */
00136        NULL,                /* ECCurve_SECG_CHAR2_193R2 */
00137        NULL,                /* ECCurve_SECG_CHAR2_239K1 */
00138        NULL,                /* ECCurve_WTLS_1 */
00139        NULL,                /* ECCurve_WTLS_8 */
00140        NULL,                /* ECCurve_WTLS_9 */
00141        NULL                 /* ECCurve_pastLastCurve */
00142 };
00143 
00144 #endif