jdk/src/share/native/sun/security/ec/ecl-exp.h
changeset 3492 e549cea58864
equal deleted inserted replaced
3480:c197e38bf15a 3492:e549cea58864
       
     1 /* *********************************************************************
       
     2  *
       
     3  * Sun elects to have this file available under and governed by the
       
     4  * Mozilla Public License Version 1.1 ("MPL") (see
       
     5  * http://www.mozilla.org/MPL/ for full license text). For the avoidance
       
     6  * of doubt and subject to the following, Sun also elects to allow
       
     7  * licensees to use this file under the MPL, the GNU General Public
       
     8  * License version 2 only or the Lesser General Public License version
       
     9  * 2.1 only. Any references to the "GNU General Public License version 2
       
    10  * or later" or "GPL" in the following shall be construed to mean the
       
    11  * GNU General Public License version 2 only. Any references to the "GNU
       
    12  * Lesser General Public License version 2.1 or later" or "LGPL" in the
       
    13  * following shall be construed to mean the GNU Lesser General Public
       
    14  * License version 2.1 only. However, the following notice accompanied
       
    15  * the original version of this file:
       
    16  *
       
    17  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       
    18  *
       
    19  * The contents of this file are subject to the Mozilla Public License Version
       
    20  * 1.1 (the "License"); you may not use this file except in compliance with
       
    21  * the License. You may obtain a copy of the License at
       
    22  * http://www.mozilla.org/MPL/
       
    23  *
       
    24  * Software distributed under the License is distributed on an "AS IS" basis,
       
    25  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
       
    26  * for the specific language governing rights and limitations under the
       
    27  * License.
       
    28  *
       
    29  * The Original Code is the elliptic curve math library.
       
    30  *
       
    31  * The Initial Developer of the Original Code is
       
    32  * Sun Microsystems, Inc.
       
    33  * Portions created by the Initial Developer are Copyright (C) 2003
       
    34  * the Initial Developer. All Rights Reserved.
       
    35  *
       
    36  * Contributor(s):
       
    37  *   Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
       
    38  *
       
    39  * Alternatively, the contents of this file may be used under the terms of
       
    40  * either the GNU General Public License Version 2 or later (the "GPL"), or
       
    41  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
       
    42  * in which case the provisions of the GPL or the LGPL are applicable instead
       
    43  * of those above. If you wish to allow use of your version of this file only
       
    44  * under the terms of either the GPL or the LGPL, and not to allow others to
       
    45  * use your version of this file under the terms of the MPL, indicate your
       
    46  * decision by deleting the provisions above and replace them with the notice
       
    47  * and other provisions required by the GPL or the LGPL. If you do not delete
       
    48  * the provisions above, a recipient may use your version of this file under
       
    49  * the terms of any one of the MPL, the GPL or the LGPL.
       
    50  *
       
    51  *********************************************************************** */
       
    52 /*
       
    53  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
       
    54  * Use is subject to license terms.
       
    55  */
       
    56 
       
    57 #ifndef _ECL_EXP_H
       
    58 #define _ECL_EXP_H
       
    59 
       
    60 #pragma ident   "%Z%%M% %I%     %E% SMI"
       
    61 
       
    62 /* Curve field type */
       
    63 typedef enum {
       
    64         ECField_GFp,
       
    65         ECField_GF2m
       
    66 } ECField;
       
    67 
       
    68 /* Hexadecimal encoding of curve parameters */
       
    69 struct ECCurveParamsStr {
       
    70         char *text;
       
    71         ECField field;
       
    72         unsigned int size;
       
    73         char *irr;
       
    74         char *curvea;
       
    75         char *curveb;
       
    76         char *genx;
       
    77         char *geny;
       
    78         char *order;
       
    79         int cofactor;
       
    80 };
       
    81 typedef struct ECCurveParamsStr ECCurveParams;
       
    82 
       
    83 /* Named curve parameters */
       
    84 typedef enum {
       
    85 
       
    86         ECCurve_noName = 0,
       
    87 
       
    88         /* NIST prime curves */
       
    89         ECCurve_NIST_P192,
       
    90         ECCurve_NIST_P224,
       
    91         ECCurve_NIST_P256,
       
    92         ECCurve_NIST_P384,
       
    93         ECCurve_NIST_P521,
       
    94 
       
    95         /* NIST binary curves */
       
    96         ECCurve_NIST_K163,
       
    97         ECCurve_NIST_B163,
       
    98         ECCurve_NIST_K233,
       
    99         ECCurve_NIST_B233,
       
   100         ECCurve_NIST_K283,
       
   101         ECCurve_NIST_B283,
       
   102         ECCurve_NIST_K409,
       
   103         ECCurve_NIST_B409,
       
   104         ECCurve_NIST_K571,
       
   105         ECCurve_NIST_B571,
       
   106 
       
   107         /* ANSI X9.62 prime curves */
       
   108         /* ECCurve_X9_62_PRIME_192V1 == ECCurve_NIST_P192 */
       
   109         ECCurve_X9_62_PRIME_192V2,
       
   110         ECCurve_X9_62_PRIME_192V3,
       
   111         ECCurve_X9_62_PRIME_239V1,
       
   112         ECCurve_X9_62_PRIME_239V2,
       
   113         ECCurve_X9_62_PRIME_239V3,
       
   114         /* ECCurve_X9_62_PRIME_256V1 == ECCurve_NIST_P256 */
       
   115 
       
   116         /* ANSI X9.62 binary curves */
       
   117         ECCurve_X9_62_CHAR2_PNB163V1,
       
   118         ECCurve_X9_62_CHAR2_PNB163V2,
       
   119         ECCurve_X9_62_CHAR2_PNB163V3,
       
   120         ECCurve_X9_62_CHAR2_PNB176V1,
       
   121         ECCurve_X9_62_CHAR2_TNB191V1,
       
   122         ECCurve_X9_62_CHAR2_TNB191V2,
       
   123         ECCurve_X9_62_CHAR2_TNB191V3,
       
   124         ECCurve_X9_62_CHAR2_PNB208W1,
       
   125         ECCurve_X9_62_CHAR2_TNB239V1,
       
   126         ECCurve_X9_62_CHAR2_TNB239V2,
       
   127         ECCurve_X9_62_CHAR2_TNB239V3,
       
   128         ECCurve_X9_62_CHAR2_PNB272W1,
       
   129         ECCurve_X9_62_CHAR2_PNB304W1,
       
   130         ECCurve_X9_62_CHAR2_TNB359V1,
       
   131         ECCurve_X9_62_CHAR2_PNB368W1,
       
   132         ECCurve_X9_62_CHAR2_TNB431R1,
       
   133 
       
   134         /* SEC2 prime curves */
       
   135         ECCurve_SECG_PRIME_112R1,
       
   136         ECCurve_SECG_PRIME_112R2,
       
   137         ECCurve_SECG_PRIME_128R1,
       
   138         ECCurve_SECG_PRIME_128R2,
       
   139         ECCurve_SECG_PRIME_160K1,
       
   140         ECCurve_SECG_PRIME_160R1,
       
   141         ECCurve_SECG_PRIME_160R2,
       
   142         ECCurve_SECG_PRIME_192K1,
       
   143         /* ECCurve_SECG_PRIME_192R1 == ECCurve_NIST_P192 */
       
   144         ECCurve_SECG_PRIME_224K1,
       
   145         /* ECCurve_SECG_PRIME_224R1 == ECCurve_NIST_P224 */
       
   146         ECCurve_SECG_PRIME_256K1,
       
   147         /* ECCurve_SECG_PRIME_256R1 == ECCurve_NIST_P256 */
       
   148         /* ECCurve_SECG_PRIME_384R1 == ECCurve_NIST_P384 */
       
   149         /* ECCurve_SECG_PRIME_521R1 == ECCurve_NIST_P521 */
       
   150 
       
   151         /* SEC2 binary curves */
       
   152         ECCurve_SECG_CHAR2_113R1,
       
   153         ECCurve_SECG_CHAR2_113R2,
       
   154         ECCurve_SECG_CHAR2_131R1,
       
   155         ECCurve_SECG_CHAR2_131R2,
       
   156         /* ECCurve_SECG_CHAR2_163K1 == ECCurve_NIST_K163 */
       
   157         ECCurve_SECG_CHAR2_163R1,
       
   158         /* ECCurve_SECG_CHAR2_163R2 == ECCurve_NIST_B163 */
       
   159         ECCurve_SECG_CHAR2_193R1,
       
   160         ECCurve_SECG_CHAR2_193R2,
       
   161         /* ECCurve_SECG_CHAR2_233K1 == ECCurve_NIST_K233 */
       
   162         /* ECCurve_SECG_CHAR2_233R1 == ECCurve_NIST_B233 */
       
   163         ECCurve_SECG_CHAR2_239K1,
       
   164         /* ECCurve_SECG_CHAR2_283K1 == ECCurve_NIST_K283 */
       
   165         /* ECCurve_SECG_CHAR2_283R1 == ECCurve_NIST_B283 */
       
   166         /* ECCurve_SECG_CHAR2_409K1 == ECCurve_NIST_K409 */
       
   167         /* ECCurve_SECG_CHAR2_409R1 == ECCurve_NIST_B409 */
       
   168         /* ECCurve_SECG_CHAR2_571K1 == ECCurve_NIST_K571 */
       
   169         /* ECCurve_SECG_CHAR2_571R1 == ECCurve_NIST_B571 */
       
   170 
       
   171         /* WTLS curves */
       
   172         ECCurve_WTLS_1,
       
   173         /* there is no WTLS 2 curve */
       
   174         /* ECCurve_WTLS_3 == ECCurve_NIST_K163 */
       
   175         /* ECCurve_WTLS_4 == ECCurve_SECG_CHAR2_113R1 */
       
   176         /* ECCurve_WTLS_5 == ECCurve_X9_62_CHAR2_PNB163V1 */
       
   177         /* ECCurve_WTLS_6 == ECCurve_SECG_PRIME_112R1 */
       
   178         /* ECCurve_WTLS_7 == ECCurve_SECG_PRIME_160R1 */
       
   179         ECCurve_WTLS_8,
       
   180         ECCurve_WTLS_9,
       
   181         /* ECCurve_WTLS_10 == ECCurve_NIST_K233 */
       
   182         /* ECCurve_WTLS_11 == ECCurve_NIST_B233 */
       
   183         /* ECCurve_WTLS_12 == ECCurve_NIST_P224 */
       
   184 
       
   185         ECCurve_pastLastCurve
       
   186 } ECCurveName;
       
   187 
       
   188 /* Aliased named curves */
       
   189 
       
   190 #define ECCurve_X9_62_PRIME_192V1 ECCurve_NIST_P192
       
   191 #define ECCurve_X9_62_PRIME_256V1 ECCurve_NIST_P256
       
   192 #define ECCurve_SECG_PRIME_192R1 ECCurve_NIST_P192
       
   193 #define ECCurve_SECG_PRIME_224R1 ECCurve_NIST_P224
       
   194 #define ECCurve_SECG_PRIME_256R1 ECCurve_NIST_P256
       
   195 #define ECCurve_SECG_PRIME_384R1 ECCurve_NIST_P384
       
   196 #define ECCurve_SECG_PRIME_521R1 ECCurve_NIST_P521
       
   197 #define ECCurve_SECG_CHAR2_163K1 ECCurve_NIST_K163
       
   198 #define ECCurve_SECG_CHAR2_163R2 ECCurve_NIST_B163
       
   199 #define ECCurve_SECG_CHAR2_233K1 ECCurve_NIST_K233
       
   200 #define ECCurve_SECG_CHAR2_233R1 ECCurve_NIST_B233
       
   201 #define ECCurve_SECG_CHAR2_283K1 ECCurve_NIST_K283
       
   202 #define ECCurve_SECG_CHAR2_283R1 ECCurve_NIST_B283
       
   203 #define ECCurve_SECG_CHAR2_409K1 ECCurve_NIST_K409
       
   204 #define ECCurve_SECG_CHAR2_409R1 ECCurve_NIST_B409
       
   205 #define ECCurve_SECG_CHAR2_571K1 ECCurve_NIST_K571
       
   206 #define ECCurve_SECG_CHAR2_571R1 ECCurve_NIST_B571
       
   207 #define ECCurve_WTLS_3 ECCurve_NIST_K163
       
   208 #define ECCurve_WTLS_4 ECCurve_SECG_CHAR2_113R1
       
   209 #define ECCurve_WTLS_5 ECCurve_X9_62_CHAR2_PNB163V1
       
   210 #define ECCurve_WTLS_6 ECCurve_SECG_PRIME_112R1
       
   211 #define ECCurve_WTLS_7 ECCurve_SECG_PRIME_160R1
       
   212 #define ECCurve_WTLS_10 ECCurve_NIST_K233
       
   213 #define ECCurve_WTLS_11 ECCurve_NIST_B233
       
   214 #define ECCurve_WTLS_12 ECCurve_NIST_P224
       
   215 
       
   216 #endif /* _ECL_EXP_H */