-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add renegotiation info to test clients.
Signed-off-by: Achim Kraus <[email protected]>
- Loading branch information
Showing
2 changed files
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ static dtls_context_t *orig_dtls_context = NULL; | |
|
||
static const dtls_cipher_t* ciphers = NULL; | ||
static unsigned int force_extended_master_secret = 0; | ||
static unsigned int force_renegotiation_info = 0; | ||
|
||
|
||
#ifdef DTLS_ECC | ||
|
@@ -238,6 +239,7 @@ get_user_parameters(struct dtls_context_t *ctx, | |
(void) ctx; | ||
(void) session; | ||
user_parameters->force_extended_master_secret = force_extended_master_secret; | ||
user_parameters->force_renegotiation_info = force_renegotiation_info; | ||
if (ciphers) { | ||
int index = 0; | ||
while (index < DTLS_MAX_CIPHER_SUITES) { | ||
|
@@ -353,19 +355,23 @@ usage( const char *program, const char *version) { | |
fprintf(stderr, "%s v%s -- DTLS client implementation\n" | ||
"(c) 2011-2014 Olaf Bergmann <[email protected]>\n\n" | ||
#ifdef DTLS_PSK | ||
"usage: %s [-c cipher suites] [-e] [-i file] [-k file] [-o file] [-p port] [-v num] addr [port]\n", | ||
"usage: %s [-c cipher suites] [-e] [-i file] [-k file] [-o file]\n" | ||
" %*s [-p port] [-r] [-v num] addr [port]\n", | ||
#else /* DTLS_PSK */ | ||
"usage: %s [-c cipher suites] [-e] [-o file] [-p port] [-v num] addr [port]\n", | ||
"usage: %s [-c cipher suites] [-e] [-o file] [-p port] [-r]\n" | ||
" %*s [-v num] addr [port]\n", | ||
#endif /* DTLS_PSK */ | ||
program, version, program); | ||
program, version, program, (int)strlen(program), ""); | ||
cipher_suites_usage(stderr, "\t"); | ||
fprintf(stderr, "\t-e\t\tforce extended master secret (RFC7627)\n" | ||
#ifdef DTLS_PSK | ||
"\t-i file\t\tread PSK identity from file\n" | ||
"\t-k file\t\tread pre-shared key from file\n" | ||
#endif /* DTLS_PSK */ | ||
"\t-o file\t\toutput received data to this file (use '-' for STDOUT)\n" | ||
"\t-o file\t\toutput received data to this file\n" | ||
"\t \t\t(use '-' for STDOUT)\n" | ||
"\t-p port\t\tlisten on specified port (default is %d)\n" | ||
"\t-r\t\tforce renegotiation info (RFC5746)\n" | ||
"\t-v num\t\tverbosity level (default: 3)\n", | ||
DEFAULT_PORT); | ||
} | ||
|
@@ -422,7 +428,7 @@ main(int argc, char **argv) { | |
memcpy(psk_key, PSK_DEFAULT_KEY, psk_key_length); | ||
#endif /* DTLS_PSK */ | ||
|
||
while ((opt = getopt(argc, argv, "c:eo:p:v:" PSK_OPTIONS)) != -1) { | ||
while ((opt = getopt(argc, argv, "c:eo:p:rv:" PSK_OPTIONS)) != -1) { | ||
switch (opt) { | ||
#ifdef DTLS_PSK | ||
case 'i' : | ||
|
@@ -464,6 +470,9 @@ main(int argc, char **argv) { | |
strncpy(port_str, optarg, NI_MAXSERV-1); | ||
port_str[NI_MAXSERV - 1] = '\0'; | ||
break; | ||
case 'r' : | ||
force_renegotiation_info = 1; | ||
break; | ||
case 'v' : | ||
log_level = strtol(optarg, NULL, 10); | ||
break; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ static dtls_context_t *the_context = NULL; | |
static volatile int cmd_exit = 0; | ||
static const dtls_cipher_t* ciphers = NULL; | ||
static unsigned int force_extended_master_secret = 0; | ||
static unsigned int force_renegotiation_info = 0; | ||
|
||
#ifdef DTLS_ECC | ||
static const unsigned char ecdsa_priv_key[] = { | ||
|
@@ -199,6 +200,7 @@ get_user_parameters(struct dtls_context_t *ctx, | |
(void) ctx; | ||
(void) session; | ||
user_parameters->force_extended_master_secret = force_extended_master_secret; | ||
user_parameters->force_renegotiation_info = force_renegotiation_info; | ||
if (ciphers) { | ||
int index = 0; | ||
while (index < DTLS_MAX_CIPHER_SUITES) { | ||
|
@@ -307,12 +309,13 @@ usage(const char *program, const char *version) { | |
|
||
fprintf(stderr, "%s v%s -- DTLS server implementation\n" | ||
"(c) 2011-2014 Olaf Bergmann <[email protected]>\n\n" | ||
"usage: %s [-A address] [-c cipher suites] [-e] [-p port] [-v num]\n" | ||
"usage: %s [-A address] [-c cipher suites] [-e] [-p port] [-r] [-v num]\n" | ||
"\t-A address\t\tlisten on specified address (default is ::)\n", | ||
program, version, program); | ||
cipher_suites_usage(stderr, "\t"); | ||
fprintf(stderr, "\t-e\t\tforce extended master secret (RFC7627)\n" | ||
"\t-p port\t\tlisten on specified port (default is %d)\n" | ||
"\t-r\t\tforce renegotiation info (RFC5746)\n" | ||
"\t-v num\t\tverbosity level (default: 3)\n", | ||
DEFAULT_PORT); | ||
} | ||
|
@@ -355,7 +358,7 @@ main(int argc, char **argv) { | |
listen_addr.sin6_family = AF_INET6; | ||
listen_addr.sin6_addr = in6addr_any; | ||
|
||
while ((opt = getopt(argc, argv, "A:c:ep:v:")) != -1) { | ||
while ((opt = getopt(argc, argv, "A:c:ep:rv:")) != -1) { | ||
switch (opt) { | ||
case 'A' : | ||
if (resolve_address(optarg, (struct sockaddr *)&listen_addr) < 0) { | ||
|
@@ -372,6 +375,9 @@ main(int argc, char **argv) { | |
case 'p' : | ||
port = htons(atoi(optarg)); | ||
break; | ||
case 'r' : | ||
force_renegotiation_info = 1; | ||
break; | ||
case 'v' : | ||
log_level = strtol(optarg, NULL, 10); | ||
break; | ||
|