diff options
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_lib.c')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 2a73364e70..c31aa935b7 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.32 2018/02/17 13:47:36 tb Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.33 2018/02/18 12:53:46 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 | * |
| @@ -289,3 +289,30 @@ RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) | |||
| 289 | if (d != NULL) | 289 | if (d != NULL) |
| 290 | *d = r->d; | 290 | *d = r->d; |
| 291 | } | 291 | } |
| 292 | |||
| 293 | void | ||
| 294 | RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) | ||
| 295 | { | ||
| 296 | if (p != NULL) | ||
| 297 | *p = r->p; | ||
| 298 | if (q != NULL) | ||
| 299 | *q = r->q; | ||
| 300 | } | ||
| 301 | |||
| 302 | int | ||
| 303 | RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) | ||
| 304 | { | ||
| 305 | if ((r->p == NULL && p == NULL) || (r->q == NULL && q == NULL)) | ||
| 306 | return 0; | ||
| 307 | |||
| 308 | if (p != NULL) { | ||
| 309 | BN_free(r->p); | ||
| 310 | r->p = p; | ||
| 311 | } | ||
| 312 | if (q != NULL) { | ||
| 313 | BN_free(r->q); | ||
| 314 | r->q = q; | ||
| 315 | } | ||
| 316 | |||
| 317 | return 1; | ||
| 318 | } | ||
