From: tb Date: Wed, 5 Jan 2022 20:44:12 +0000 (+0000) Subject: Prepare to provide a number of RSA accessors X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e9d41195bd3fe30c62f0a6225bc180643e105fec;p=openbsd 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 --- diff --git a/lib/libcrypto/rsa/rsa.h b/lib/libcrypto/rsa/rsa.h index 78ac04cf96e..9dea6c37c05 100644 --- a/lib/libcrypto/rsa/rsa.h +++ b/lib/libcrypto/rsa/rsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa.h,v 1.51 2019/11/04 12:30:56 jsing Exp $ */ +/* $OpenBSD: rsa.h,v 1.52 2022/01/05 20:44:12 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -470,6 +470,17 @@ void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); +#if defined(LIBRESSL_OPAQUE_RSA) || defined(LIBRESSL_CRYPTO_INTERNAL) +const BIGNUM *RSA_get0_n(const RSA *r); +const BIGNUM *RSA_get0_e(const RSA *r); +const BIGNUM *RSA_get0_d(const RSA *r); +const BIGNUM *RSA_get0_p(const RSA *r); +const BIGNUM *RSA_get0_q(const RSA *r); +const BIGNUM *RSA_get0_dmp1(const RSA *r); +const BIGNUM *RSA_get0_dmq1(const RSA *r); +const BIGNUM *RSA_get0_iqmp(const RSA *r); +const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); +#endif void RSA_clear_flags(RSA *r, int flags); int RSA_test_flags(const RSA *r, int flags); void RSA_set_flags(RSA *r, int flags); diff --git a/lib/libcrypto/rsa/rsa_lib.c b/lib/libcrypto/rsa/rsa_lib.c index 0b76aae3989..92b2f32d613 100644 --- a/lib/libcrypto/rsa/rsa_lib.c +++ b/lib/libcrypto/rsa/rsa_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_lib.c,v 1.40 2020/01/17 10:40:03 inoguchi Exp $ */ +/* $OpenBSD: rsa_lib.c,v 1.41 2022/01/05 20:44:12 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -336,6 +336,60 @@ RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) return 1; } +const BIGNUM * +RSA_get0_n(const RSA *r) +{ + return r->n; +} + +const BIGNUM * +RSA_get0_e(const RSA *r) +{ + return r->e; +} + +const BIGNUM * +RSA_get0_d(const RSA *r) +{ + return r->d; +} + +const BIGNUM * +RSA_get0_p(const RSA *r) +{ + return r->p; +} + +const BIGNUM * +RSA_get0_q(const RSA *r) +{ + return r->q; +} + +const BIGNUM * +RSA_get0_dmp1(const RSA *r) +{ + return r->dmp1; +} + +const BIGNUM * +RSA_get0_dmq1(const RSA *r) +{ + return r->dmq1; +} + +const BIGNUM * +RSA_get0_iqmp(const RSA *r) +{ + return r->iqmp; +} + +const RSA_PSS_PARAMS * +RSA_get0_pss_params(const RSA *r) +{ + return r->pss; +} + void RSA_clear_flags(RSA *r, int flags) {