diff options
| author | tb <> | 2018-02-18 12:57:14 +0000 |
|---|---|---|
| committer | tb <> | 2018-02-18 12:57:14 +0000 |
| commit | 04e0c62f5644571d8d5db6b09704dd39d3be079c (patch) | |
| tree | 20539a532b21fc8bc7d31895c8d6d2491b26f98a /src/lib/libcrypto/rsa/rsa_lib.c | |
| parent | 219ea795adff53836ef84e874a6065fdba693551 (diff) | |
| download | openbsd-04e0c62f5644571d8d5db6b09704dd39d3be079c.tar.gz openbsd-04e0c62f5644571d8d5db6b09704dd39d3be079c.tar.bz2 openbsd-04e0c62f5644571d8d5db6b09704dd39d3be079c.zip | |
Provide RSA_{g,s}et0_crt_params()
ok jsing
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_lib.c')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 379f4cbe34..426c52f24a 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.34 2018/02/18 12:55:32 tb Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.35 2018/02/18 12:57:14 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 | * |
| @@ -290,6 +290,41 @@ RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) | |||
| 290 | return 1; | 290 | return 1; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | void | ||
| 294 | RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, | ||
| 295 | const BIGNUM **iqmp) | ||
| 296 | { | ||
| 297 | if (dmp1 != NULL) | ||
| 298 | *dmp1 = r->dmp1; | ||
| 299 | if (dmq1 != NULL) | ||
| 300 | *dmq1 = r->dmq1; | ||
| 301 | if (iqmp != NULL) | ||
| 302 | *iqmp = r->iqmp; | ||
| 303 | } | ||
| 304 | |||
| 305 | int | ||
| 306 | RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp) | ||
| 307 | { | ||
| 308 | if ((r->dmp1 == NULL && dmp1 == NULL) || | ||
| 309 | (r->dmq1 == NULL && dmq1 == NULL) || | ||
| 310 | (r->iqmp == NULL && iqmp == NULL)) | ||
| 311 | return 0; | ||
| 312 | |||
| 313 | if (dmp1 != NULL) { | ||
| 314 | BN_free(r->dmp1); | ||
| 315 | r->dmp1 = dmp1; | ||
| 316 | } | ||
| 317 | if (dmq1 != NULL) { | ||
| 318 | BN_free(r->dmq1); | ||
| 319 | r->dmq1 = dmq1; | ||
| 320 | } | ||
| 321 | if (iqmp != NULL) { | ||
| 322 | BN_free(r->iqmp); | ||
| 323 | r->iqmp = iqmp; | ||
| 324 | } | ||
| 325 | |||
| 326 | return 1; | ||
| 327 | } | ||
| 293 | 328 | ||
| 294 | void | 329 | void |
| 295 | RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) | 330 | RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) |
