Lines 79-85
typedef struct tls_ctx {
Link Here
|
79 |
} tls_ctx; |
79 |
} tls_ctx; |
80 |
typedef struct tls_server_ctx { |
80 |
typedef struct tls_server_ctx { |
81 |
havege_state *hs; |
81 |
havege_state *hs; |
82 |
x509_cert cert; |
82 |
x509_crt cert; |
83 |
rsa_context key; |
83 |
rsa_context key; |
84 |
ssl_session ssn; |
84 |
ssl_session ssn; |
85 |
const char *dhm_P, *dhm_G; |
85 |
const char *dhm_P, *dhm_G; |
Lines 89-102
typedef struct tls_server_ctx {
Link Here
|
89 |
#define TLS_client(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ |
89 |
#define TLS_client(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ |
90 |
ssl_set_endpoint(s, SSL_IS_CLIENT); ssl_set_authmode(s, SSL_VERIFY_NONE);\ |
90 |
ssl_set_endpoint(s, SSL_IS_CLIENT); ssl_set_authmode(s, SSL_VERIFY_NONE);\ |
91 |
ssl_set_rng(s, havege_random, &ctx->hs);\ |
91 |
ssl_set_rng(s, havege_random, &ctx->hs);\ |
92 |
ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ |
|
|
93 |
SSL_SET_SESSION(s, 1, 600, &ctx->ssn) |
92 |
SSL_SET_SESSION(s, 1, 600, &ctx->ssn) |
94 |
#define TLS_server(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ |
93 |
#define TLS_server(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ |
95 |
ssl_set_endpoint(s, SSL_IS_SERVER); ssl_set_authmode(s, SSL_VERIFY_NONE);\ |
94 |
ssl_set_endpoint(s, SSL_IS_SERVER); ssl_set_authmode(s, SSL_VERIFY_NONE);\ |
96 |
ssl_set_rng(s, havege_random, ((tls_server_ctx*)ctx)->hs);\ |
95 |
ssl_set_rng(s, havege_random, ((tls_server_ctx*)ctx)->hs);\ |
97 |
ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ |
|
|
98 |
SSL_SET_SESSION(s, 1, 600, &((tls_server_ctx*)ctx)->ssn);\ |
96 |
SSL_SET_SESSION(s, 1, 600, &((tls_server_ctx*)ctx)->ssn);\ |
99 |
ssl_set_own_cert(s, &((tls_server_ctx*)ctx)->cert, &((tls_server_ctx*)ctx)->key);\ |
97 |
ssl_set_own_cert_rsa(s, &((tls_server_ctx*)ctx)->cert, &((tls_server_ctx*)ctx)->key);\ |
100 |
ssl_set_dh_param(s, ((tls_server_ctx*)ctx)->dhm_P, ((tls_server_ctx*)ctx)->dhm_G) |
98 |
ssl_set_dh_param(s, ((tls_server_ctx*)ctx)->dhm_P, ((tls_server_ctx*)ctx)->dhm_G) |
101 |
#define TLS_setfd(s,fd) ssl_set_bio(s, net_recv, &fd, net_send, &fd) |
99 |
#define TLS_setfd(s,fd) ssl_set_bio(s, net_recv, &fd, net_send, &fd) |
102 |
#define TLS_connect(s) ssl_handshake(s) |
100 |
#define TLS_connect(s) ssl_handshake(s) |
103 |
- |
|
|