mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-05-04 17:24:14 +02:00
Passing scr-app-data in to -i to client sends a message during SCR
Modify mygetopt so that if an argument expects a value and that value is the next argument then myoptarg is set to a NULL pointer.
This commit is contained in:
@@ -999,7 +999,11 @@ static const char* client_usage_msg[][59] = {
|
||||
"-M <prot> Use STARTTLS, using <prot> protocol (smtp)\n", /* 27 */
|
||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||
"-R Allow Secure Renegotiation\n", /* 28 */
|
||||
"-i Force client Initiated Secure Renegotiation\n", /* 29 */
|
||||
"-i <str> Force client Initiated Secure Renegotiation. If the\n"
|
||||
" string 'scr-app-data' is passed in as the value and\n"
|
||||
" Non-blocking sockets are enabled ('-N') then wolfSSL\n"
|
||||
" sends a test message during the secure renegotiation.\n"
|
||||
" The string parameter is optional.\n", /* 29 */
|
||||
#endif
|
||||
"-f Fewer packets/group messages\n", /* 30 */
|
||||
"-x Disable client cert/key loading\n", /* 31 */
|
||||
@@ -1160,7 +1164,7 @@ static const char* client_usage_msg[][59] = {
|
||||
"使用する\n", /* 27 */
|
||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||
"-R セキュアな再ネゴシエーションを許可する\n", /* 28 */
|
||||
"-i クライアント主導のネゴシエーションを強制する\n", /* 29 */
|
||||
"-i <str> クライアント主導のネゴシエーションを強制する\n", /* 29 */
|
||||
#endif
|
||||
"-f より少ないパケット/グループメッセージを使用する\n",/* 30 */
|
||||
"-x クライアントの証明書/鍵のロードを無効する\n", /* 31 */
|
||||
@@ -1461,6 +1465,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
int err = 0;
|
||||
int scr = 0; /* allow secure renegotiation */
|
||||
int forceScr = 0; /* force client initiated scr */
|
||||
int scrAppData = 0;
|
||||
int resumeScr = 0; /* use resumption for renegotiation */
|
||||
#ifndef WOLFSSL_NO_CLIENT_AUTH
|
||||
int useClientCert = 1;
|
||||
@@ -1597,6 +1602,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
(void)atomicUser;
|
||||
(void)scr;
|
||||
(void)forceScr;
|
||||
(void)scrAppData;
|
||||
(void)resumeScr;
|
||||
(void)ourKey;
|
||||
(void)ourCert;
|
||||
@@ -1623,7 +1629,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#ifndef WOLFSSL_VXWORKS
|
||||
/* Not used: All used */
|
||||
while ((ch = mygetopt(argc, argv, "?:"
|
||||
"ab:c:defgh:ijk:l:mnop:q:rstuv:wxyz"
|
||||
"ab:c:defgh:i;jk:l:mnop:q:rstuv:wxyz"
|
||||
"A:B:CDE:F:GH:IJKL:M:NO:PQRS:TUVW:XYZ:"
|
||||
"01:23:458")) != -1) {
|
||||
switch (ch) {
|
||||
@@ -1862,6 +1868,9 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||
scr = 1;
|
||||
forceScr = 1;
|
||||
if (XSTRNCMP(myoptarg, "scr-app-data", 12) == 0) {
|
||||
scrAppData = 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -3095,10 +3104,15 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
if (err == WOLFSSL_ERROR_WANT_READ ||
|
||||
err == WOLFSSL_ERROR_WANT_WRITE) {
|
||||
ret = ClientWrite(ssl,
|
||||
"msg sent during renegotiation",
|
||||
sizeof("msg sent during renegotiation") - 1,
|
||||
"", 1);
|
||||
if (scrAppData) {
|
||||
ret = ClientWrite(ssl,
|
||||
"msg sent during renegotiation",
|
||||
sizeof("msg sent during renegotiation") - 1,
|
||||
"", 1);
|
||||
}
|
||||
else {
|
||||
ret = 0;
|
||||
}
|
||||
if (ret != 0) {
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
@@ -3110,7 +3124,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
err_sys("APP DATA should be present "
|
||||
"but error returned");
|
||||
}
|
||||
printf("Received message: %s\n", reply);
|
||||
printf("Received message during "
|
||||
"renegotiation: %s\n", reply);
|
||||
}
|
||||
err = 0;
|
||||
if ((ret = wolfSSL_connect(ssl))
|
||||
|
||||
Reference in New Issue
Block a user