summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2018-02-18 12:55:32 +0000
committertb <>2018-02-18 12:55:32 +0000
commit751bc66947637a9abd1a17c25842d5ac30445e33 (patch)
tree60fbf0cd380d668ed3d2b973bfbc5e7f261824c4
parent57e413e44047c6de5afd81409c4917b1071cb777 (diff)
downloadopenbsd-751bc66947637a9abd1a17c25842d5ac30445e33.tar.gz
openbsd-751bc66947637a9abd1a17c25842d5ac30445e33.tar.bz2
openbsd-751bc66947637a9abd1a17c25842d5ac30445e33.zip
Use usual order of RSA_{g,s}et0_key().
ok jsing
-rw-r--r--src/lib/libcrypto/rsa/rsa.h4
-rw-r--r--src/lib/libcrypto/rsa/rsa_lib.c23
2 files changed, 14 insertions, 13 deletions
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index 51b06ba6aa..6cce38d35c 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.34 2018/02/18 12:53:46 tb Exp $ */ 1/* $OpenBSD: rsa.h,v 1.35 2018/02/18 12:55:32 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 *
@@ -396,9 +396,9 @@ int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
396int RSA_set_ex_data(RSA *r, int idx, void *arg); 396int RSA_set_ex_data(RSA *r, int idx, void *arg);
397void *RSA_get_ex_data(const RSA *r, int idx); 397void *RSA_get_ex_data(const RSA *r, int idx);
398 398
399int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
400void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, 399void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
401 const BIGNUM **d); 400 const BIGNUM **d);
401int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
402void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); 402void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
403int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); 403int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
404 404
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c
index c31aa935b7..379f4cbe34 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.33 2018/02/18 12:53:46 tb Exp $ */ 1/* $OpenBSD: rsa_lib.c,v 1.34 2018/02/18 12:55:32 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,17 @@ RSA_get_ex_data(const RSA *r, int idx)
257 return CRYPTO_get_ex_data(&r->ex_data, idx); 257 return CRYPTO_get_ex_data(&r->ex_data, idx);
258} 258}
259 259
260void
261RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
262{
263 if (n != NULL)
264 *n = r->n;
265 if (e != NULL)
266 *e = r->e;
267 if (d != NULL)
268 *d = r->d;
269}
270
260int 271int
261RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) 272RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
262{ 273{
@@ -279,16 +290,6 @@ RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
279 return 1; 290 return 1;
280} 291}
281 292
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}
292 293
293void 294void
294RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) 295RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)