summaryrefslogtreecommitdiffstats
path: root/crypto/rsa/rsa_ossl.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-04-07 12:39:02 -0400
committerRich Salz <rsalz@openssl.org>2017-05-27 13:07:07 -0400
commitb4d6f713d6c5b55a2887d79435490a503da39ae5 (patch)
tree1f7933ed63dec011d5728e369f34b5bc1c317347 /crypto/rsa/rsa_ossl.c
parentab6abae63c701d6d3a5760d881b9bee235620e4b (diff)
Make default_method mostly compile-time
Document thread-safety issues Cherry-pick from 076fc55527a1499391fa6de109c8387895199ee9 but keeps the RSA_null method. Reviewed-by: Geoff Thorpe <geoff@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3146)
Diffstat (limited to 'crypto/rsa/rsa_ossl.c')
-rw-r--r--crypto/rsa/rsa_ossl.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/crypto/rsa/rsa_ossl.c b/crypto/rsa/rsa_ossl.c
index 782606645b..793e2f9c87 100644
--- a/crypto/rsa/rsa_ossl.c
+++ b/crypto/rsa/rsa_ossl.c
@@ -11,8 +11,6 @@
#include "internal/bn_int.h"
#include "rsa_locl.h"
-#ifndef RSA_NULL
-
static int rsa_ossl_public_encrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
static int rsa_ossl_private_encrypt(int flen, const unsigned char *from,
@@ -26,7 +24,7 @@ static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa,
static int rsa_ossl_init(RSA *rsa);
static int rsa_ossl_finish(RSA *rsa);
static RSA_METHOD rsa_pkcs1_ossl_meth = {
- "OpenSSL PKCS#1 RSA (from Eric Young)",
+ "OpenSSL PKCS#1 RSA",
rsa_ossl_public_encrypt,
rsa_ossl_public_decrypt, /* signature verification */
rsa_ossl_private_encrypt, /* signing */
@@ -43,6 +41,18 @@ static RSA_METHOD rsa_pkcs1_ossl_meth = {
NULL /* rsa_keygen */
};
+static const RSA_METHOD *default_RSA_meth = &rsa_pkcs1_ossl_meth;
+
+void RSA_set_default_method(const RSA_METHOD *meth)
+{
+ default_RSA_meth = meth;
+}
+
+const RSA_METHOD *RSA_get_default_method(void)
+{
+ return default_RSA_meth;
+}
+
const RSA_METHOD *RSA_PKCS1_OpenSSL(void)
{
return &rsa_pkcs1_ossl_meth;
@@ -786,5 +796,3 @@ static int rsa_ossl_finish(RSA *rsa)
BN_MONT_CTX_free(rsa->_method_mod_q);
return (1);
}
-
-#endif