diff options
author | tb <> | 2022-01-05 20:44:12 +0000 |
---|---|---|
committer | tb <> | 2022-01-05 20:44:12 +0000 |
commit | eec5bb5de6de08ddb9bb4b14098bdf74403b758a (patch) | |
tree | 3114e081ea1980d87910f9f2a812d86056c9180b /src | |
parent | 46f215caacbd231e0103614978e9720eb4c4a993 (diff) | |
download | openbsd-eec5bb5de6de08ddb9bb4b14098bdf74403b758a.tar.gz openbsd-eec5bb5de6de08ddb9bb4b14098bdf74403b758a.tar.bz2 openbsd-eec5bb5de6de08ddb9bb4b14098bdf74403b758a.zip |
Prepare to provide a number of RSA accessors
This adds RSA_get0_{n,e,d,p,q,dmp1,dmq1,iqmp,pss_params}() which will
be exposed in the upcoming bump.
ok inoguchi jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa.h | 13 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 56 |
2 files changed, 67 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index 78ac04cf96..9dea6c37c0 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.51 2019/11/04 12:30:56 jsing Exp $ */ | 1 | /* $OpenBSD: rsa.h,v 1.52 2022/01/05 20:44:12 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 | * |
@@ -470,6 +470,17 @@ void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, | |||
470 | int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); | 470 | int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); |
471 | void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); | 471 | void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); |
472 | int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); | 472 | int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); |
473 | #if defined(LIBRESSL_OPAQUE_RSA) || defined(LIBRESSL_CRYPTO_INTERNAL) | ||
474 | const BIGNUM *RSA_get0_n(const RSA *r); | ||
475 | const BIGNUM *RSA_get0_e(const RSA *r); | ||
476 | const BIGNUM *RSA_get0_d(const RSA *r); | ||
477 | const BIGNUM *RSA_get0_p(const RSA *r); | ||
478 | const BIGNUM *RSA_get0_q(const RSA *r); | ||
479 | const BIGNUM *RSA_get0_dmp1(const RSA *r); | ||
480 | const BIGNUM *RSA_get0_dmq1(const RSA *r); | ||
481 | const BIGNUM *RSA_get0_iqmp(const RSA *r); | ||
482 | const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); | ||
483 | #endif | ||
473 | void RSA_clear_flags(RSA *r, int flags); | 484 | void RSA_clear_flags(RSA *r, int flags); |
474 | int RSA_test_flags(const RSA *r, int flags); | 485 | int RSA_test_flags(const RSA *r, int flags); |
475 | void RSA_set_flags(RSA *r, int flags); | 486 | void RSA_set_flags(RSA *r, int flags); |
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 0b76aae398..92b2f32d61 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.40 2020/01/17 10:40:03 inoguchi Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.41 2022/01/05 20:44:12 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 | * |
@@ -336,6 +336,60 @@ RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) | |||
336 | return 1; | 336 | return 1; |
337 | } | 337 | } |
338 | 338 | ||
339 | const BIGNUM * | ||
340 | RSA_get0_n(const RSA *r) | ||
341 | { | ||
342 | return r->n; | ||
343 | } | ||
344 | |||
345 | const BIGNUM * | ||
346 | RSA_get0_e(const RSA *r) | ||
347 | { | ||
348 | return r->e; | ||
349 | } | ||
350 | |||
351 | const BIGNUM * | ||
352 | RSA_get0_d(const RSA *r) | ||
353 | { | ||
354 | return r->d; | ||
355 | } | ||
356 | |||
357 | const BIGNUM * | ||
358 | RSA_get0_p(const RSA *r) | ||
359 | { | ||
360 | return r->p; | ||
361 | } | ||
362 | |||
363 | const BIGNUM * | ||
364 | RSA_get0_q(const RSA *r) | ||
365 | { | ||
366 | return r->q; | ||
367 | } | ||
368 | |||
369 | const BIGNUM * | ||
370 | RSA_get0_dmp1(const RSA *r) | ||
371 | { | ||
372 | return r->dmp1; | ||
373 | } | ||
374 | |||
375 | const BIGNUM * | ||
376 | RSA_get0_dmq1(const RSA *r) | ||
377 | { | ||
378 | return r->dmq1; | ||
379 | } | ||
380 | |||
381 | const BIGNUM * | ||
382 | RSA_get0_iqmp(const RSA *r) | ||
383 | { | ||
384 | return r->iqmp; | ||
385 | } | ||
386 | |||
387 | const RSA_PSS_PARAMS * | ||
388 | RSA_get0_pss_params(const RSA *r) | ||
389 | { | ||
390 | return r->pss; | ||
391 | } | ||
392 | |||
339 | void | 393 | void |
340 | RSA_clear_flags(RSA *r, int flags) | 394 | RSA_clear_flags(RSA *r, int flags) |
341 | { | 395 | { |