1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-05 19:35:48 +03:00

programs -> ssl_client2.c: Added option renego_delay to set record buffer depth.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
Minos Galanakis
2025-03-06 18:51:09 +00:00
parent 12cf388856
commit eec6eb9cd4

View File

@@ -76,6 +76,7 @@ int main(void)
#define DFL_RECO_SERVER_NAME NULL #define DFL_RECO_SERVER_NAME NULL
#define DFL_RECO_DELAY 0 #define DFL_RECO_DELAY 0
#define DFL_RECO_MODE 1 #define DFL_RECO_MODE 1
#define DFL_RENEGO_DELAY -2
#define DFL_CID_ENABLED 0 #define DFL_CID_ENABLED 0
#define DFL_CID_VALUE "" #define DFL_CID_VALUE ""
#define DFL_CID_ENABLED_RENEGO -1 #define DFL_CID_ENABLED_RENEGO -1
@@ -308,7 +309,8 @@ int main(void)
#if defined(MBEDTLS_SSL_RENEGOTIATION) #if defined(MBEDTLS_SSL_RENEGOTIATION)
#define USAGE_RENEGO \ #define USAGE_RENEGO \
" renegotiation=%%d default: 0 (disabled)\n" \ " renegotiation=%%d default: 0 (disabled)\n" \
" renegotiate=%%d default: 0 (disabled)\n" " renegotiate=%%d default: 0 (disabled)\n" \
" renego_delay=%%d default: -2 (library default)\n"
#else #else
#define USAGE_RENEGO "" #define USAGE_RENEGO ""
#endif #endif
@@ -957,6 +959,7 @@ int main(int argc, char *argv[])
opt.renegotiation = DFL_RENEGOTIATION; opt.renegotiation = DFL_RENEGOTIATION;
opt.allow_legacy = DFL_ALLOW_LEGACY; opt.allow_legacy = DFL_ALLOW_LEGACY;
opt.renegotiate = DFL_RENEGOTIATE; opt.renegotiate = DFL_RENEGOTIATE;
opt.renego_delay = DFL_RENEGO_DELAY;
opt.exchanges = DFL_EXCHANGES; opt.exchanges = DFL_EXCHANGES;
opt.min_version = DFL_MIN_VERSION; opt.min_version = DFL_MIN_VERSION;
opt.max_version = DFL_MAX_VERSION; opt.max_version = DFL_MAX_VERSION;
@@ -1193,6 +1196,8 @@ usage:
break; break;
default: goto usage; default: goto usage;
} }
} else if (strcmp(p, "renego_delay") == 0) {
opt.renego_delay = (atoi(q));
} else if (strcmp(p, "renegotiate") == 0) { } else if (strcmp(p, "renegotiate") == 0) {
opt.renegotiate = atoi(q); opt.renegotiate = atoi(q);
if (opt.renegotiate < 0 || opt.renegotiate > 1) { if (opt.renegotiate < 0 || opt.renegotiate > 1) {
@@ -1966,6 +1971,9 @@ usage:
} }
#if defined(MBEDTLS_SSL_RENEGOTIATION) #if defined(MBEDTLS_SSL_RENEGOTIATION)
mbedtls_ssl_conf_renegotiation(&conf, opt.renegotiation); mbedtls_ssl_conf_renegotiation(&conf, opt.renegotiation);
if (opt.renego_delay != DFL_RENEGO_DELAY) {
mbedtls_ssl_conf_renegotiation_enforced(&conf, opt.renego_delay);
}
#endif #endif
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED) #if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
@@ -2510,6 +2518,8 @@ usage:
} }
mbedtls_printf(" ok\n"); mbedtls_printf(" ok\n");
} }
#endif /* MBEDTLS_SSL_RENEGOTIATION */ #endif /* MBEDTLS_SSL_RENEGOTIATION */
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)