diff options
author | Matt Caswell <matt@openssl.org> | 2014-11-19 20:09:19 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2014-11-20 15:21:37 +0000 |
commit | 6f71d7da640b5cd5238b6816e0819eec460bee69 (patch) | |
tree | d63e39be99f5b5cf9135b1389d61990ce6be959a /crypto | |
parent | 0b9e82763f1e00abb4217b714be976d978829976 (diff) |
When using EVP_PKEY_derive with a KDF set, a negative error from
ECDH_compute_key is silently ignored and the KDF is run on duff data
Thanks to github user tomykaira for the suggested fix.
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
(cherry picked from commit 8d02bebddf4b69f7f260adfed4be4f498dcbd16c)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ec/ec_pmeth.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/ec/ec_pmeth.c b/crypto/ec/ec_pmeth.c index 81ad4d499a..e66e690827 100644 --- a/crypto/ec/ec_pmeth.c +++ b/crypto/ec/ec_pmeth.c @@ -244,8 +244,8 @@ static int pkey_ec_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen) outlen = *keylen; ret = ECDH_compute_key(key, outlen, pubkey, eckey, 0); - if (ret < 0) - return ret; + if (ret <= 0) + return 0; *keylen = ret; return 1; } |