From fe3f73bdeb82f48170f8c913dabc8177188f157e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 26 Mar 2014 12:16:44 +0100 Subject: [PATCH] Allow force_version to select DTLS --- programs/ssl/ssl_client2.c | 18 ++++++++++++++---- programs/ssl/ssl_server2.c | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 838115039..1937eb6f4 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -574,18 +574,28 @@ int main( int argc, char *argv[] ) opt.min_version = SSL_MINOR_VERSION_1; opt.max_version = SSL_MINOR_VERSION_1; } - else if( strcmp( q, "tls1_1" ) == 0 || - strcmp( q, "dtls1" ) == 0 ) + else if( strcmp( q, "tls1_1" ) == 0 ) { opt.min_version = SSL_MINOR_VERSION_2; opt.max_version = SSL_MINOR_VERSION_2; } - else if( strcmp( q, "tls1_2" ) == 0 || - strcmp( q, "dtls1_2" ) == 0 ) + else if( strcmp( q, "tls1_2" ) == 0 ) { opt.min_version = SSL_MINOR_VERSION_3; opt.max_version = SSL_MINOR_VERSION_3; } + else if( strcmp( q, "dtls1" ) == 0 ) + { + opt.min_version = SSL_MINOR_VERSION_2; + opt.max_version = SSL_MINOR_VERSION_2; + opt.transport = SSL_TRANSPORT_DATAGRAM; + } + else if( strcmp( q, "dtls1_2" ) == 0 ) + { + opt.min_version = SSL_MINOR_VERSION_3; + opt.max_version = SSL_MINOR_VERSION_3; + opt.transport = SSL_TRANSPORT_DATAGRAM; + } else goto usage; } diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 78b5d20e9..59c949c11 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -857,18 +857,28 @@ int main( int argc, char *argv[] ) opt.min_version = SSL_MINOR_VERSION_1; opt.max_version = SSL_MINOR_VERSION_1; } - else if( strcmp( q, "tls1_1" ) == 0 || - strcmp( q, "dtls1" ) == 0 ) + else if( strcmp( q, "tls1_1" ) == 0 ) { opt.min_version = SSL_MINOR_VERSION_2; opt.max_version = SSL_MINOR_VERSION_2; } - else if( strcmp( q, "tls1_2" ) == 0 || - strcmp( q, "dtls1_2" ) == 0 ) + else if( strcmp( q, "tls1_2" ) == 0 ) { opt.min_version = SSL_MINOR_VERSION_3; opt.max_version = SSL_MINOR_VERSION_3; } + else if( strcmp( q, "dtls1" ) == 0 ) + { + opt.min_version = SSL_MINOR_VERSION_2; + opt.max_version = SSL_MINOR_VERSION_2; + opt.transport = SSL_TRANSPORT_DATAGRAM; + } + else if( strcmp( q, "dtls1_2" ) == 0 ) + { + opt.min_version = SSL_MINOR_VERSION_3; + opt.max_version = SSL_MINOR_VERSION_3; + opt.transport = SSL_TRANSPORT_DATAGRAM; + } else goto usage; }