diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/dh/dh_key.c | 12 | ||||
-rw-r--r-- | crypto/dh/dh_lib.c | 14 | ||||
-rw-r--r-- | crypto/dsa/dsa_lib.c | 14 | ||||
-rw-r--r-- | crypto/dsa/dsa_ossl.c | 12 | ||||
-rw-r--r-- | crypto/rsa/rsa_lib.c | 24 | ||||
-rw-r--r-- | crypto/rsa/rsa_ossl.c | 18 | ||||
-rw-r--r-- | crypto/ui/ui_lib.c | 15 | ||||
-rw-r--r-- | crypto/ui/ui_openssl.c | 12 |
8 files changed, 50 insertions, 71 deletions
diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c index 204e5a7a42..fce9ff47f3 100644 --- a/crypto/dh/dh_key.c +++ b/crypto/dh/dh_key.c @@ -56,11 +56,23 @@ static DH_METHOD dh_ossl = { NULL }; +static const DH_METHOD *default_DH_method = &dh_ossl; + const DH_METHOD *DH_OpenSSL(void) { return &dh_ossl; } +void DH_set_default_method(const DH_METHOD *meth) +{ + default_DH_method = meth; +} + +const DH_METHOD *DH_get_default_method(void) +{ + return default_DH_method; +} + static int generate_key(DH *dh) { int ok = 0; diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index adf1771514..344eab275d 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -13,20 +13,6 @@ #include "dh_locl.h" #include <openssl/engine.h> -static const DH_METHOD *default_DH_method = NULL; - -void DH_set_default_method(const DH_METHOD *meth) -{ - default_DH_method = meth; -} - -const DH_METHOD *DH_get_default_method(void) -{ - if (!default_DH_method) - default_DH_method = DH_OpenSSL(); - return default_DH_method; -} - int DH_set_method(DH *dh, const DH_METHOD *meth) { /* diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c index 42324c70fb..9598846e3b 100644 --- a/crypto/dsa/dsa_lib.c +++ b/crypto/dsa/dsa_lib.c @@ -17,20 +17,6 @@ #include <openssl/engine.h> #include <openssl/dh.h> -static const DSA_METHOD *default_DSA_method = NULL; - -void DSA_set_default_method(const DSA_METHOD *meth) -{ - default_DSA_method = meth; -} - -const DSA_METHOD *DSA_get_default_method(void) -{ - if (!default_DSA_method) - default_DSA_method = DSA_OpenSSL(); - return default_DSA_method; -} - DSA *DSA_new(void) { return DSA_new_method(NULL); diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c index f9f6a136fb..479337763b 100644 --- a/crypto/dsa/dsa_ossl.c +++ b/crypto/dsa/dsa_ossl.c @@ -41,6 +41,18 @@ static DSA_METHOD openssl_dsa_meth = { NULL }; +static const DSA_METHOD *default_DSA_method = &openssl_dsa_meth; + +void DSA_set_default_method(const DSA_METHOD *meth) +{ + default_DSA_method = meth; +} + +const DSA_METHOD *DSA_get_default_method(void) +{ + return default_DSA_method; +} + const DSA_METHOD *DSA_OpenSSL(void) { return &openssl_dsa_meth; diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index 48e9100a97..e1377a0690 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -15,31 +15,9 @@ #include <openssl/engine.h> #include "rsa_locl.h" -static const RSA_METHOD *default_RSA_meth = NULL; - RSA *RSA_new(void) { - RSA *r = RSA_new_method(NULL); - - return r; -} - -void RSA_set_default_method(const RSA_METHOD *meth) -{ - default_RSA_meth = meth; -} - -const RSA_METHOD *RSA_get_default_method(void) -{ - if (default_RSA_meth == NULL) { -#ifdef RSA_NULL - default_RSA_meth = RSA_null_method(); -#else - default_RSA_meth = RSA_PKCS1_OpenSSL(); -#endif - } - - return default_RSA_meth; + return RSA_new_method(NULL); } const RSA_METHOD *RSA_get_method(const RSA *rsa) 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 diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c index c06baa0551..24d30e1592 100644 --- a/crypto/ui/ui_lib.c +++ b/crypto/ui/ui_lib.c @@ -15,8 +15,6 @@ #include <openssl/err.h> #include "ui_locl.h" -static const UI_METHOD *default_UI_meth = NULL; - UI *UI_new(void) { return (UI_new_method(NULL)); @@ -531,19 +529,6 @@ void *UI_get_ex_data(UI *r, int idx) return (CRYPTO_get_ex_data(&r->ex_data, idx)); } -void UI_set_default_method(const UI_METHOD *meth) -{ - default_UI_meth = meth; -} - -const UI_METHOD *UI_get_default_method(void) -{ - if (default_UI_meth == NULL) { - default_UI_meth = UI_OpenSSL(); - } - return default_UI_meth; -} - const UI_METHOD *UI_get_method(UI *ui) { return ui->meth; diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c index ed0bfa0b35..8fa8deca66 100644 --- a/crypto/ui/ui_openssl.c +++ b/crypto/ui/ui_openssl.c @@ -202,6 +202,18 @@ static UI_METHOD ui_openssl = { NULL }; +static const UI_METHOD *default_UI_meth = &ui_openssl; + +void UI_set_default_method(const UI_METHOD *meth) +{ + default_UI_meth = meth; +} + +const UI_METHOD *UI_get_default_method(void) +{ + return default_UI_meth; +} + /* The method with all the built-in thingies */ UI_METHOD *UI_OpenSSL(void) { |