ec.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. /* Originally written by Bodo Moeller for the OpenSSL project.
  2. * ====================================================================
  3. * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in
  14. * the documentation and/or other materials provided with the
  15. * distribution.
  16. *
  17. * 3. All advertising materials mentioning features or use of this
  18. * software must display the following acknowledgment:
  19. * "This product includes software developed by the OpenSSL Project
  20. * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
  21. *
  22. * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  23. * endorse or promote products derived from this software without
  24. * prior written permission. For written permission, please contact
  25. * openssl-core@openssl.org.
  26. *
  27. * 5. Products derived from this software may not be called "OpenSSL"
  28. * nor may "OpenSSL" appear in their names without prior written
  29. * permission of the OpenSSL Project.
  30. *
  31. * 6. Redistributions of any form whatsoever must retain the following
  32. * acknowledgment:
  33. * "This product includes software developed by the OpenSSL Project
  34. * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
  35. *
  36. * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  37. * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  39. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  40. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  42. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  43. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  44. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  45. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  46. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  47. * OF THE POSSIBILITY OF SUCH DAMAGE.
  48. * ====================================================================
  49. *
  50. * This product includes cryptographic software written by Eric Young
  51. * (eay@cryptsoft.com). This product includes software written by Tim
  52. * Hudson (tjh@cryptsoft.com).
  53. *
  54. */
  55. /* ====================================================================
  56. * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  57. *
  58. * Portions of the attached software ("Contribution") are developed by
  59. * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
  60. *
  61. * The Contribution is licensed pursuant to the OpenSSL open source
  62. * license provided above.
  63. *
  64. * The elliptic curve binary polynomial software is originally written by
  65. * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems
  66. * Laboratories. */
  67. #ifndef OPENSSL_HEADER_EC_H
  68. #define OPENSSL_HEADER_EC_H
  69. #include <openssl/base.h>
  70. #if defined(__cplusplus)
  71. extern "C" {
  72. #endif
  73. // Low-level operations on elliptic curves.
  74. // point_conversion_form_t enumerates forms, as defined in X9.62 (ECDSA), for
  75. // the encoding of a elliptic curve point (x,y)
  76. typedef enum {
  77. // POINT_CONVERSION_COMPRESSED indicates that the point is encoded as z||x,
  78. // where the octet z specifies which solution of the quadratic equation y
  79. // is.
  80. POINT_CONVERSION_COMPRESSED = 2,
  81. // POINT_CONVERSION_UNCOMPRESSED indicates that the point is encoded as
  82. // z||x||y, where z is the octet 0x04.
  83. POINT_CONVERSION_UNCOMPRESSED = 4,
  84. // POINT_CONVERSION_HYBRID indicates that the point is encoded as z||x||y,
  85. // where z specifies which solution of the quadratic equation y is. This is
  86. // not supported by the code and has never been observed in use.
  87. //
  88. // TODO(agl): remove once node.js no longer references this.
  89. POINT_CONVERSION_HYBRID = 6,
  90. } point_conversion_form_t;
  91. // Elliptic curve groups.
  92. // EC_GROUP_new_by_curve_name returns a fresh EC_GROUP object for the elliptic
  93. // curve specified by |nid|, or NULL on unsupported NID or allocation failure.
  94. //
  95. // The supported NIDs are:
  96. // NID_secp224r1 (P-224),
  97. // NID_X9_62_prime256v1 (P-256),
  98. // NID_secp384r1 (P-384),
  99. // NID_secp521r1 (P-521)
  100. //
  101. // If in doubt, use |NID_X9_62_prime256v1|, or see the curve25519.h header for
  102. // more modern primitives.
  103. OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
  104. // EC_GROUP_free releases a reference to |group|.
  105. OPENSSL_EXPORT void EC_GROUP_free(EC_GROUP *group);
  106. // EC_GROUP_dup takes a reference to |a| and returns it.
  107. OPENSSL_EXPORT EC_GROUP *EC_GROUP_dup(const EC_GROUP *a);
  108. // EC_GROUP_cmp returns zero if |a| and |b| are the same group and non-zero
  109. // otherwise.
  110. OPENSSL_EXPORT int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b,
  111. BN_CTX *ignored);
  112. // EC_GROUP_get0_generator returns a pointer to the internal |EC_POINT| object
  113. // in |group| that specifies the generator for the group.
  114. OPENSSL_EXPORT const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
  115. // EC_GROUP_get0_order returns a pointer to the internal |BIGNUM| object in
  116. // |group| that specifies the order of the group.
  117. OPENSSL_EXPORT const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group);
  118. // EC_GROUP_order_bits returns the number of bits of the order of |group|.
  119. OPENSSL_EXPORT int EC_GROUP_order_bits(const EC_GROUP *group);
  120. // EC_GROUP_get_cofactor sets |*cofactor| to the cofactor of |group| using
  121. // |ctx|, if it's not NULL. It returns one on success and zero otherwise.
  122. OPENSSL_EXPORT int EC_GROUP_get_cofactor(const EC_GROUP *group,
  123. BIGNUM *cofactor, BN_CTX *ctx);
  124. // EC_GROUP_get_curve_GFp gets various parameters about a group. It sets
  125. // |*out_p| to the order of the coordinate field and |*out_a| and |*out_b| to
  126. // the parameters of the curve when expressed as y² = x³ + ax + b. Any of the
  127. // output parameters can be NULL. It returns one on success and zero on
  128. // error.
  129. OPENSSL_EXPORT int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *out_p,
  130. BIGNUM *out_a, BIGNUM *out_b,
  131. BN_CTX *ctx);
  132. // EC_GROUP_get_curve_name returns a NID that identifies |group|.
  133. OPENSSL_EXPORT int EC_GROUP_get_curve_name(const EC_GROUP *group);
  134. // EC_GROUP_get_degree returns the number of bits needed to represent an
  135. // element of the field underlying |group|.
  136. OPENSSL_EXPORT unsigned EC_GROUP_get_degree(const EC_GROUP *group);
  137. // EC_curve_nid2nist returns the NIST name of the elliptic curve specified by
  138. // |nid|, or NULL if |nid| is not a NIST curve. For example, it returns "P-256"
  139. // for |NID_X9_62_prime256v1|.
  140. OPENSSL_EXPORT const char *EC_curve_nid2nist(int nid);
  141. // EC_curve_nist2nid returns the NID of the elliptic curve specified by the NIST
  142. // name |name|, or |NID_undef| if |name| is not a recognized name. For example,
  143. // it returns |NID_X9_62_prime256v1| for "P-256".
  144. OPENSSL_EXPORT int EC_curve_nist2nid(const char *name);
  145. // Points on elliptic curves.
  146. // EC_POINT_new returns a fresh |EC_POINT| object in the given group, or NULL
  147. // on error.
  148. OPENSSL_EXPORT EC_POINT *EC_POINT_new(const EC_GROUP *group);
  149. // EC_POINT_free frees |point| and the data that it points to.
  150. OPENSSL_EXPORT void EC_POINT_free(EC_POINT *point);
  151. // EC_POINT_copy sets |*dest| equal to |*src|. It returns one on success and
  152. // zero otherwise.
  153. OPENSSL_EXPORT int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src);
  154. // EC_POINT_dup returns a fresh |EC_POINT| that contains the same values as
  155. // |src|, or NULL on error.
  156. OPENSSL_EXPORT EC_POINT *EC_POINT_dup(const EC_POINT *src,
  157. const EC_GROUP *group);
  158. // EC_POINT_set_to_infinity sets |point| to be the "point at infinity" for the
  159. // given group.
  160. OPENSSL_EXPORT int EC_POINT_set_to_infinity(const EC_GROUP *group,
  161. EC_POINT *point);
  162. // EC_POINT_is_at_infinity returns one iff |point| is the point at infinity and
  163. // zero otherwise.
  164. OPENSSL_EXPORT int EC_POINT_is_at_infinity(const EC_GROUP *group,
  165. const EC_POINT *point);
  166. // EC_POINT_is_on_curve returns one if |point| is an element of |group| and
  167. // and zero otherwise or when an error occurs. This is different from OpenSSL,
  168. // which returns -1 on error. If |ctx| is non-NULL, it may be used.
  169. OPENSSL_EXPORT int EC_POINT_is_on_curve(const EC_GROUP *group,
  170. const EC_POINT *point, BN_CTX *ctx);
  171. // EC_POINT_cmp returns zero if |a| is equal to |b|, greater than zero if
  172. // not equal and -1 on error. If |ctx| is not NULL, it may be used.
  173. OPENSSL_EXPORT int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a,
  174. const EC_POINT *b, BN_CTX *ctx);
  175. // Point conversion.
  176. // EC_POINT_get_affine_coordinates_GFp sets |x| and |y| to the affine value of
  177. // |point| using |ctx|, if it's not NULL. It returns one on success and zero
  178. // otherwise.
  179. //
  180. // Either |x| or |y| may be NULL to skip computing that coordinate. This is
  181. // slightly faster in the common case where only the x-coordinate is needed.
  182. OPENSSL_EXPORT int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
  183. const EC_POINT *point,
  184. BIGNUM *x, BIGNUM *y,
  185. BN_CTX *ctx);
  186. // EC_POINT_get_affine_coordinates is an alias of
  187. // |EC_POINT_get_affine_coordinates_GFp|.
  188. OPENSSL_EXPORT int EC_POINT_get_affine_coordinates(const EC_GROUP *group,
  189. const EC_POINT *point,
  190. BIGNUM *x, BIGNUM *y,
  191. BN_CTX *ctx);
  192. // EC_POINT_set_affine_coordinates_GFp sets the value of |point| to be
  193. // (|x|, |y|). The |ctx| argument may be used if not NULL. It returns one
  194. // on success or zero on error. It's considered an error if the point is not on
  195. // the curve.
  196. //
  197. // Note that the corresponding function in OpenSSL versions prior to 1.0.2s does
  198. // not check if the point is on the curve. This is a security-critical check, so
  199. // code additionally supporting OpenSSL should repeat the check with
  200. // |EC_POINT_is_on_curve| or check for older OpenSSL versions with
  201. // |OPENSSL_VERSION_NUMBER|.
  202. OPENSSL_EXPORT int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group,
  203. EC_POINT *point,
  204. const BIGNUM *x,
  205. const BIGNUM *y,
  206. BN_CTX *ctx);
  207. // EC_POINT_set_affine_coordinates is an alias of
  208. // |EC_POINT_set_affine_coordinates_GFp|.
  209. OPENSSL_EXPORT int EC_POINT_set_affine_coordinates(const EC_GROUP *group,
  210. EC_POINT *point,
  211. const BIGNUM *x,
  212. const BIGNUM *y,
  213. BN_CTX *ctx);
  214. // EC_POINT_point2oct serialises |point| into the X9.62 form given by |form|
  215. // into, at most, |len| bytes at |buf|. It returns the number of bytes written
  216. // or zero on error if |buf| is non-NULL, else the number of bytes needed. The
  217. // |ctx| argument may be used if not NULL.
  218. OPENSSL_EXPORT size_t EC_POINT_point2oct(const EC_GROUP *group,
  219. const EC_POINT *point,
  220. point_conversion_form_t form,
  221. uint8_t *buf, size_t len, BN_CTX *ctx);
  222. // EC_POINT_point2cbb behaves like |EC_POINT_point2oct| but appends the
  223. // serialised point to |cbb|. It returns one on success and zero on error.
  224. OPENSSL_EXPORT int EC_POINT_point2cbb(CBB *out, const EC_GROUP *group,
  225. const EC_POINT *point,
  226. point_conversion_form_t form,
  227. BN_CTX *ctx);
  228. // EC_POINT_oct2point sets |point| from |len| bytes of X9.62 format
  229. // serialisation in |buf|. It returns one on success and zero on error. The
  230. // |ctx| argument may be used if not NULL. It's considered an error if |buf|
  231. // does not represent a point on the curve.
  232. OPENSSL_EXPORT int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
  233. const uint8_t *buf, size_t len,
  234. BN_CTX *ctx);
  235. // EC_POINT_set_compressed_coordinates_GFp sets |point| to equal the point with
  236. // the given |x| coordinate and the y coordinate specified by |y_bit| (see
  237. // X9.62). It returns one on success and zero otherwise.
  238. OPENSSL_EXPORT int EC_POINT_set_compressed_coordinates_GFp(
  239. const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, int y_bit,
  240. BN_CTX *ctx);
  241. // Group operations.
  242. // EC_POINT_add sets |r| equal to |a| plus |b|. It returns one on success and
  243. // zero otherwise. If |ctx| is not NULL, it may be used.
  244. OPENSSL_EXPORT int EC_POINT_add(const EC_GROUP *group, EC_POINT *r,
  245. const EC_POINT *a, const EC_POINT *b,
  246. BN_CTX *ctx);
  247. // EC_POINT_dbl sets |r| equal to |a| plus |a|. It returns one on success and
  248. // zero otherwise. If |ctx| is not NULL, it may be used.
  249. OPENSSL_EXPORT int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r,
  250. const EC_POINT *a, BN_CTX *ctx);
  251. // EC_POINT_invert sets |a| equal to minus |a|. It returns one on success and
  252. // zero otherwise. If |ctx| is not NULL, it may be used.
  253. OPENSSL_EXPORT int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a,
  254. BN_CTX *ctx);
  255. // EC_POINT_mul sets r = generator*n + q*m. It returns one on success and zero
  256. // otherwise. If |ctx| is not NULL, it may be used.
  257. OPENSSL_EXPORT int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r,
  258. const BIGNUM *n, const EC_POINT *q,
  259. const BIGNUM *m, BN_CTX *ctx);
  260. // Deprecated functions.
  261. // EC_GROUP_new_curve_GFp creates a new, arbitrary elliptic curve group based
  262. // on the equation y² = x³ + a·x + b. It returns the new group or NULL on
  263. // error.
  264. //
  265. // This new group has no generator. It is an error to use a generator-less group
  266. // with any functions except for |EC_GROUP_free|, |EC_POINT_new|,
  267. // |EC_POINT_set_affine_coordinates_GFp|, and |EC_GROUP_set_generator|.
  268. //
  269. // |EC_GROUP|s returned by this function will always compare as unequal via
  270. // |EC_GROUP_cmp| (even to themselves). |EC_GROUP_get_curve_name| will always
  271. // return |NID_undef|.
  272. //
  273. // This function is provided for compatibility with some legacy applications
  274. // only. Avoid using arbitrary curves and use |EC_GROUP_new_by_curve_name|
  275. // instead. This ensures the result meets preconditions necessary for
  276. // elliptic curve algorithms to function correctly and securely.
  277. //
  278. // Given invalid parameters, this function may fail or it may return an
  279. // |EC_GROUP| which breaks these preconditions. Subsequent operations may then
  280. // return arbitrary, incorrect values. Callers should not pass
  281. // attacker-controlled values to this function.
  282. OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p,
  283. const BIGNUM *a,
  284. const BIGNUM *b, BN_CTX *ctx);
  285. // EC_GROUP_set_generator sets the generator for |group| to |generator|, which
  286. // must have the given order and cofactor. It may only be used with |EC_GROUP|
  287. // objects returned by |EC_GROUP_new_curve_GFp| and may only be used once on
  288. // each group. |generator| must have been created using |group|.
  289. OPENSSL_EXPORT int EC_GROUP_set_generator(EC_GROUP *group,
  290. const EC_POINT *generator,
  291. const BIGNUM *order,
  292. const BIGNUM *cofactor);
  293. // EC_GROUP_get_order sets |*order| to the order of |group|, if it's not
  294. // NULL. It returns one on success and zero otherwise. |ctx| is ignored. Use
  295. // |EC_GROUP_get0_order| instead.
  296. OPENSSL_EXPORT int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order,
  297. BN_CTX *ctx);
  298. #define OPENSSL_EC_EXPLICIT_CURVE 0
  299. #define OPENSSL_EC_NAMED_CURVE 1
  300. // EC_GROUP_set_asn1_flag does nothing.
  301. OPENSSL_EXPORT void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
  302. // EC_GROUP_get_asn1_flag returns |OPENSSL_EC_NAMED_CURVE|.
  303. OPENSSL_EXPORT int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
  304. typedef struct ec_method_st EC_METHOD;
  305. // EC_GROUP_method_of returns a dummy non-NULL pointer.
  306. OPENSSL_EXPORT const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
  307. // EC_METHOD_get_field_type returns NID_X9_62_prime_field.
  308. OPENSSL_EXPORT int EC_METHOD_get_field_type(const EC_METHOD *meth);
  309. // EC_GROUP_set_point_conversion_form aborts the process if |form| is not
  310. // |POINT_CONVERSION_UNCOMPRESSED| and otherwise does nothing.
  311. OPENSSL_EXPORT void EC_GROUP_set_point_conversion_form(
  312. EC_GROUP *group, point_conversion_form_t form);
  313. // EC_builtin_curve describes a supported elliptic curve.
  314. typedef struct {
  315. int nid;
  316. const char *comment;
  317. } EC_builtin_curve;
  318. // EC_get_builtin_curves writes at most |max_num_curves| elements to
  319. // |out_curves| and returns the total number that it would have written, had
  320. // |max_num_curves| been large enough.
  321. //
  322. // The |EC_builtin_curve| items describe the supported elliptic curves.
  323. OPENSSL_EXPORT size_t EC_get_builtin_curves(EC_builtin_curve *out_curves,
  324. size_t max_num_curves);
  325. // EC_POINT_clear_free calls |EC_POINT_free|.
  326. OPENSSL_EXPORT void EC_POINT_clear_free(EC_POINT *point);
  327. #if defined(__cplusplus)
  328. } // extern C
  329. #endif
  330. // Old code expects to get EC_KEY from ec.h.
  331. #include <openssl/ec_key.h>
  332. #if defined(__cplusplus)
  333. extern "C++" {
  334. BSSL_NAMESPACE_BEGIN
  335. BORINGSSL_MAKE_DELETER(EC_POINT, EC_POINT_free)
  336. BORINGSSL_MAKE_DELETER(EC_GROUP, EC_GROUP_free)
  337. BSSL_NAMESPACE_END
  338. } // extern C++
  339. #endif
  340. #define EC_R_BUFFER_TOO_SMALL 100
  341. #define EC_R_COORDINATES_OUT_OF_RANGE 101
  342. #define EC_R_D2I_ECPKPARAMETERS_FAILURE 102
  343. #define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 103
  344. #define EC_R_GROUP2PKPARAMETERS_FAILURE 104
  345. #define EC_R_I2D_ECPKPARAMETERS_FAILURE 105
  346. #define EC_R_INCOMPATIBLE_OBJECTS 106
  347. #define EC_R_INVALID_COMPRESSED_POINT 107
  348. #define EC_R_INVALID_COMPRESSION_BIT 108
  349. #define EC_R_INVALID_ENCODING 109
  350. #define EC_R_INVALID_FIELD 110
  351. #define EC_R_INVALID_FORM 111
  352. #define EC_R_INVALID_GROUP_ORDER 112
  353. #define EC_R_INVALID_PRIVATE_KEY 113
  354. #define EC_R_MISSING_PARAMETERS 114
  355. #define EC_R_MISSING_PRIVATE_KEY 115
  356. #define EC_R_NON_NAMED_CURVE 116
  357. #define EC_R_NOT_INITIALIZED 117
  358. #define EC_R_PKPARAMETERS2GROUP_FAILURE 118
  359. #define EC_R_POINT_AT_INFINITY 119
  360. #define EC_R_POINT_IS_NOT_ON_CURVE 120
  361. #define EC_R_SLOT_FULL 121
  362. #define EC_R_UNDEFINED_GENERATOR 122
  363. #define EC_R_UNKNOWN_GROUP 123
  364. #define EC_R_UNKNOWN_ORDER 124
  365. #define EC_R_WRONG_ORDER 125
  366. #define EC_R_BIGNUM_OUT_OF_RANGE 126
  367. #define EC_R_WRONG_CURVE_PARAMETERS 127
  368. #define EC_R_DECODE_ERROR 128
  369. #define EC_R_ENCODE_ERROR 129
  370. #define EC_R_GROUP_MISMATCH 130
  371. #define EC_R_INVALID_COFACTOR 131
  372. #define EC_R_PUBLIC_KEY_VALIDATION_FAILED 132
  373. #define EC_R_INVALID_SCALAR 133
  374. #endif // OPENSSL_HEADER_EC_H