Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAO support revocation lists #1830

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
48 changes: 48 additions & 0 deletions ACE/ace/SSL/SSL_Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,54 @@ ACE_SSL_Context::load_trusted_ca (const char* ca_file,
return 0;
}

int
ACE_SSL_Context::load_crl_file(const char *file_name, int type)
{
if (context_ == nullptr || file_name == nullptr)
{
return 0;
}

int ret = 0;
BIO *in = nullptr;
X509_CRL *x = nullptr;
X509_STORE *st = ::SSL_CTX_get_cert_store(context_);
if (st == nullptr)
{
goto err;
}

if (type == SSL_FILETYPE_PEM)
{
ret = ::SSL_CTX_load_verify_locations(context_, file_name, nullptr);
}
else if (type == SSL_FILETYPE_ASN1)
{
in = BIO_new(BIO_s_file());
if (in == nullptr || BIO_read_filename(in, file_name) <= 0)
{
goto err;
}
x = d2i_X509_CRL_bio(in, nullptr);
if (x == nullptr)
{
goto err;
}
ret = ::X509_STORE_add_crl(st, x);
}

if (ret == 1)
{
(void)X509_STORE_set_flags(st, X509_V_FLAG_CRL_CHECK);
}

err:
X509_CRL_free(x);
(void)BIO_free(in);

return ret;
}

int
ACE_SSL_Context::private_key (const char *file_name,
int type)
Expand Down
2 changes: 2 additions & 0 deletions ACE/ace/SSL/SSL_Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ class ACE_SSL_Export ACE_SSL_Context
const char* ca_dir = 0,
bool use_env_defaults = true);

int load_crl_file(const char* file_name, int type);
caoxiaolins marked this conversation as resolved.
Show resolved Hide resolved

/**
* Test whether any CA locations have been successfully loaded and
* return the number of successful attempts.
Expand Down
37 changes: 37 additions & 0 deletions TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ TAO::SSLIOP::Protocol_Factory::init (int argc, ACE_TCHAR* argv[])
int private_key_type = -1;
int dhparams_type = -1;

CORBA::String_var crl_path;
int crl_type = -1;

int prevdebug = -1;

// Force the Singleton instance to be initialized/instantiated.
Expand Down Expand Up @@ -411,6 +414,17 @@ TAO::SSLIOP::Protocol_Factory::init (int argc, ACE_TCHAR* argv[])
}
}

else if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-SSLCRLFile")) == 0)
{
curarg++;
if (curarg < argc)
{
crl_type = parse_x509_file (ACE_TEXT_ALWAYS_CHAR(argv[curarg]),
caoxiaolins marked this conversation as resolved.
Show resolved Hide resolved
crl_path.out ());
}
}

else if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-SSLAuthenticate")) == 0)
{
Expand Down Expand Up @@ -634,6 +648,29 @@ TAO::SSLIOP::Protocol_Factory::init (int argc, ACE_TCHAR* argv[])
}
}

if (crl_path.in() != 0)
{
if (ssl_ctx->load_crl_file(crl_path.in(), crl_type) != 1)
{
ORBSVCS_ERROR ((LM_ERROR,
ACE_TEXT ("TAO (%P|%t) - Unable to load ")
ACE_TEXT ("crl file ")
caoxiaolins marked this conversation as resolved.
Show resolved Hide resolved
ACE_TEXT ("<%C> in SSLIOP factory, errno = %s.\n"),
crl_path.in(), ERR_reason_error_string(ERR_get_error())));
caoxiaolins marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
if (TAO_debug_level > 0)
{
ORBSVCS_DEBUG ((LM_INFO,
ACE_TEXT ("TAO (%P|%t) - SSLIOP loaded ")
ACE_TEXT("crl file ")
ACE_TEXT("<%C>\n"),
crl_path.in()));
}
}
}

// Load in the DH params. If there was a file explicitly specified,
// then we do that here, otherwise we load them in from the cert file.
// Note that we only do this on the server side, I think so we might
Expand Down