Commit 076fc555 authored by Rich Salz's avatar Rich Salz
Browse files

Make default_method mostly compile-time



Document thread-safety issues
Have RSA_null return NULL (always fails)

Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2244)
parent 2f881d2d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@
  *) Support for SSL_OP_NO_ENCRYPT_THEN_MAC in SSL_CONF_cmd.
     [Emilia Käsper]
  *) The RSA "null" method, which was partially supported to avoid patent
     issues, has been replaced to always returns NULL.
     [Rich Salz]
 Changes between 1.1.0d and 1.1.0e [16 Feb 2017]
  *) Encrypt-Then-Mac renegotiation crash
+1 −5
Original line number Diff line number Diff line
@@ -1444,12 +1444,8 @@ int speed_main(int argc, char **argv)
            continue;
        }
#ifndef OPENSSL_NO_RSA
# ifndef RSA_NULL
        if (strcmp(*argv, "openssl") == 0) {
            RSA_set_default_method(RSA_PKCS1_OpenSSL());
        if (strcmp(*argv, "openssl") == 0)
            continue;
        }
# endif
        if (strcmp(*argv, "rsa") == 0) {
            rsa_doit[R_RSA_512] = rsa_doit[R_RSA_1024] =
                rsa_doit[R_RSA_2048] = rsa_doit[R_RSA_3072] =
+12 −0
Original line number Diff line number Diff line
@@ -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;
+0 −14
Original line number Diff line number Diff line
@@ -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)
{
    /*
+0 −14
Original line number Diff line number Diff line
@@ -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);
Loading