diff options
| author | djm <> | 2012-10-13 21:23:50 +0000 |
|---|---|---|
| committer | djm <> | 2012-10-13 21:23:50 +0000 |
| commit | 228cae30b117c2493f69ad3c195341cd6ec8d430 (patch) | |
| tree | 29ff00b10d52c0978077c4fd83c33b065bade73e /src/lib/libcrypto/asn1/x_pubkey.c | |
| parent | 731838c66b52c0ae5888333005b74115a620aa96 (diff) | |
| download | openbsd-228cae30b117c2493f69ad3c195341cd6ec8d430.tar.gz openbsd-228cae30b117c2493f69ad3c195341cd6ec8d430.tar.bz2 openbsd-228cae30b117c2493f69ad3c195341cd6ec8d430.zip | |
import OpenSSL-1.0.1c
Diffstat (limited to 'src/lib/libcrypto/asn1/x_pubkey.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/x_pubkey.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index d42b6a2c54..627ec87f9f 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
| @@ -171,7 +171,16 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) | |||
| 171 | goto error; | 171 | goto error; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | key->pkey = ret; | 174 | /* Check to see if another thread set key->pkey first */ |
| 175 | CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY); | ||
| 176 | if (key->pkey) | ||
| 177 | { | ||
| 178 | EVP_PKEY_free(ret); | ||
| 179 | ret = key->pkey; | ||
| 180 | } | ||
| 181 | else | ||
| 182 | key->pkey = ret; | ||
| 183 | CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); | ||
| 175 | CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); | 184 | CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); |
| 176 | 185 | ||
| 177 | return ret; | 186 | return ret; |
