Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 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 | |
| 68 | #ifndef OPENSSL_HEADER_EC_H |
| 69 | #define OPENSSL_HEADER_EC_H |
| 70 | |
| 71 | #include <openssl/base.h> |
| 72 | |
| 73 | #if defined(__cplusplus) |
| 74 | extern "C" { |
| 75 | #endif |
| 76 | |
| 77 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 78 | // Low-level operations on elliptic curves. |
David Benjamin | 5b082e8 | 2014-12-26 00:54:52 -0500 | [diff] [blame] | 79 | |
| 80 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 81 | // point_conversion_form_t enumerates forms, as defined in X9.62 (ECDSA), for |
| 82 | // the encoding of a elliptic curve point (x,y) |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 83 | typedef enum { |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 84 | // POINT_CONVERSION_COMPRESSED indicates that the point is encoded as z||x, |
| 85 | // where the octet z specifies which solution of the quadratic equation y |
| 86 | // is. |
Adam Langley | ce9d85e | 2016-01-24 15:58:39 -0800 | [diff] [blame] | 87 | POINT_CONVERSION_COMPRESSED = 2, |
| 88 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 89 | // POINT_CONVERSION_UNCOMPRESSED indicates that the point is encoded as |
| 90 | // z||x||y, where z is the octet 0x04. |
Adam Langley | ce9d85e | 2016-01-24 15:58:39 -0800 | [diff] [blame] | 91 | POINT_CONVERSION_UNCOMPRESSED = 4, |
| 92 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 93 | // POINT_CONVERSION_HYBRID indicates that the point is encoded as z||x||y, |
| 94 | // where z specifies which solution of the quadratic equation y is. This is |
| 95 | // not supported by the code and has never been observed in use. |
| 96 | // |
| 97 | // TODO(agl): remove once node.js no longer references this. |
Adam Langley | ce9d85e | 2016-01-24 15:58:39 -0800 | [diff] [blame] | 98 | POINT_CONVERSION_HYBRID = 6, |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 99 | } point_conversion_form_t; |
| 100 | |
| 101 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 102 | // Elliptic curve groups. |
David Benjamin | c394713 | 2023-09-27 15:24:58 -0400 | [diff] [blame] | 103 | // |
| 104 | // Elliptic curve groups are represented by |EC_GROUP| objects. Unlike OpenSSL, |
| 105 | // if limited to the APIs in this section, callers may treat |EC_GROUP|s as |
| 106 | // static, immutable objects which do not need to be copied or released. In |
| 107 | // BoringSSL, only custom |EC_GROUP|s created by |EC_GROUP_new_curve_GFp| |
| 108 | // (deprecated) are dynamic. |
| 109 | // |
| 110 | // Callers may cast away |const| and use |EC_GROUP_dup| and |EC_GROUP_free| with |
| 111 | // static groups, for compatibility with OpenSSL or dynamic groups, but it is |
| 112 | // otherwise unnecessary. |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 113 | |
David Benjamin | 417069f | 2023-02-13 18:33:02 -0500 | [diff] [blame] | 114 | // EC_group_p224 returns an |EC_GROUP| for P-224, also known as secp224r1. |
| 115 | OPENSSL_EXPORT const EC_GROUP *EC_group_p224(void); |
| 116 | |
| 117 | // EC_group_p256 returns an |EC_GROUP| for P-256, also known as secp256r1 or |
| 118 | // prime256v1. |
| 119 | OPENSSL_EXPORT const EC_GROUP *EC_group_p256(void); |
| 120 | |
| 121 | // EC_group_p384 returns an |EC_GROUP| for P-384, also known as secp384r1. |
| 122 | OPENSSL_EXPORT const EC_GROUP *EC_group_p384(void); |
| 123 | |
| 124 | // EC_group_p521 returns an |EC_GROUP| for P-521, also known as secp521r1. |
| 125 | OPENSSL_EXPORT const EC_GROUP *EC_group_p521(void); |
| 126 | |
| 127 | // EC_GROUP_new_by_curve_name returns the |EC_GROUP| object for the elliptic |
| 128 | // curve specified by |nid|, or NULL on unsupported NID. For OpenSSL |
| 129 | // compatibility, this function returns a non-const pointer which may be passed |
| 130 | // to |EC_GROUP_free|. However, the resulting object is actually static and |
| 131 | // calling |EC_GROUP_free| is optional. |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 132 | // |
| 133 | // The supported NIDs are: |
David Benjamin | a942d57 | 2023-12-14 14:27:27 -0500 | [diff] [blame] | 134 | // - |NID_secp224r1| (P-224) |
| 135 | // - |NID_X9_62_prime256v1| (P-256) |
| 136 | // - |NID_secp384r1| (P-384) |
| 137 | // - |NID_secp521r1| (P-521) |
David Benjamin | d61334d | 2018-03-20 15:56:17 -0400 | [diff] [blame] | 138 | // |
David Benjamin | 417069f | 2023-02-13 18:33:02 -0500 | [diff] [blame] | 139 | // Calling this function causes all four curves to be linked into the binary. |
| 140 | // Prefer calling |EC_group_*| to allow the static linker to drop unused curves. |
| 141 | // |
David Benjamin | d61334d | 2018-03-20 15:56:17 -0400 | [diff] [blame] | 142 | // If in doubt, use |NID_X9_62_prime256v1|, or see the curve25519.h header for |
| 143 | // more modern primitives. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 144 | OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_by_curve_name(int nid); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 145 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 146 | // EC_GROUP_cmp returns zero if |a| and |b| are the same group and non-zero |
| 147 | // otherwise. |
Adam Langley | 93531bd | 2015-02-13 10:47:56 -0800 | [diff] [blame] | 148 | OPENSSL_EXPORT int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, |
| 149 | BN_CTX *ignored); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 150 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 151 | // EC_GROUP_get0_generator returns a pointer to the internal |EC_POINT| object |
| 152 | // in |group| that specifies the generator for the group. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 153 | OPENSSL_EXPORT const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 154 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 155 | // EC_GROUP_get0_order returns a pointer to the internal |BIGNUM| object in |
| 156 | // |group| that specifies the order of the group. |
Brian Smith | a3d9de0 | 2015-11-18 17:07:14 -1000 | [diff] [blame] | 157 | OPENSSL_EXPORT const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 158 | |
Jeremy Apthorp | 79c7ec0 | 2018-12-19 14:42:26 -0800 | [diff] [blame] | 159 | // EC_GROUP_order_bits returns the number of bits of the order of |group|. |
| 160 | OPENSSL_EXPORT int EC_GROUP_order_bits(const EC_GROUP *group); |
| 161 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 162 | // EC_GROUP_get_cofactor sets |*cofactor| to the cofactor of |group| using |
| 163 | // |ctx|, if it's not NULL. It returns one on success and zero otherwise. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 164 | OPENSSL_EXPORT int EC_GROUP_get_cofactor(const EC_GROUP *group, |
| 165 | BIGNUM *cofactor, BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 166 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 167 | // EC_GROUP_get_curve_GFp gets various parameters about a group. It sets |
| 168 | // |*out_p| to the order of the coordinate field and |*out_a| and |*out_b| to |
| 169 | // the parameters of the curve when expressed as y² = x³ + ax + b. Any of the |
| 170 | // output parameters can be NULL. It returns one on success and zero on |
| 171 | // error. |
Adam Langley | 0eb1aae | 2014-08-22 12:24:16 -0700 | [diff] [blame] | 172 | OPENSSL_EXPORT int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *out_p, |
| 173 | BIGNUM *out_a, BIGNUM *out_b, |
| 174 | BN_CTX *ctx); |
| 175 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 176 | // EC_GROUP_get_curve_name returns a NID that identifies |group|. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 177 | OPENSSL_EXPORT int EC_GROUP_get_curve_name(const EC_GROUP *group); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 178 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 179 | // EC_GROUP_get_degree returns the number of bits needed to represent an |
| 180 | // element of the field underlying |group|. |
Brian Smith | 274341d | 2015-10-08 17:10:15 -1000 | [diff] [blame] | 181 | OPENSSL_EXPORT unsigned EC_GROUP_get_degree(const EC_GROUP *group); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 182 | |
David Benjamin | 0318b05 | 2018-05-07 20:38:20 -0400 | [diff] [blame] | 183 | // EC_curve_nid2nist returns the NIST name of the elliptic curve specified by |
| 184 | // |nid|, or NULL if |nid| is not a NIST curve. For example, it returns "P-256" |
| 185 | // for |NID_X9_62_prime256v1|. |
| 186 | OPENSSL_EXPORT const char *EC_curve_nid2nist(int nid); |
| 187 | |
David Benjamin | 23dcf88 | 2019-01-25 04:44:22 +0000 | [diff] [blame] | 188 | // EC_curve_nist2nid returns the NID of the elliptic curve specified by the NIST |
| 189 | // name |name|, or |NID_undef| if |name| is not a recognized name. For example, |
| 190 | // it returns |NID_X9_62_prime256v1| for "P-256". |
| 191 | OPENSSL_EXPORT int EC_curve_nist2nid(const char *name); |
| 192 | |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 193 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 194 | // Points on elliptic curves. |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 195 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 196 | // EC_POINT_new returns a fresh |EC_POINT| object in the given group, or NULL |
| 197 | // on error. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 198 | OPENSSL_EXPORT EC_POINT *EC_POINT_new(const EC_GROUP *group); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 199 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 200 | // EC_POINT_free frees |point| and the data that it points to. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 201 | OPENSSL_EXPORT void EC_POINT_free(EC_POINT *point); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 202 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 203 | // EC_POINT_copy sets |*dest| equal to |*src|. It returns one on success and |
| 204 | // zero otherwise. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 205 | OPENSSL_EXPORT int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 206 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 207 | // EC_POINT_dup returns a fresh |EC_POINT| that contains the same values as |
| 208 | // |src|, or NULL on error. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 209 | OPENSSL_EXPORT EC_POINT *EC_POINT_dup(const EC_POINT *src, |
| 210 | const EC_GROUP *group); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 211 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 212 | // EC_POINT_set_to_infinity sets |point| to be the "point at infinity" for the |
| 213 | // given group. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 214 | OPENSSL_EXPORT int EC_POINT_set_to_infinity(const EC_GROUP *group, |
| 215 | EC_POINT *point); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 216 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 217 | // EC_POINT_is_at_infinity returns one iff |point| is the point at infinity and |
| 218 | // zero otherwise. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 219 | OPENSSL_EXPORT int EC_POINT_is_at_infinity(const EC_GROUP *group, |
| 220 | const EC_POINT *point); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 221 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 222 | // EC_POINT_is_on_curve returns one if |point| is an element of |group| and |
| 223 | // and zero otherwise or when an error occurs. This is different from OpenSSL, |
| 224 | // which returns -1 on error. If |ctx| is non-NULL, it may be used. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 225 | OPENSSL_EXPORT int EC_POINT_is_on_curve(const EC_GROUP *group, |
| 226 | const EC_POINT *point, BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 227 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 228 | // EC_POINT_cmp returns zero if |a| is equal to |b|, greater than zero if |
| 229 | // not equal and -1 on error. If |ctx| is not NULL, it may be used. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 230 | OPENSSL_EXPORT int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, |
| 231 | const EC_POINT *b, BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 232 | |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 233 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 234 | // Point conversion. |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 235 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 236 | // EC_POINT_get_affine_coordinates_GFp sets |x| and |y| to the affine value of |
| 237 | // |point| using |ctx|, if it's not NULL. It returns one on success and zero |
| 238 | // otherwise. |
David Benjamin | 3d2c6b0 | 2018-03-05 13:53:54 -0500 | [diff] [blame] | 239 | // |
| 240 | // Either |x| or |y| may be NULL to skip computing that coordinate. This is |
| 241 | // slightly faster in the common case where only the x-coordinate is needed. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 242 | OPENSSL_EXPORT int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, |
| 243 | const EC_POINT *point, |
| 244 | BIGNUM *x, BIGNUM *y, |
| 245 | BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 246 | |
Adam Langley | 5dd18d0 | 2021-01-07 12:45:59 -0800 | [diff] [blame] | 247 | // EC_POINT_get_affine_coordinates is an alias of |
| 248 | // |EC_POINT_get_affine_coordinates_GFp|. |
| 249 | OPENSSL_EXPORT int EC_POINT_get_affine_coordinates(const EC_GROUP *group, |
| 250 | const EC_POINT *point, |
| 251 | BIGNUM *x, BIGNUM *y, |
| 252 | BN_CTX *ctx); |
| 253 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 254 | // EC_POINT_set_affine_coordinates_GFp sets the value of |point| to be |
| 255 | // (|x|, |y|). The |ctx| argument may be used if not NULL. It returns one |
David Benjamin | 0deb91a | 2020-01-07 11:33:18 -0500 | [diff] [blame] | 256 | // on success or zero on error. It's considered an error if the point is not on |
| 257 | // the curve. |
| 258 | // |
| 259 | // Note that the corresponding function in OpenSSL versions prior to 1.0.2s does |
| 260 | // not check if the point is on the curve. This is a security-critical check, so |
| 261 | // code additionally supporting OpenSSL should repeat the check with |
| 262 | // |EC_POINT_is_on_curve| or check for older OpenSSL versions with |
| 263 | // |OPENSSL_VERSION_NUMBER|. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 264 | OPENSSL_EXPORT int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, |
| 265 | EC_POINT *point, |
| 266 | const BIGNUM *x, |
| 267 | const BIGNUM *y, |
| 268 | BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 269 | |
Adam Langley | 76164b1 | 2021-01-06 16:34:01 -0800 | [diff] [blame] | 270 | // EC_POINT_set_affine_coordinates is an alias of |
| 271 | // |EC_POINT_set_affine_coordinates_GFp|. |
| 272 | OPENSSL_EXPORT int EC_POINT_set_affine_coordinates(const EC_GROUP *group, |
| 273 | EC_POINT *point, |
| 274 | const BIGNUM *x, |
| 275 | const BIGNUM *y, |
| 276 | BN_CTX *ctx); |
| 277 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 278 | // EC_POINT_point2oct serialises |point| into the X9.62 form given by |form| |
David Benjamin | 38f621a | 2022-11-04 17:16:49 -0400 | [diff] [blame] | 279 | // into, at most, |max_out| bytes at |buf|. It returns the number of bytes |
| 280 | // written or zero on error if |buf| is non-NULL, else the number of bytes |
| 281 | // needed. The |ctx| argument may be used if not NULL. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 282 | OPENSSL_EXPORT size_t EC_POINT_point2oct(const EC_GROUP *group, |
| 283 | const EC_POINT *point, |
| 284 | point_conversion_form_t form, |
David Benjamin | 38f621a | 2022-11-04 17:16:49 -0400 | [diff] [blame] | 285 | uint8_t *buf, size_t max_out, |
| 286 | BN_CTX *ctx); |
| 287 | |
| 288 | // EC_POINT_point2buf serialises |point| into the X9.62 form given by |form| to |
| 289 | // a newly-allocated buffer and sets |*out_buf| to point to it. It returns the |
| 290 | // length of the result on success or zero on error. The caller must release |
| 291 | // |*out_buf| with |OPENSSL_free| when done. |
| 292 | OPENSSL_EXPORT size_t EC_POINT_point2buf(const EC_GROUP *group, |
| 293 | const EC_POINT *point, |
| 294 | point_conversion_form_t form, |
| 295 | uint8_t **out_buf, BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 296 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 297 | // EC_POINT_point2cbb behaves like |EC_POINT_point2oct| but appends the |
| 298 | // serialised point to |cbb|. It returns one on success and zero on error. |
David Benjamin | 6014ea6 | 2015-12-30 21:39:34 -0500 | [diff] [blame] | 299 | OPENSSL_EXPORT int EC_POINT_point2cbb(CBB *out, const EC_GROUP *group, |
| 300 | const EC_POINT *point, |
| 301 | point_conversion_form_t form, |
| 302 | BN_CTX *ctx); |
| 303 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 304 | // EC_POINT_oct2point sets |point| from |len| bytes of X9.62 format |
David Benjamin | 0deb91a | 2020-01-07 11:33:18 -0500 | [diff] [blame] | 305 | // serialisation in |buf|. It returns one on success and zero on error. The |
| 306 | // |ctx| argument may be used if not NULL. It's considered an error if |buf| |
| 307 | // does not represent a point on the curve. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 308 | OPENSSL_EXPORT int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, |
| 309 | const uint8_t *buf, size_t len, |
| 310 | BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 311 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 312 | // EC_POINT_set_compressed_coordinates_GFp sets |point| to equal the point with |
| 313 | // the given |x| coordinate and the y coordinate specified by |y_bit| (see |
| 314 | // X9.62). It returns one on success and zero otherwise. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 315 | OPENSSL_EXPORT int EC_POINT_set_compressed_coordinates_GFp( |
| 316 | const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, int y_bit, |
| 317 | BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 318 | |
| 319 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 320 | // Group operations. |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 321 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 322 | // EC_POINT_add sets |r| equal to |a| plus |b|. It returns one on success and |
| 323 | // zero otherwise. If |ctx| is not NULL, it may be used. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 324 | OPENSSL_EXPORT int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, |
| 325 | const EC_POINT *a, const EC_POINT *b, |
| 326 | BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 327 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 328 | // EC_POINT_dbl sets |r| equal to |a| plus |a|. It returns one on success and |
| 329 | // zero otherwise. If |ctx| is not NULL, it may be used. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 330 | OPENSSL_EXPORT int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, |
| 331 | const EC_POINT *a, BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 332 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 333 | // EC_POINT_invert sets |a| equal to minus |a|. It returns one on success and |
| 334 | // zero otherwise. If |ctx| is not NULL, it may be used. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 335 | OPENSSL_EXPORT int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, |
| 336 | BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 337 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 338 | // EC_POINT_mul sets r = generator*n + q*m. It returns one on success and zero |
| 339 | // otherwise. If |ctx| is not NULL, it may be used. |
Adam Langley | eb7d2ed | 2014-07-30 16:02:14 -0700 | [diff] [blame] | 340 | OPENSSL_EXPORT int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, |
| 341 | const BIGNUM *n, const EC_POINT *q, |
| 342 | const BIGNUM *m, BN_CTX *ctx); |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 343 | |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 344 | |
David Benjamin | 3950d6c | 2023-02-09 19:24:06 -0500 | [diff] [blame] | 345 | // Hash-to-curve. |
| 346 | // |
David Benjamin | 39a7507 | 2023-08-14 20:48:50 -0400 | [diff] [blame] | 347 | // The following functions implement primitives from RFC 9380. The |dst| |
| 348 | // parameter in each function is the domain separation tag and must be unique |
| 349 | // for each protocol and between the |hash_to_curve| and |hash_to_scalar| |
| 350 | // variants. See section 3.1 of the spec for additional guidance on this |
| 351 | // parameter. |
David Benjamin | 3950d6c | 2023-02-09 19:24:06 -0500 | [diff] [blame] | 352 | |
| 353 | // EC_hash_to_curve_p256_xmd_sha256_sswu hashes |msg| to a point on |group| and |
| 354 | // writes the result to |out|, implementing the P256_XMD:SHA-256_SSWU_RO_ suite |
David Benjamin | 39a7507 | 2023-08-14 20:48:50 -0400 | [diff] [blame] | 355 | // from RFC 9380. It returns one on success and zero on error. |
David Benjamin | 3950d6c | 2023-02-09 19:24:06 -0500 | [diff] [blame] | 356 | OPENSSL_EXPORT int EC_hash_to_curve_p256_xmd_sha256_sswu( |
| 357 | const EC_GROUP *group, EC_POINT *out, const uint8_t *dst, size_t dst_len, |
| 358 | const uint8_t *msg, size_t msg_len); |
| 359 | |
| 360 | // EC_hash_to_curve_p384_xmd_sha384_sswu hashes |msg| to a point on |group| and |
| 361 | // writes the result to |out|, implementing the P384_XMD:SHA-384_SSWU_RO_ suite |
David Benjamin | 39a7507 | 2023-08-14 20:48:50 -0400 | [diff] [blame] | 362 | // from RFC 9380. It returns one on success and zero on error. |
David Benjamin | 3950d6c | 2023-02-09 19:24:06 -0500 | [diff] [blame] | 363 | OPENSSL_EXPORT int EC_hash_to_curve_p384_xmd_sha384_sswu( |
| 364 | const EC_GROUP *group, EC_POINT *out, const uint8_t *dst, size_t dst_len, |
| 365 | const uint8_t *msg, size_t msg_len); |
| 366 | |
| 367 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 368 | // Deprecated functions. |
Adam Langley | c3ef76f | 2015-04-13 14:34:17 -0700 | [diff] [blame] | 369 | |
David Benjamin | c394713 | 2023-09-27 15:24:58 -0400 | [diff] [blame] | 370 | // EC_GROUP_free releases a reference to |group|, if |group| was created by |
| 371 | // |EC_GROUP_new_curve_GFp|. If |group| is static, it does nothing. |
| 372 | // |
| 373 | // This function exists for OpenSSL compatibilty, and to manage dynamic |
| 374 | // |EC_GROUP|s constructed by |EC_GROUP_new_curve_GFp|. Callers that do not need |
| 375 | // either may ignore this function. |
| 376 | OPENSSL_EXPORT void EC_GROUP_free(EC_GROUP *group); |
| 377 | |
| 378 | // EC_GROUP_dup increments |group|'s reference count and returns it, if |group| |
| 379 | // was created by |EC_GROUP_new_curve_GFp|. If |group| is static, it simply |
| 380 | // returns |group|. |
| 381 | // |
| 382 | // This function exists for OpenSSL compatibilty, and to manage dynamic |
| 383 | // |EC_GROUP|s constructed by |EC_GROUP_new_curve_GFp|. Callers that do not need |
| 384 | // either may ignore this function. |
| 385 | OPENSSL_EXPORT EC_GROUP *EC_GROUP_dup(const EC_GROUP *group); |
| 386 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 387 | // EC_GROUP_new_curve_GFp creates a new, arbitrary elliptic curve group based |
| 388 | // on the equation y² = x³ + a·x + b. It returns the new group or NULL on |
David Benjamin | c394713 | 2023-09-27 15:24:58 -0400 | [diff] [blame] | 389 | // error. The lifetime of the resulting object must be managed with |
| 390 | // |EC_GROUP_dup| and |EC_GROUP_free|. |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 391 | // |
| 392 | // This new group has no generator. It is an error to use a generator-less group |
| 393 | // with any functions except for |EC_GROUP_free|, |EC_POINT_new|, |
| 394 | // |EC_POINT_set_affine_coordinates_GFp|, and |EC_GROUP_set_generator|. |
| 395 | // |
| 396 | // |EC_GROUP|s returned by this function will always compare as unequal via |
| 397 | // |EC_GROUP_cmp| (even to themselves). |EC_GROUP_get_curve_name| will always |
| 398 | // return |NID_undef|. |
| 399 | // |
Adam Langley | c7a3c46 | 2022-03-15 09:52:36 -0700 | [diff] [blame] | 400 | // This function is provided for compatibility with some legacy applications |
| 401 | // only. Avoid using arbitrary curves and use |EC_GROUP_new_by_curve_name| |
| 402 | // instead. This ensures the result meets preconditions necessary for |
| 403 | // elliptic curve algorithms to function correctly and securely. |
| 404 | // |
| 405 | // Given invalid parameters, this function may fail or it may return an |
| 406 | // |EC_GROUP| which breaks these preconditions. Subsequent operations may then |
| 407 | // return arbitrary, incorrect values. Callers should not pass |
| 408 | // attacker-controlled values to this function. |
David Benjamin | 6f7374b | 2016-03-11 16:08:39 -0500 | [diff] [blame] | 409 | OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, |
| 410 | const BIGNUM *a, |
| 411 | const BIGNUM *b, BN_CTX *ctx); |
| 412 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 413 | // EC_GROUP_set_generator sets the generator for |group| to |generator|, which |
| 414 | // must have the given order and cofactor. It may only be used with |EC_GROUP| |
| 415 | // objects returned by |EC_GROUP_new_curve_GFp| and may only be used once on |
David Benjamin | cb16f17 | 2017-10-26 15:48:18 -0400 | [diff] [blame] | 416 | // each group. |generator| must have been created using |group|. |
David Benjamin | 6f7374b | 2016-03-11 16:08:39 -0500 | [diff] [blame] | 417 | OPENSSL_EXPORT int EC_GROUP_set_generator(EC_GROUP *group, |
| 418 | const EC_POINT *generator, |
| 419 | const BIGNUM *order, |
| 420 | const BIGNUM *cofactor); |
| 421 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 422 | // EC_GROUP_get_order sets |*order| to the order of |group|, if it's not |
| 423 | // NULL. It returns one on success and zero otherwise. |ctx| is ignored. Use |
| 424 | // |EC_GROUP_get0_order| instead. |
Brian Smith | a3d9de0 | 2015-11-18 17:07:14 -1000 | [diff] [blame] | 425 | OPENSSL_EXPORT int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, |
| 426 | BN_CTX *ctx); |
| 427 | |
David Benjamin | e7bb89b | 2021-02-26 18:34:48 -0500 | [diff] [blame] | 428 | #define OPENSSL_EC_EXPLICIT_CURVE 0 |
| 429 | #define OPENSSL_EC_NAMED_CURVE 1 |
| 430 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 431 | // EC_GROUP_set_asn1_flag does nothing. |
Adam Langley | c3ef76f | 2015-04-13 14:34:17 -0700 | [diff] [blame] | 432 | OPENSSL_EXPORT void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); |
| 433 | |
David Benjamin | e7bb89b | 2021-02-26 18:34:48 -0500 | [diff] [blame] | 434 | // EC_GROUP_get_asn1_flag returns |OPENSSL_EC_NAMED_CURVE|. |
| 435 | OPENSSL_EXPORT int EC_GROUP_get_asn1_flag(const EC_GROUP *group); |
Adam Langley | c3ef76f | 2015-04-13 14:34:17 -0700 | [diff] [blame] | 436 | |
| 437 | typedef struct ec_method_st EC_METHOD; |
| 438 | |
David Benjamin | 2f5100e | 2018-05-11 18:20:56 -0400 | [diff] [blame] | 439 | // EC_GROUP_method_of returns a dummy non-NULL pointer. |
Adam Langley | c3ef76f | 2015-04-13 14:34:17 -0700 | [diff] [blame] | 440 | OPENSSL_EXPORT const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); |
| 441 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 442 | // EC_METHOD_get_field_type returns NID_X9_62_prime_field. |
Adam Langley | c3ef76f | 2015-04-13 14:34:17 -0700 | [diff] [blame] | 443 | OPENSSL_EXPORT int EC_METHOD_get_field_type(const EC_METHOD *meth); |
| 444 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 445 | // EC_GROUP_set_point_conversion_form aborts the process if |form| is not |
| 446 | // |POINT_CONVERSION_UNCOMPRESSED| and otherwise does nothing. |
Adam Langley | 126320c | 2015-05-04 17:43:00 -0700 | [diff] [blame] | 447 | OPENSSL_EXPORT void EC_GROUP_set_point_conversion_form( |
| 448 | EC_GROUP *group, point_conversion_form_t form); |
| 449 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 450 | // EC_builtin_curve describes a supported elliptic curve. |
Adam Langley | ce9d85e | 2016-01-24 15:58:39 -0800 | [diff] [blame] | 451 | typedef struct { |
| 452 | int nid; |
| 453 | const char *comment; |
| 454 | } EC_builtin_curve; |
| 455 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 456 | // EC_get_builtin_curves writes at most |max_num_curves| elements to |
| 457 | // |out_curves| and returns the total number that it would have written, had |
| 458 | // |max_num_curves| been large enough. |
| 459 | // |
| 460 | // The |EC_builtin_curve| items describe the supported elliptic curves. |
Adam Langley | ce9d85e | 2016-01-24 15:58:39 -0800 | [diff] [blame] | 461 | OPENSSL_EXPORT size_t EC_get_builtin_curves(EC_builtin_curve *out_curves, |
| 462 | size_t max_num_curves); |
Adam Langley | c3ef76f | 2015-04-13 14:34:17 -0700 | [diff] [blame] | 463 | |
David Benjamin | d24fd47 | 2017-10-26 21:13:16 -0400 | [diff] [blame] | 464 | // EC_POINT_clear_free calls |EC_POINT_free|. |
| 465 | OPENSSL_EXPORT void EC_POINT_clear_free(EC_POINT *point); |
| 466 | |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 467 | |
| 468 | #if defined(__cplusplus) |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 469 | } // extern C |
David Benjamin | f09df69 | 2018-11-09 13:21:02 -0600 | [diff] [blame] | 470 | #endif |
Matt Braithwaite | d17d74d | 2016-08-17 20:10:28 -0700 | [diff] [blame] | 471 | |
David Benjamin | f09df69 | 2018-11-09 13:21:02 -0600 | [diff] [blame] | 472 | // Old code expects to get EC_KEY from ec.h. |
| 473 | #include <openssl/ec_key.h> |
| 474 | |
| 475 | #if defined(__cplusplus) |
Matt Braithwaite | d17d74d | 2016-08-17 20:10:28 -0700 | [diff] [blame] | 476 | extern "C++" { |
| 477 | |
Joshua Liebow-Feeser | 8c7c635 | 2018-08-26 18:53:36 -0700 | [diff] [blame] | 478 | BSSL_NAMESPACE_BEGIN |
Matt Braithwaite | d17d74d | 2016-08-17 20:10:28 -0700 | [diff] [blame] | 479 | |
Matt Braithwaite | d17d74d | 2016-08-17 20:10:28 -0700 | [diff] [blame] | 480 | BORINGSSL_MAKE_DELETER(EC_POINT, EC_POINT_free) |
| 481 | BORINGSSL_MAKE_DELETER(EC_GROUP, EC_GROUP_free) |
| 482 | |
Joshua Liebow-Feeser | 8c7c635 | 2018-08-26 18:53:36 -0700 | [diff] [blame] | 483 | BSSL_NAMESPACE_END |
Matt Braithwaite | d17d74d | 2016-08-17 20:10:28 -0700 | [diff] [blame] | 484 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 485 | } // extern C++ |
Matt Braithwaite | d17d74d | 2016-08-17 20:10:28 -0700 | [diff] [blame] | 486 | |
Adam Langley | 8c3c313 | 2016-07-11 15:22:19 -0700 | [diff] [blame] | 487 | #endif |
| 488 | |
David Benjamin | 689be0f | 2015-02-11 15:55:26 -0500 | [diff] [blame] | 489 | #define EC_R_BUFFER_TOO_SMALL 100 |
| 490 | #define EC_R_COORDINATES_OUT_OF_RANGE 101 |
| 491 | #define EC_R_D2I_ECPKPARAMETERS_FAILURE 102 |
| 492 | #define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 103 |
| 493 | #define EC_R_GROUP2PKPARAMETERS_FAILURE 104 |
| 494 | #define EC_R_I2D_ECPKPARAMETERS_FAILURE 105 |
| 495 | #define EC_R_INCOMPATIBLE_OBJECTS 106 |
| 496 | #define EC_R_INVALID_COMPRESSED_POINT 107 |
| 497 | #define EC_R_INVALID_COMPRESSION_BIT 108 |
| 498 | #define EC_R_INVALID_ENCODING 109 |
| 499 | #define EC_R_INVALID_FIELD 110 |
| 500 | #define EC_R_INVALID_FORM 111 |
| 501 | #define EC_R_INVALID_GROUP_ORDER 112 |
| 502 | #define EC_R_INVALID_PRIVATE_KEY 113 |
| 503 | #define EC_R_MISSING_PARAMETERS 114 |
| 504 | #define EC_R_MISSING_PRIVATE_KEY 115 |
| 505 | #define EC_R_NON_NAMED_CURVE 116 |
| 506 | #define EC_R_NOT_INITIALIZED 117 |
| 507 | #define EC_R_PKPARAMETERS2GROUP_FAILURE 118 |
| 508 | #define EC_R_POINT_AT_INFINITY 119 |
| 509 | #define EC_R_POINT_IS_NOT_ON_CURVE 120 |
| 510 | #define EC_R_SLOT_FULL 121 |
| 511 | #define EC_R_UNDEFINED_GENERATOR 122 |
| 512 | #define EC_R_UNKNOWN_GROUP 123 |
| 513 | #define EC_R_UNKNOWN_ORDER 124 |
| 514 | #define EC_R_WRONG_ORDER 125 |
Adam Langley | ad6b28e | 2015-04-14 12:07:44 -0700 | [diff] [blame] | 515 | #define EC_R_BIGNUM_OUT_OF_RANGE 126 |
| 516 | #define EC_R_WRONG_CURVE_PARAMETERS 127 |
David Benjamin | 2f6410b | 2016-01-03 00:57:37 -0800 | [diff] [blame] | 517 | #define EC_R_DECODE_ERROR 128 |
| 518 | #define EC_R_ENCODE_ERROR 129 |
| 519 | #define EC_R_GROUP_MISMATCH 130 |
David Benjamin | 8cf79af | 2016-06-16 14:58:36 -0400 | [diff] [blame] | 520 | #define EC_R_INVALID_COFACTOR 131 |
Steven Valdez | b15143f | 2017-04-13 13:14:12 -0400 | [diff] [blame] | 521 | #define EC_R_PUBLIC_KEY_VALIDATION_FAILED 132 |
David Benjamin | a838f9d | 2017-11-13 11:58:00 +0800 | [diff] [blame] | 522 | #define EC_R_INVALID_SCALAR 133 |
Adam Langley | 95c29f3 | 2014-06-20 12:00:00 -0700 | [diff] [blame] | 523 | |
David Benjamin | 4512b79 | 2017-08-18 19:21:50 -0400 | [diff] [blame] | 524 | #endif // OPENSSL_HEADER_EC_H |