Add DTLS support to ssltest
Reviewed-by: Emilia Käsper <emilia@openssl.org>
This commit is contained in:
parent
504e643e09
commit
98b8cdd322
@ -788,6 +788,10 @@ static void sv_usage(void)
|
|||||||
fprintf(stderr, " -ssl3 - use SSLv3\n");
|
fprintf(stderr, " -ssl3 - use SSLv3\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, " -tls1 - use TLSv1\n");
|
fprintf(stderr, " -tls1 - use TLSv1\n");
|
||||||
|
#ifndef OPENSSL_NO_DTLS
|
||||||
|
fprintf(stderr, " -dtls1 - use DTLSv1\n");
|
||||||
|
fprintf(stderr, " -dtls12 - use DTLSv1.2\n");
|
||||||
|
#endif
|
||||||
fprintf(stderr, " -CApath arg - PEM format directory of CA's\n");
|
fprintf(stderr, " -CApath arg - PEM format directory of CA's\n");
|
||||||
fprintf(stderr, " -CAfile arg - PEM format file of CA's\n");
|
fprintf(stderr, " -CAfile arg - PEM format file of CA's\n");
|
||||||
fprintf(stderr, " -cert arg - Server certificate file\n");
|
fprintf(stderr, " -cert arg - Server certificate file\n");
|
||||||
@ -958,7 +962,7 @@ int main(int argc, char *argv[])
|
|||||||
int badop = 0;
|
int badop = 0;
|
||||||
int bio_pair = 0;
|
int bio_pair = 0;
|
||||||
int force = 0;
|
int force = 0;
|
||||||
int tls1 = 0, ssl3 = 0, ret = 1;
|
int dtls1 = 0, dtls12 = 0, tls1 = 0, ssl3 = 0, ret = 1;
|
||||||
int client_auth = 0;
|
int client_auth = 0;
|
||||||
int server_auth = 0, i;
|
int server_auth = 0, i;
|
||||||
struct app_verify_arg app_verify_arg =
|
struct app_verify_arg app_verify_arg =
|
||||||
@ -1136,6 +1140,16 @@ int main(int argc, char *argv[])
|
|||||||
no_protocol = 1;
|
no_protocol = 1;
|
||||||
#endif
|
#endif
|
||||||
ssl3 = 1;
|
ssl3 = 1;
|
||||||
|
} else if (strcmp(*argv, "-dtls1") == 0) {
|
||||||
|
#ifdef OPENSSL_NO_DTLS
|
||||||
|
no_protocol = 1;
|
||||||
|
#endif
|
||||||
|
dtls1 = 1;
|
||||||
|
} else if (strcmp(*argv, "-dtls12") == 0) {
|
||||||
|
#ifdef OPENSSL_NO_DTLS
|
||||||
|
no_protocol = 1;
|
||||||
|
#endif
|
||||||
|
dtls12 = 1;
|
||||||
} else if (strncmp(*argv, "-num", 4) == 0) {
|
} else if (strncmp(*argv, "-num", 4) == 0) {
|
||||||
if (--argc < 1)
|
if (--argc < 1)
|
||||||
goto bad;
|
goto bad;
|
||||||
@ -1309,8 +1323,8 @@ int main(int argc, char *argv[])
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssl3 + tls1 > 1) {
|
if (ssl3 + tls1 + dtls1 + dtls12 > 1) {
|
||||||
fprintf(stderr, "At most one of -ssl3, or -tls1 should "
|
fprintf(stderr, "At most one of -ssl3, -tls1, -dtls1 or -dtls12 should "
|
||||||
"be requested.\n");
|
"be requested.\n");
|
||||||
EXIT(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
@ -1327,10 +1341,10 @@ int main(int argc, char *argv[])
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ssl3 && !tls1 && number > 1 && !reuse && !force) {
|
if (!ssl3 && !tls1 && !dtls1 && !dtls12 && number > 1 && !reuse && !force) {
|
||||||
fprintf(stderr, "This case cannot work. Use -f to perform "
|
fprintf(stderr, "This case cannot work. Use -f to perform "
|
||||||
"the test anyway (and\n-d to see what happens), "
|
"the test anyway (and\n-d to see what happens), "
|
||||||
"or add one of -ssl3, -tls1, -reuse\n"
|
"or add one of -ssl3, -tls1, -dtls1, -dtls12, -reuse\n"
|
||||||
"to avoid protocol mismatch.\n");
|
"to avoid protocol mismatch.\n");
|
||||||
EXIT(1);
|
EXIT(1);
|
||||||
}
|
}
|
||||||
@ -1402,6 +1416,13 @@ int main(int argc, char *argv[])
|
|||||||
if (ssl3)
|
if (ssl3)
|
||||||
meth = SSLv3_method();
|
meth = SSLv3_method();
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_DTLS
|
||||||
|
if (dtls1)
|
||||||
|
meth = DTLSv1_method();
|
||||||
|
else if (dtls12)
|
||||||
|
meth = DTLSv1_2_method();
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
if (tls1)
|
if (tls1)
|
||||||
meth = TLSv1_method();
|
meth = TLSv1_method();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user