diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-18 17:45:50 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-18 17:45:50 +0000 |
commit | 87329b4522760f0a4a9a7962a52faf76d2db6f55 (patch) | |
tree | 09f47c80b40eda6de245cfb9ac05377243b603c7 /contrib/package/uhttpd/src/uhttpd-tls.c | |
parent | 1661add529c525939a27ae47c1429bfe50615211 (diff) |
contrib/package: add uhttpd, a drop-in replacement for busybox httpd
Diffstat (limited to 'contrib/package/uhttpd/src/uhttpd-tls.c')
-rw-r--r-- | contrib/package/uhttpd/src/uhttpd-tls.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/package/uhttpd/src/uhttpd-tls.c b/contrib/package/uhttpd/src/uhttpd-tls.c new file mode 100644 index 0000000000..d2d44129d3 --- /dev/null +++ b/contrib/package/uhttpd/src/uhttpd-tls.c @@ -0,0 +1,42 @@ +#include "uhttpd.h" +#include "uhttpd-tls.h" +#include "uhttpd-utils.h" + + +SSL_CTX * uh_tls_ctx_init() +{ + SSL_CTX *c = NULL; + SSL_load_error_strings(); + SSL_library_init(); + + if( (c = SSL_CTX_new(TLSv1_server_method())) != NULL ) + SSL_CTX_set_verify(c, SSL_VERIFY_NONE, NULL); + + return c; +} + +void uh_tls_ctx_free(struct listener *l) +{ + SSL_CTX_free(l->tls); +} + + +void uh_tls_client_accept(struct client *c) +{ + if( c->server && c->server->tls ) + { + c->tls = SSL_new(c->server->tls); + SSL_set_fd(c->tls, c->socket); + } +} + +void uh_tls_client_close(struct client *c) +{ + if( c->tls ) + { + SSL_shutdown(c->tls); + SSL_free(c->tls); + + c->tls = NULL; + } +} |