summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_lib.c
diff options
context:
space:
mode:
authortb <>2018-02-17 13:47:36 +0000
committertb <>2018-02-17 13:47:36 +0000
commite1b05f77869d986a0aee6aa4076f008274e98d27 (patch)
treef0cc2d3dd2a3842c40f792227fe86c133a668af2 /src/lib/libcrypto/rsa/rsa_lib.c
parent0c7165079d7f7c944f8c516a5bb23a71b674c170 (diff)
downloadopenbsd-e1b05f77869d986a0aee6aa4076f008274e98d27.tar.gz
openbsd-e1b05f77869d986a0aee6aa4076f008274e98d27.tar.bz2
openbsd-e1b05f77869d986a0aee6aa4076f008274e98d27.zip
Provide further parts of the OpenSSL 1.1 API: {DH,DSA}_get0_{key,pqg}(),
EVP_PKEY_get0_{DH,DSA,RSA}(), RSA_{g,s}et0_key(). ok jsing
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_lib.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_lib.c35
1 files changed, 34 insertions, 1 deletions
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
260int
261RSA_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
282void
283RSA_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}