summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/ecdsa/ecs_lib.c
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-04-13 15:16:32 +0000
committermiod <miod@openbsd.org>2014-04-13 15:16:32 +0000
commit9eac5592c81620ead272fa71be9a79e0e24176fe (patch)
treebe26e8653cf5d8c7b93aa32a3203924090fc58ac /lib/libcrypto/ecdsa/ecs_lib.c
parentFix a badly worded debug message that implied the entire machine was going (diff)
downloadwireguard-openbsd-9eac5592c81620ead272fa71be9a79e0e24176fe.tar.xz
wireguard-openbsd-9eac5592c81620ead272fa71be9a79e0e24176fe.zip
Import OpenSSL 1.0.1g
Diffstat (limited to 'lib/libcrypto/ecdsa/ecs_lib.c')
-rw-r--r--lib/libcrypto/ecdsa/ecs_lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libcrypto/ecdsa/ecs_lib.c b/lib/libcrypto/ecdsa/ecs_lib.c
index e477da430ba..814a6bf4046 100644
--- a/lib/libcrypto/ecdsa/ecs_lib.c
+++ b/lib/libcrypto/ecdsa/ecs_lib.c
@@ -200,8 +200,15 @@ ECDSA_DATA *ecdsa_check(EC_KEY *key)
ecdsa_data = (ECDSA_DATA *)ecdsa_data_new();
if (ecdsa_data == NULL)
return NULL;
- EC_KEY_insert_key_method_data(key, (void *)ecdsa_data,
- ecdsa_data_dup, ecdsa_data_free, ecdsa_data_free);
+ data = EC_KEY_insert_key_method_data(key, (void *)ecdsa_data,
+ ecdsa_data_dup, ecdsa_data_free, ecdsa_data_free);
+ if (data != NULL)
+ {
+ /* Another thread raced us to install the key_method
+ * data and won. */
+ ecdsa_data_free(ecdsa_data);
+ ecdsa_data = (ECDSA_DATA *)data;
+ }
}
else
ecdsa_data = (ECDSA_DATA *)data;