From df494ade428ddb4cb6a9a6f8b3885cf1b2478f06 Mon Sep 17 00:00:00 2001 From: mrcsys Date: Wed, 18 Jan 2006 14:53:13 +0000 Subject: Added start_ssl function to initialize library. --- nanohttp/nanohttp-client.c | 5 ++++- nanohttp/nanohttp-server.c | 6 +++++- nanohttp/nanohttp-ssl.c | 20 +++++++++++--------- nanohttp/nanohttp-ssl.h | 4 ++++ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c index e61e5af..6f7d864 100644 --- a/nanohttp/nanohttp-client.c +++ b/nanohttp/nanohttp-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-client.c,v 1.33 2006/01/10 11:29:05 snowdrop Exp $ +* $Id: nanohttp-client.c,v 1.34 2006/01/18 14:53:13 mrcsys Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -55,6 +55,9 @@ httpc_init(int argc, char *argv[]) { hoption_init_args(argc, argv); hsocket_module_init(); +#ifdef HAVE_SSL + start_ssl(); +#endif return H_OK; } diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c index cc5517b..2da65b7 100644 --- a/nanohttp/nanohttp-server.c +++ b/nanohttp/nanohttp-server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-server.c,v 1.43 2006/01/11 10:54:43 snowdrop Exp $ +* $Id: nanohttp-server.c,v 1.44 2006/01/18 14:53:13 mrcsys Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -167,6 +167,10 @@ httpd_init (int argc, char *argv[]) */ #endif +#ifdef HAVE_SSL + start_ssl(); +#endif + /* create socket */ status = hsocket_init (&_httpd_socket); if (status != H_OK) diff --git a/nanohttp/nanohttp-ssl.c b/nanohttp/nanohttp-ssl.c index 254b718..a2cdf17 100644 --- a/nanohttp/nanohttp-ssl.c +++ b/nanohttp/nanohttp-ssl.c @@ -166,22 +166,24 @@ user_verify (X509 * cert) } #endif -SSL_CTX * -initialize_ctx (const char *keyfile, const char *password, const char *calist) -{ - SSL_CTX *ctx = NULL; - - if (password == NULL) - password = ""; - - +void +start_ssl( void ){ /* Global system initialization */ log_verbose1 ("Initializing library"); SSL_library_init (); SSL_load_error_strings (); ERR_load_crypto_strings (); OpenSSL_add_ssl_algorithms (); +} +SSL_CTX * +initialize_ctx (const char *keyfile, const char *password, const char *calist) +{ + SSL_CTX *ctx = NULL; + + if (password == NULL) + password = ""; + /* Create our context */ ctx = SSL_CTX_new (SSLv23_method ()); diff --git a/nanohttp/nanohttp-ssl.h b/nanohttp/nanohttp-ssl.h index 5cb4cc3..aa035d6 100644 --- a/nanohttp/nanohttp-ssl.h +++ b/nanohttp/nanohttp-ssl.h @@ -59,6 +59,10 @@ typedef struct Con //static int pw_cb(char* buf, int num, int rwflag, void *userdata); +/* + * Start the ssl library + */ +void start_ssl( void ); /* * Initialize the context */ -- cgit v1.1-32-gdbae