-
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
19 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 |
---|---|---|
|
@@ -231,13 +231,15 @@ send_to_peer(struct dtls_context_t *ctx, | |
|
||
static const dtls_cipher_t* ciphers = NULL; | ||
static unsigned int force_extended_master_secret = 0; | ||
static unsigned int force_renegotiation_info = 0; | ||
|
||
static void | ||
get_user_parameters(struct dtls_context_t *ctx, | ||
session_t *session, dtls_user_parameters_t *user_parameters) { | ||
(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,9 +355,9 @@ 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 [-i file] [-k file] [-o file] [-p port] [-v num] [-c cipher-suites] [-e] addr [port]\n" | ||
"usage: %s [-i file] [-k file] [-o file] [-p port] [-v num] [-c cipher-suites] [-e] [-r] addr [port]\n" | ||
#else /* DTLS_PSK */ | ||
"usage: %s [-o file] [-p port] [-v num] [-c cipher-suites] [-e] addr [port]\n" | ||
"usage: %s [-o file] [-p port] [-v num] [-c cipher-suites] [-e] [-r] addr [port]\n" | ||
#endif /* DTLS_PSK */ | ||
#ifdef DTLS_PSK | ||
"\t-i file\t\tread PSK identity from file\n" | ||
|
@@ -364,7 +366,8 @@ usage( const char *program, const char *version) { | |
"\t-o file\t\toutput received data to this file (use '-' for STDOUT)\n" | ||
"\t-p port\t\tlisten on specified port (default is %d)\n" | ||
"\t-v num\t\tverbosity level (default: 3)\n" | ||
"\t-e\t\tforce extended master secret (RFC7627)\n", | ||
"\t-e\t\tforce extended master secret (RFC7627)\n" | ||
"\t-r\t\tforce renegotiation info (RFC5746)\n", | ||
program, version, program, DEFAULT_PORT); | ||
cipher_suites_usage(stderr, "\t"); | ||
} | ||
|
@@ -421,7 +424,7 @@ main(int argc, char **argv) { | |
memcpy(psk_key, PSK_DEFAULT_KEY, psk_key_length); | ||
#endif /* DTLS_PSK */ | ||
|
||
while ((opt = getopt(argc, argv, "ep:o:v:c:" PSK_OPTIONS)) != -1) { | ||
while ((opt = getopt(argc, argv, "rep:o:v:c:" PSK_OPTIONS)) != -1) { | ||
switch (opt) { | ||
#ifdef DTLS_PSK | ||
case 'i' : | ||
|
@@ -466,6 +469,9 @@ main(int argc, char **argv) { | |
case 'e' : | ||
force_extended_master_secret = 1; | ||
break; | ||
case 'r' : | ||
force_renegotiation_info = 1; | ||
break; | ||
default: | ||
usage(argv[0], dtls_package_version()); | ||
exit(1); | ||
|
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 |
---|---|---|
|
@@ -194,13 +194,15 @@ send_to_peer(struct dtls_context_t *ctx, | |
|
||
static const dtls_cipher_t* ciphers = NULL; | ||
static unsigned int force_extended_master_secret = 0; | ||
static unsigned int force_renegotiation_info = 0; | ||
|
||
static void | ||
get_user_parameters(struct dtls_context_t *ctx, | ||
session_t *session, dtls_user_parameters_t *user_parameters) { | ||
(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) { | ||
|
@@ -309,11 +311,12 @@ 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] [-p port] [-v num] [-c cipher-suites] [-e]\n" | ||
"usage: %s [-A address] [-p port] [-v num] [-c cipher-suites] [-e] [-r]\n" | ||
"\t-A address\t\tlisten on specified address (default is ::)\n" | ||
"\t-p port\t\tlisten on specified port (default is %d)\n" | ||
"\t-v num\t\tverbosity level (default: 3)\n" | ||
"\t-e\t\tforce extended master secret (RFC7627)\n", | ||
"\t-e\t\tforce extended master secret (RFC7627)\n" | ||
"\t-r\t\tforce renegotiation info (RFC5746)\n", | ||
program, version, program, DEFAULT_PORT); | ||
cipher_suites_usage(stderr, "\t"); | ||
} | ||
|
@@ -356,7 +359,7 @@ main(int argc, char **argv) { | |
listen_addr.sin6_family = AF_INET6; | ||
listen_addr.sin6_addr = in6addr_any; | ||
|
||
while ((opt = getopt(argc, argv, "eA:p:v:c:")) != -1) { | ||
while ((opt = getopt(argc, argv, "reA:p:v:c:")) != -1) { | ||
switch (opt) { | ||
case 'A' : | ||
if (resolve_address(optarg, (struct sockaddr *)&listen_addr) < 0) { | ||
|
@@ -376,6 +379,9 @@ main(int argc, char **argv) { | |
case 'e' : | ||
force_extended_master_secret = 1; | ||
break; | ||
case 'r' : | ||
force_renegotiation_info = 1; | ||
break; | ||
default: | ||
usage(argv[0], dtls_package_version()); | ||
exit(1); | ||
|