aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ecdh/ech_lib.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2013-02-13 22:15:56 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2013-02-13 22:15:56 +0000
commitf3b8b34a882a09ff73facc4c6ce7cdcad59b8656 (patch)
tree79d6c350c61cb2c6055ac3b21d94c152a09b44ff /crypto/ecdh/ech_lib.c
parent451758c6115bda75e299808f60c4403de86398a8 (diff)
downloadsrc-f3b8b34a882a09ff73facc4c6ce7cdcad59b8656.tar.gz
src-f3b8b34a882a09ff73facc4c6ce7cdcad59b8656.zip
Import OpenSSL 1.0.1e.vendor/openssl/1.0.1e
Approved by: secteam (delphij, simon), benl (silence)
Notes
Notes: svn path=/vendor-crypto/openssl/dist/; revision=246769 svn path=/vendor-crypto/openssl/1.0.1e/; revision=246770; tag=vendor/openssl/1.0.1e
Diffstat (limited to 'crypto/ecdh/ech_lib.c')
-rw-r--r--crypto/ecdh/ech_lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/crypto/ecdh/ech_lib.c b/crypto/ecdh/ech_lib.c
index dadbfd3c49f5..0644431b756a 100644
--- a/crypto/ecdh/ech_lib.c
+++ b/crypto/ecdh/ech_lib.c
@@ -222,8 +222,15 @@ ECDH_DATA *ecdh_check(EC_KEY *key)
ecdh_data = (ECDH_DATA *)ecdh_data_new();
if (ecdh_data == NULL)
return NULL;
- EC_KEY_insert_key_method_data(key, (void *)ecdh_data,
- ecdh_data_dup, ecdh_data_free, ecdh_data_free);
+ data = EC_KEY_insert_key_method_data(key, (void *)ecdh_data,
+ ecdh_data_dup, ecdh_data_free, ecdh_data_free);
+ if (data != NULL)
+ {
+ /* Another thread raced us to install the key_method
+ * data and won. */
+ ecdh_data_free(ecdh_data);
+ ecdh_data = (ECDH_DATA *)data;
+ }
}
else
ecdh_data = (ECDH_DATA *)data;