PageRenderTime 37ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/ecl-exp.h

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