diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-02-29 14:12:11 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-03-02 20:48:12 +0000 |
commit | e2285d878d28f55bffc731a34389a2ea91de779f (patch) | |
tree | 7a74382cf5836ef03bcacf64407c16c0924d63ef /crypto/ec/ec_lcl.h | |
parent | 2ad9ef06a6aadeeb78a05ce18ace0ea5f300401b (diff) |
Handle KDF internally.
Handle KDF in ECDH_compute_key instead of requiring each implementation
support it. This modifies the compute_key method: now it allocates and
populates a buffer containing the shared secret.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/ec/ec_lcl.h')
-rw-r--r-- | crypto/ec/ec_lcl.h | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/crypto/ec/ec_lcl.h b/crypto/ec/ec_lcl.h index d5d2bfd4bb..e085f76c20 100644 --- a/crypto/ec/ec_lcl.h +++ b/crypto/ec/ec_lcl.h @@ -212,10 +212,8 @@ struct ec_method_st { int (*keycopy)(EC_KEY *dst, const EC_KEY *src); void (*keyfinish)(EC_KEY *eckey); /* custom ECDH operation */ - int (*ecdh_compute_key)(void *out, size_t outlen, const EC_POINT *pub_key, - const EC_KEY *ecdh, - void *(*KDF) (const void *in, size_t inlen, - void *out, size_t *outlen)); + int (*ecdh_compute_key)(unsigned char **pout, size_t *poutlen, + const EC_POINT *pub_key, const EC_KEY *ecdh); } /* EC_METHOD */ ; /* @@ -616,11 +614,8 @@ struct ec_key_method_st { int (*set_private)(EC_KEY *key, const BIGNUM *priv_key); int (*set_public)(EC_KEY *key, const EC_POINT *pub_key); int (*keygen)(EC_KEY *key); - int (*compute_key)(void *out, size_t outlen, const EC_POINT *pub_key, - const EC_KEY *ecdh, - void *(*KDF) (const void *in, size_t inlen, - void *out, size_t *outlen)); - + int (*compute_key)(unsigned char **pout, size_t *poutlen, + const EC_POINT *pub_key, const EC_KEY *ecdh); int (*sign)(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey); @@ -639,14 +634,10 @@ struct ec_key_method_st { #define EC_KEY_METHOD_DYNAMIC 1 int ossl_ec_key_gen(EC_KEY *eckey); -int ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, - const EC_KEY *ecdh, - void *(*KDF) (const void *in, size_t inlen, - void *out, size_t *outlen)); -int ecdh_simple_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, - const EC_KEY *ecdh, - void *(*KDF) (const void *in, size_t inlen, - void *out, size_t *outlen)); +int ossl_ecdh_compute_key(unsigned char **pout, size_t *poutlen, + const EC_POINT *pub_key, const EC_KEY *ecdh); +int ecdh_simple_compute_key(unsigned char **pout, size_t *poutlen, + const EC_POINT *pub_key, const EC_KEY *ecdh); struct ECDSA_SIG_st { BIGNUM *r; |