summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_lib.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_lib.c37
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
293void
294RSA_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
305int
306RSA_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
294void 329void
295RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) 330RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)