diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/Symbols.list | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/dh/dh.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/dh/dh_lib.c | 22 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_lib.c | 22 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/evp.h | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/p_lib.c | 67 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 35 |
9 files changed, 155 insertions, 29 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index d9cbe853a9..99930ffa17 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
| @@ -736,6 +736,8 @@ DH_free | |||
| 736 | DH_generate_key | 736 | DH_generate_key |
| 737 | DH_generate_parameters | 737 | DH_generate_parameters |
| 738 | DH_generate_parameters_ex | 738 | DH_generate_parameters_ex |
| 739 | DH_get0_key | ||
| 740 | DH_get0_pqg | ||
| 739 | DH_get_default_method | 741 | DH_get_default_method |
| 740 | DH_get_ex_data | 742 | DH_get_ex_data |
| 741 | DH_get_ex_new_index | 743 | DH_get_ex_new_index |
| @@ -776,6 +778,8 @@ DSA_free | |||
| 776 | DSA_generate_key | 778 | DSA_generate_key |
| 777 | DSA_generate_parameters | 779 | DSA_generate_parameters |
| 778 | DSA_generate_parameters_ex | 780 | DSA_generate_parameters_ex |
| 781 | DSA_get0_key | ||
| 782 | DSA_get0_pqg | ||
| 779 | DSA_get_default_method | 783 | DSA_get_default_method |
| 780 | DSA_get_ex_data | 784 | DSA_get_ex_data |
| 781 | DSA_get_ex_new_index | 785 | DSA_get_ex_new_index |
| @@ -1338,9 +1342,12 @@ EVP_PKEY_encrypt_old | |||
| 1338 | EVP_PKEY_free | 1342 | EVP_PKEY_free |
| 1339 | EVP_PKEY_get0 | 1343 | EVP_PKEY_get0 |
| 1340 | EVP_PKEY_get0_asn1 | 1344 | EVP_PKEY_get0_asn1 |
| 1345 | EVP_PKEY_get0_DH | ||
| 1341 | EVP_PKEY_get1_DH | 1346 | EVP_PKEY_get1_DH |
| 1347 | EVP_PKEY_get0_DSA | ||
| 1342 | EVP_PKEY_get1_DSA | 1348 | EVP_PKEY_get1_DSA |
| 1343 | EVP_PKEY_get1_EC_KEY | 1349 | EVP_PKEY_get1_EC_KEY |
| 1350 | EVP_PKEY_get0_RSA | ||
| 1344 | EVP_PKEY_get1_RSA | 1351 | EVP_PKEY_get1_RSA |
| 1345 | EVP_PKEY_get_attr | 1352 | EVP_PKEY_get_attr |
| 1346 | EVP_PKEY_get_attr_by_NID | 1353 | EVP_PKEY_get_attr_by_NID |
| @@ -2185,6 +2192,7 @@ RSA_flags | |||
| 2185 | RSA_free | 2192 | RSA_free |
| 2186 | RSA_generate_key | 2193 | RSA_generate_key |
| 2187 | RSA_generate_key_ex | 2194 | RSA_generate_key_ex |
| 2195 | RSA_get0_key | ||
| 2188 | RSA_get_default_method | 2196 | RSA_get_default_method |
| 2189 | RSA_get_ex_data | 2197 | RSA_get_ex_data |
| 2190 | RSA_get_ex_new_index | 2198 | RSA_get_ex_new_index |
| @@ -2209,6 +2217,7 @@ RSA_private_decrypt | |||
| 2209 | RSA_private_encrypt | 2217 | RSA_private_encrypt |
| 2210 | RSA_public_decrypt | 2218 | RSA_public_decrypt |
| 2211 | RSA_public_encrypt | 2219 | RSA_public_encrypt |
| 2220 | RSA_set0_key | ||
| 2212 | RSA_set_default_method | 2221 | RSA_set_default_method |
| 2213 | RSA_set_ex_data | 2222 | RSA_set_ex_data |
| 2214 | RSA_set_method | 2223 | RSA_set_method |
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h index 920af3b92d..61c7d6c873 100644 --- a/src/lib/libcrypto/dh/dh.h +++ b/src/lib/libcrypto/dh/dh.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh.h,v 1.18 2016/11/04 18:35:30 jsing Exp $ */ | 1 | /* $OpenBSD: dh.h,v 1.19 2018/02/17 13:47:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -188,6 +188,10 @@ int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |||
| 188 | int DH_set_ex_data(DH *d, int idx, void *arg); | 188 | int DH_set_ex_data(DH *d, int idx, void *arg); |
| 189 | void *DH_get_ex_data(DH *d, int idx); | 189 | void *DH_get_ex_data(DH *d, int idx); |
| 190 | 190 | ||
| 191 | void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, | ||
| 192 | const BIGNUM **g); | ||
| 193 | void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key); | ||
| 194 | |||
| 191 | /* Deprecated version */ | 195 | /* Deprecated version */ |
| 192 | #ifndef OPENSSL_NO_DEPRECATED | 196 | #ifndef OPENSSL_NO_DEPRECATED |
| 193 | DH * DH_generate_parameters(int prime_len,int generator, | 197 | DH * DH_generate_parameters(int prime_len,int generator, |
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c index d45dc17168..5a54ca88da 100644 --- a/src/lib/libcrypto/dh/dh_lib.c +++ b/src/lib/libcrypto/dh/dh_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dh_lib.c,v 1.22 2017/01/29 17:49:22 beck Exp $ */ | 1 | /* $OpenBSD: dh_lib.c,v 1.23 2018/02/17 13:47:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -239,3 +239,23 @@ DH_size(const DH *dh) | |||
| 239 | { | 239 | { |
| 240 | return BN_num_bytes(dh->p); | 240 | return BN_num_bytes(dh->p); |
| 241 | } | 241 | } |
| 242 | |||
| 243 | void | ||
| 244 | DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) | ||
| 245 | { | ||
| 246 | if (p != NULL) | ||
| 247 | *p = dh->p; | ||
| 248 | if (q != NULL) | ||
| 249 | *q = dh->q; | ||
| 250 | if (g != NULL) | ||
| 251 | *g = dh->g; | ||
| 252 | } | ||
| 253 | |||
| 254 | void | ||
| 255 | DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) | ||
| 256 | { | ||
| 257 | if (pub_key != NULL) | ||
| 258 | *pub_key = dh->pub_key; | ||
| 259 | if (priv_key != NULL) | ||
| 260 | *priv_key = dh->priv_key; | ||
| 261 | } | ||
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 6ddd4c35d5..f990ad52f0 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa.h,v 1.22 2016/11/04 18:35:30 jsing Exp $ */ | 1 | /* $OpenBSD: dsa.h,v 1.23 2018/02/17 13:47:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -257,6 +257,10 @@ int DSA_print_fp(FILE *bp, const DSA *x, int off); | |||
| 257 | DH *DSA_dup_DH(const DSA *r); | 257 | DH *DSA_dup_DH(const DSA *r); |
| 258 | #endif | 258 | #endif |
| 259 | 259 | ||
| 260 | void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, | ||
| 261 | const BIGNUM **g); | ||
| 262 | void DSA_get0_key(const DH *d, const BIGNUM **pub_key, const BIGNUM **priv_key); | ||
| 263 | |||
| 260 | #define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ | 264 | #define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ |
| 261 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ | 265 | EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ |
| 262 | EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) | 266 | EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) |
diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c index 58af74889c..ae9155c9f8 100644 --- a/src/lib/libcrypto/dsa/dsa_lib.c +++ b/src/lib/libcrypto/dsa/dsa_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_lib.c,v 1.23 2017/01/29 17:49:22 beck Exp $ */ | 1 | /* $OpenBSD: dsa_lib.c,v 1.24 2018/02/17 13:47:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -303,3 +303,23 @@ err: | |||
| 303 | return NULL; | 303 | return NULL; |
| 304 | } | 304 | } |
| 305 | #endif | 305 | #endif |
| 306 | |||
| 307 | void | ||
| 308 | DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) | ||
| 309 | { | ||
| 310 | if (p != NULL) | ||
| 311 | *p = d->p; | ||
| 312 | if (q != NULL) | ||
| 313 | *q = d->q; | ||
| 314 | if (g != NULL) | ||
| 315 | *g = d->g; | ||
| 316 | } | ||
| 317 | |||
| 318 | void | ||
| 319 | DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) | ||
| 320 | { | ||
| 321 | if (pub_key != NULL) | ||
| 322 | *pub_key = d->pub_key; | ||
| 323 | if (priv_key != NULL) | ||
| 324 | *priv_key = d->priv_key; | ||
| 325 | } | ||
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 09df7db64b..c8da89844d 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp.h,v 1.54 2018/02/14 16:40:42 jsing Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.55 2018/02/17 13:47:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -870,18 +870,21 @@ void *EVP_PKEY_get0(EVP_PKEY *pkey); | |||
| 870 | 870 | ||
| 871 | #ifndef OPENSSL_NO_RSA | 871 | #ifndef OPENSSL_NO_RSA |
| 872 | struct rsa_st; | 872 | struct rsa_st; |
| 873 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); | 873 | struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); |
| 874 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); | 874 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); |
| 875 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); | ||
| 875 | #endif | 876 | #endif |
| 876 | #ifndef OPENSSL_NO_DSA | 877 | #ifndef OPENSSL_NO_DSA |
| 877 | struct dsa_st; | 878 | struct dsa_st; |
| 878 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); | 879 | struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); |
| 879 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); | 880 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); |
| 881 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); | ||
| 880 | #endif | 882 | #endif |
| 881 | #ifndef OPENSSL_NO_DH | 883 | #ifndef OPENSSL_NO_DH |
| 882 | struct dh_st; | 884 | struct dh_st; |
| 883 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); | 885 | struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); |
| 884 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); | 886 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); |
| 887 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); | ||
| 885 | #endif | 888 | #endif |
| 886 | #ifndef OPENSSL_NO_EC | 889 | #ifndef OPENSSL_NO_EC |
| 887 | struct ec_key_st; | 890 | struct ec_key_st; |
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index e001755ef1..3cd1bf3b34 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p_lib.c,v 1.18 2018/02/14 16:40:42 jsing Exp $ */ | 1 | /* $OpenBSD: p_lib.c,v 1.19 2018/02/17 13:47:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -286,13 +286,14 @@ EVP_PKEY_get0(EVP_PKEY *pkey) | |||
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | #ifndef OPENSSL_NO_RSA | 288 | #ifndef OPENSSL_NO_RSA |
| 289 | int | 289 | RSA * |
| 290 | EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key) | 290 | EVP_PKEY_get0_RSA(EVP_PKEY *pkey) |
| 291 | { | 291 | { |
| 292 | int ret = EVP_PKEY_assign_RSA(pkey, key); | 292 | if (pkey->type != EVP_PKEY_RSA) { |
| 293 | if (ret) | 293 | EVPerror(EVP_R_EXPECTING_AN_RSA_KEY); |
| 294 | RSA_up_ref(key); | 294 | return NULL; |
| 295 | return ret; | 295 | } |
| 296 | return pkey->pkey.rsa; | ||
| 296 | } | 297 | } |
| 297 | 298 | ||
| 298 | RSA * | 299 | RSA * |
| @@ -305,17 +306,27 @@ EVP_PKEY_get1_RSA(EVP_PKEY *pkey) | |||
| 305 | RSA_up_ref(pkey->pkey.rsa); | 306 | RSA_up_ref(pkey->pkey.rsa); |
| 306 | return pkey->pkey.rsa; | 307 | return pkey->pkey.rsa; |
| 307 | } | 308 | } |
| 308 | #endif | ||
| 309 | 309 | ||
| 310 | #ifndef OPENSSL_NO_DSA | ||
| 311 | int | 310 | int |
| 312 | EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key) | 311 | EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key) |
| 313 | { | 312 | { |
| 314 | int ret = EVP_PKEY_assign_DSA(pkey, key); | 313 | int ret = EVP_PKEY_assign_RSA(pkey, key); |
| 315 | if (ret) | 314 | if (ret) |
| 316 | DSA_up_ref(key); | 315 | RSA_up_ref(key); |
| 317 | return ret; | 316 | return ret; |
| 318 | } | 317 | } |
| 318 | #endif | ||
| 319 | |||
| 320 | #ifndef OPENSSL_NO_DSA | ||
| 321 | DSA * | ||
| 322 | EVP_PKEY_get0_DSA(EVP_PKEY *pkey) | ||
| 323 | { | ||
| 324 | if (pkey->type != EVP_PKEY_DSA) { | ||
| 325 | EVPerror(EVP_R_EXPECTING_A_DSA_KEY); | ||
| 326 | return NULL; | ||
| 327 | } | ||
| 328 | return pkey->pkey.dsa; | ||
| 329 | } | ||
| 319 | 330 | ||
| 320 | DSA * | 331 | DSA * |
| 321 | EVP_PKEY_get1_DSA(EVP_PKEY *pkey) | 332 | EVP_PKEY_get1_DSA(EVP_PKEY *pkey) |
| @@ -327,6 +338,15 @@ EVP_PKEY_get1_DSA(EVP_PKEY *pkey) | |||
| 327 | DSA_up_ref(pkey->pkey.dsa); | 338 | DSA_up_ref(pkey->pkey.dsa); |
| 328 | return pkey->pkey.dsa; | 339 | return pkey->pkey.dsa; |
| 329 | } | 340 | } |
| 341 | |||
| 342 | int | ||
| 343 | EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key) | ||
| 344 | { | ||
| 345 | int ret = EVP_PKEY_assign_DSA(pkey, key); | ||
| 346 | if (ret) | ||
| 347 | DSA_up_ref(key); | ||
| 348 | return ret; | ||
| 349 | } | ||
| 330 | #endif | 350 | #endif |
| 331 | 351 | ||
| 332 | #ifndef OPENSSL_NO_EC | 352 | #ifndef OPENSSL_NO_EC |
| @@ -354,14 +374,14 @@ EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) | |||
| 354 | 374 | ||
| 355 | 375 | ||
| 356 | #ifndef OPENSSL_NO_DH | 376 | #ifndef OPENSSL_NO_DH |
| 357 | 377 | DH * | |
| 358 | int | 378 | EVP_PKEY_get0_DH(EVP_PKEY *pkey) |
| 359 | EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key) | ||
| 360 | { | 379 | { |
| 361 | int ret = EVP_PKEY_assign_DH(pkey, key); | 380 | if (pkey->type != EVP_PKEY_DH) { |
| 362 | if (ret) | 381 | EVPerror(EVP_R_EXPECTING_A_DH_KEY); |
| 363 | DH_up_ref(key); | 382 | return NULL; |
| 364 | return ret; | 383 | } |
| 384 | return pkey->pkey.dh; | ||
| 365 | } | 385 | } |
| 366 | 386 | ||
| 367 | DH * | 387 | DH * |
| @@ -374,6 +394,15 @@ EVP_PKEY_get1_DH(EVP_PKEY *pkey) | |||
| 374 | DH_up_ref(pkey->pkey.dh); | 394 | DH_up_ref(pkey->pkey.dh); |
| 375 | return pkey->pkey.dh; | 395 | return pkey->pkey.dh; |
| 376 | } | 396 | } |
| 397 | |||
| 398 | int | ||
| 399 | EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key) | ||
| 400 | { | ||
| 401 | int ret = EVP_PKEY_assign_DH(pkey, key); | ||
| 402 | if (ret) | ||
| 403 | DH_up_ref(key); | ||
| 404 | return ret; | ||
| 405 | } | ||
| 377 | #endif | 406 | #endif |
| 378 | 407 | ||
| 379 | int | 408 | int |
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index 7476a1164a..7d4bd838c5 100644 --- a/src/lib/libcrypto/rsa/rsa.h +++ b/src/lib/libcrypto/rsa/rsa.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa.h,v 1.31 2017/08/30 16:07:35 jsing Exp $ */ | 1 | /* $OpenBSD: rsa.h,v 1.32 2018/02/17 13:47:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -395,6 +395,10 @@ int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |||
| 395 | int RSA_set_ex_data(RSA *r, int idx, void *arg); | 395 | int RSA_set_ex_data(RSA *r, int idx, void *arg); |
| 396 | void *RSA_get_ex_data(const RSA *r, int idx); | 396 | void *RSA_get_ex_data(const RSA *r, int idx); |
| 397 | 397 | ||
| 398 | int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); | ||
| 399 | void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, | ||
| 400 | const BIGNUM **d); | ||
| 401 | |||
| 398 | RSA *RSAPublicKey_dup(RSA *rsa); | 402 | RSA *RSAPublicKey_dup(RSA *rsa); |
| 399 | RSA *RSAPrivateKey_dup(RSA *rsa); | 403 | RSA *RSAPrivateKey_dup(RSA *rsa); |
| 400 | 404 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 31ea418427..2a73364e70 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_lib.c,v 1.31 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.32 2018/02/17 13:47:36 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -256,3 +256,36 @@ RSA_get_ex_data(const RSA *r, int idx) | |||
| 256 | { | 256 | { |
| 257 | return CRYPTO_get_ex_data(&r->ex_data, idx); | 257 | return CRYPTO_get_ex_data(&r->ex_data, idx); |
| 258 | } | 258 | } |
| 259 | |||
| 260 | int | ||
| 261 | RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) | ||
| 262 | { | ||
| 263 | if ((r->n == NULL && n == NULL) || (r->e == NULL && e == NULL)) | ||
| 264 | return 0; | ||
| 265 | |||
| 266 | if (n != NULL) { | ||
| 267 | BN_free(r->n); | ||
| 268 | r->n = n; | ||
| 269 | } | ||
| 270 | if (e != NULL) { | ||
| 271 | BN_free(r->e); | ||
| 272 | r->e = e; | ||
| 273 | } | ||
| 274 | if (d != NULL) { | ||
| 275 | BN_free(r->d); | ||
| 276 | r->d = d; | ||
| 277 | } | ||
| 278 | |||
| 279 | return 1; | ||
| 280 | } | ||
| 281 | |||
| 282 | void | ||
| 283 | RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) | ||
| 284 | { | ||
| 285 | if (n != NULL) | ||
| 286 | *n = r->n; | ||
| 287 | if (e != NULL) | ||
| 288 | *e = r->e; | ||
| 289 | if (d != NULL) | ||
| 290 | *d = r->d; | ||
| 291 | } | ||
