diff options
author | beck <> | 2000-03-19 11:13:58 +0000 |
---|---|---|
committer | beck <> | 2000-03-19 11:13:58 +0000 |
commit | 796d609550df3a33fc11468741c5d2f6d3df4c11 (patch) | |
tree | 6c6d539061caa20372dad0ac4ddb1dfae2fbe7fe /src/lib/libcrypto/evp/p_lib.c | |
parent | 5be3114c1fd7e0dfea1e38d3abb4cbba75244419 (diff) | |
download | openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.gz openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.bz2 openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.zip |
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'src/lib/libcrypto/evp/p_lib.c')
-rw-r--r-- | src/lib/libcrypto/evp/p_lib.c | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index 3422b77de6..4cb387f8de 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c | |||
@@ -119,7 +119,7 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, EVP_PKEY *from) | |||
119 | 119 | ||
120 | if (EVP_PKEY_missing_parameters(from)) | 120 | if (EVP_PKEY_missing_parameters(from)) |
121 | { | 121 | { |
122 | EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARMATERS); | 122 | EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARAMETERS); |
123 | goto err; | 123 | goto err; |
124 | } | 124 | } |
125 | #ifndef NO_DSA | 125 | #ifndef NO_DSA |
@@ -202,8 +202,66 @@ int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key) | |||
202 | pkey->type=EVP_PKEY_type(type); | 202 | pkey->type=EVP_PKEY_type(type); |
203 | pkey->save_type=type; | 203 | pkey->save_type=type; |
204 | pkey->pkey.ptr=key; | 204 | pkey->pkey.ptr=key; |
205 | return(1); | 205 | return(key != NULL); |
206 | } | ||
207 | |||
208 | #ifndef NO_RSA | ||
209 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key) | ||
210 | { | ||
211 | int ret = EVP_PKEY_assign_RSA(pkey, key); | ||
212 | if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_RSA); | ||
213 | return ret; | ||
214 | } | ||
215 | |||
216 | RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey) | ||
217 | { | ||
218 | if(pkey->type != EVP_PKEY_RSA) { | ||
219 | EVPerr(EVP_F_EVP_PKEY_GET1_RSA, EVP_R_EXPECTING_AN_RSA_KEY); | ||
220 | return NULL; | ||
221 | } | ||
222 | CRYPTO_add(&pkey->pkey.rsa->references, 1, CRYPTO_LOCK_RSA); | ||
223 | return pkey->pkey.rsa; | ||
224 | } | ||
225 | #endif | ||
226 | |||
227 | #ifndef NO_DSA | ||
228 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key) | ||
229 | { | ||
230 | int ret = EVP_PKEY_assign_DSA(pkey, key); | ||
231 | if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_DSA); | ||
232 | return ret; | ||
233 | } | ||
234 | |||
235 | DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey) | ||
236 | { | ||
237 | if(pkey->type != EVP_PKEY_DSA) { | ||
238 | EVPerr(EVP_F_EVP_PKEY_GET1_DSA, EVP_R_EXPECTING_A_DSA_KEY); | ||
239 | return NULL; | ||
240 | } | ||
241 | CRYPTO_add(&pkey->pkey.dsa->references, 1, CRYPTO_LOCK_DSA); | ||
242 | return pkey->pkey.dsa; | ||
243 | } | ||
244 | #endif | ||
245 | |||
246 | #ifndef NO_DH | ||
247 | |||
248 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key) | ||
249 | { | ||
250 | int ret = EVP_PKEY_assign_DH(pkey, key); | ||
251 | if(ret) CRYPTO_add(&key->references, 1, CRYPTO_LOCK_DH); | ||
252 | return ret; | ||
253 | } | ||
254 | |||
255 | DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey) | ||
256 | { | ||
257 | if(pkey->type != EVP_PKEY_DH) { | ||
258 | EVPerr(EVP_F_EVP_PKEY_GET1_DH, EVP_R_EXPECTING_A_DH_KEY); | ||
259 | return NULL; | ||
206 | } | 260 | } |
261 | CRYPTO_add(&pkey->pkey.dh->references, 1, CRYPTO_LOCK_DH); | ||
262 | return pkey->pkey.dh; | ||
263 | } | ||
264 | #endif | ||
207 | 265 | ||
208 | int EVP_PKEY_type(int type) | 266 | int EVP_PKEY_type(int type) |
209 | { | 267 | { |
@@ -244,7 +302,7 @@ void EVP_PKEY_free(EVP_PKEY *x) | |||
244 | } | 302 | } |
245 | #endif | 303 | #endif |
246 | EVP_PKEY_free_it(x); | 304 | EVP_PKEY_free_it(x); |
247 | Free((char *)x); | 305 | Free(x); |
248 | } | 306 | } |
249 | 307 | ||
250 | static void EVP_PKEY_free_it(EVP_PKEY *x) | 308 | static void EVP_PKEY_free_it(EVP_PKEY *x) |