Provisional DTLS 1.2 support.
Add correct flags for DTLS 1.2, update s_server and s_client to handle
DTLS 1.2 methods.
Currently no support for version negotiation: i.e. if client/server selects
DTLS 1.2 it is that or nothing.
(cherry picked from commit c3b344e36a)
Conflicts:
apps/s_server.c
This commit is contained in:
@@ -204,9 +204,9 @@ typedef unsigned int u_int;
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength);
|
||||
#endif
|
||||
static int sv_body(char *hostname, int s, unsigned char *context);
|
||||
static int www_body(char *hostname, int s, unsigned char *context);
|
||||
static int rev_body(char *hostname, int s, unsigned char *context);
|
||||
static int sv_body(char *hostname, int s, int stype, unsigned char *context);
|
||||
static int www_body(char *hostname, int s, int stype, unsigned char *context);
|
||||
static int rev_body(char *hostname, int s, int stype, unsigned char *context);
|
||||
static void close_accept_socket(void );
|
||||
static void sv_usage(void);
|
||||
static int init_ssl_connection(SSL *s);
|
||||
@@ -540,6 +540,7 @@ static void sv_usage(void)
|
||||
BIO_printf(bio_err," -tls1_1 - Just talk TLSv1.1\n");
|
||||
BIO_printf(bio_err," -tls1 - Just talk TLSv1\n");
|
||||
BIO_printf(bio_err," -dtls1 - Just talk DTLSv1\n");
|
||||
BIO_printf(bio_err," -dtls1_2 - Just talk DTLSv1.2\n");
|
||||
BIO_printf(bio_err," -timeout - Enable timeouts\n");
|
||||
BIO_printf(bio_err," -mtu - Set link layer MTU\n");
|
||||
BIO_printf(bio_err," -chain - Read a certificate chain\n");
|
||||
@@ -1373,6 +1374,11 @@ int MAIN(int argc, char *argv[])
|
||||
meth=DTLSv1_server_method();
|
||||
socket_type = SOCK_DGRAM;
|
||||
}
|
||||
else if (strcmp(*argv,"-dtls1_2") == 0)
|
||||
{
|
||||
meth=DTLSv1_2_server_method();
|
||||
socket_type = SOCK_DGRAM;
|
||||
}
|
||||
else if (strcmp(*argv,"-timeout") == 0)
|
||||
enable_timeouts = 1;
|
||||
else if (strcmp(*argv,"-mtu") == 0)
|
||||
@@ -2076,7 +2082,7 @@ static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)
|
||||
SSL_CTX_sess_get_cache_size(ssl_ctx));
|
||||
}
|
||||
|
||||
static int sv_body(char *hostname, int s, unsigned char *context)
|
||||
static int sv_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
{
|
||||
char *buf=NULL;
|
||||
fd_set readfds;
|
||||
@@ -2146,7 +2152,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (SSL_version(con) == DTLS1_VERSION)
|
||||
if (stype == SOCK_DGRAM)
|
||||
{
|
||||
|
||||
sbio=BIO_new_dgram(s,BIO_NOCLOSE);
|
||||
@@ -2692,7 +2698,7 @@ static int load_CA(SSL_CTX *ctx, char *file)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int www_body(char *hostname, int s, unsigned char *context)
|
||||
static int www_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
{
|
||||
char *buf=NULL;
|
||||
int ret=1;
|
||||
@@ -3102,7 +3108,7 @@ err:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int rev_body(char *hostname, int s, unsigned char *context)
|
||||
static int rev_body(char *hostname, int s, int stype, unsigned char *context)
|
||||
{
|
||||
char *buf=NULL;
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user