From 675cec7ef2fefd6596f393e24f0f110f20d8f99e Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sat, 29 Sep 2012 02:40:48 +0000 Subject: [PATCH] Began migrating client mode for the OpenSSL transport --- src/transport/openssl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/transport/openssl.c b/src/transport/openssl.c index d2929f7..d7ca33e 100644 --- a/src/transport/openssl.c +++ b/src/transport/openssl.c @@ -73,6 +73,7 @@ AppTransportPluginDefinition definition = /* functions */ /* plug-in */ /* openssl_init */ +static void _init_client(OpenSSL * openssl, char const * name); static void _init_server(OpenSSL * openssl, char const * name); static OpenSSL * _openssl_init(AppTransportPluginHelper * helper, @@ -87,6 +88,9 @@ static OpenSSL * _openssl_init(AppTransportPluginHelper * helper, openssl->ssl_ctx = NULL; switch(mode) { + case ATM_CLIENT: + _init_client(openssl, name); + break; case ATM_SERVER: _init_server(openssl, name); break; @@ -101,6 +105,21 @@ static OpenSSL * _openssl_init(AppTransportPluginHelper * helper, return openssl; } +static void _init_client(OpenSSL * openssl, char const * name) +{ + if((openssl->ssl_ctx = SSL_CTX_new(SSLv3_client_method())) == NULL + || SSL_CTX_set_cipher_list(openssl->ssl_ctx, + SSL_DEFAULT_CIPHER_LIST) != 1) + { + _openssl_error(); + if(openssl->ssl_ctx != NULL) + SSL_CTX_free(openssl->ssl_ctx); + openssl->ssl_ctx = NULL; + return; + } + /* FIXME implement the rest */ +} + static void _init_server(OpenSSL * openssl, char const * name) { String * crt; @@ -121,8 +140,10 @@ static void _init_server(OpenSSL * openssl, char const * name) if(openssl->ssl_ctx != NULL) SSL_CTX_free(openssl->ssl_ctx); openssl->ssl_ctx = NULL; + return; } string_delete(crt); + /* FIXME implement the rest */ } /* openssl_destroy */