diff options
| author | tb <> | 2019-01-19 01:07:00 +0000 |
|---|---|---|
| committer | tb <> | 2019-01-19 01:07:00 +0000 |
| commit | aa769d92fad41004606a446424dde716784d7854 (patch) | |
| tree | f28042e7a3c924e4bf846d6cded984e02699177d /src/lib/libcrypto/ec/ec_lcl.h | |
| parent | 640fa09d8cf557a05ae0593b939b6f5c57397e06 (diff) | |
| download | openbsd-aa769d92fad41004606a446424dde716784d7854.tar.gz openbsd-aa769d92fad41004606a446424dde716784d7854.tar.bz2 openbsd-aa769d92fad41004606a446424dde716784d7854.zip | |
Partial port of EC_KEY_METHOD from OpenSSL 1.1.
This commit adds init/free, support for signing, setting and
getting the method, engine support as well as extra data.
from markus
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lcl.h')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lcl.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/lib/libcrypto/ec/ec_lcl.h b/src/lib/libcrypto/ec/ec_lcl.h index c177246f36..cff0892e89 100644 --- a/src/lib/libcrypto/ec/ec_lcl.h +++ b/src/lib/libcrypto/ec/ec_lcl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_lcl.h,v 1.11 2018/11/05 20:18:21 tb Exp $ */ | 1 | /* $OpenBSD: ec_lcl.h,v 1.12 2019/01/19 01:07:00 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -73,6 +73,7 @@ | |||
| 73 | 73 | ||
| 74 | #include <openssl/obj_mac.h> | 74 | #include <openssl/obj_mac.h> |
| 75 | #include <openssl/ec.h> | 75 | #include <openssl/ec.h> |
| 76 | #include <openssl/ecdsa.h> | ||
| 76 | #include <openssl/bn.h> | 77 | #include <openssl/bn.h> |
| 77 | 78 | ||
| 78 | __BEGIN_HIDDEN_DECLS | 79 | __BEGIN_HIDDEN_DECLS |
| @@ -245,6 +246,9 @@ struct ec_group_st { | |||
| 245 | } /* EC_GROUP */; | 246 | } /* EC_GROUP */; |
| 246 | 247 | ||
| 247 | struct ec_key_st { | 248 | struct ec_key_st { |
| 249 | const EC_KEY_METHOD *meth; | ||
| 250 | ENGINE *engine; | ||
| 251 | |||
| 248 | int version; | 252 | int version; |
| 249 | 253 | ||
| 250 | EC_GROUP *group; | 254 | EC_GROUP *group; |
| @@ -259,6 +263,7 @@ struct ec_key_st { | |||
| 259 | int flags; | 263 | int flags; |
| 260 | 264 | ||
| 261 | EC_EXTRA_DATA *method_data; | 265 | EC_EXTRA_DATA *method_data; |
| 266 | CRYPTO_EX_DATA ex_data; | ||
| 262 | } /* EC_KEY */; | 267 | } /* EC_KEY */; |
| 263 | 268 | ||
| 264 | /* Basically a 'mixin' for extra data, but available for EC_GROUPs/EC_KEYs only | 269 | /* Basically a 'mixin' for extra data, but available for EC_GROUPs/EC_KEYs only |
| @@ -441,6 +446,29 @@ int ec_GFp_nistp256_have_precompute_mult(const EC_GROUP *group); | |||
| 441 | const EC_METHOD *EC_GFp_nistz256_method(void); | 446 | const EC_METHOD *EC_GFp_nistz256_method(void); |
| 442 | #endif | 447 | #endif |
| 443 | 448 | ||
| 449 | /* EC_METHOD definitions */ | ||
| 450 | |||
| 451 | struct ec_key_method_st { | ||
| 452 | const char *name; | ||
| 453 | int32_t flags; | ||
| 454 | int (*init)(EC_KEY *key); | ||
| 455 | void (*finish)(EC_KEY *key); | ||
| 456 | int (*copy)(EC_KEY *dest, const EC_KEY *src); | ||
| 457 | int (*set_group)(EC_KEY *key, const EC_GROUP *grp); | ||
| 458 | int (*set_private)(EC_KEY *key, const BIGNUM *priv_key); | ||
| 459 | int (*set_public)(EC_KEY *key, const EC_POINT *pub_key); | ||
| 460 | int (*sign)(int type, const unsigned char *dgst, int dlen, unsigned char | ||
| 461 | *sig, unsigned int *siglen, const BIGNUM *kinv, | ||
| 462 | const BIGNUM *r, EC_KEY *eckey); | ||
| 463 | int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, | ||
| 464 | BIGNUM **rp); | ||
| 465 | ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, int dgst_len, | ||
| 466 | const BIGNUM *in_kinv, const BIGNUM *in_r, | ||
| 467 | EC_KEY *eckey); | ||
| 468 | } /* EC_KEY_METHOD */; | ||
| 469 | |||
| 470 | #define EC_KEY_METHOD_DYNAMIC 1 | ||
| 471 | |||
| 444 | /* method functions in ecp_nistp521.c */ | 472 | /* method functions in ecp_nistp521.c */ |
| 445 | int ec_GFp_nistp521_group_init(EC_GROUP *group); | 473 | int ec_GFp_nistp521_group_init(EC_GROUP *group); |
| 446 | int ec_GFp_nistp521_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *n, BN_CTX *); | 474 | int ec_GFp_nistp521_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *n, BN_CTX *); |
