Skip to content

Commit

Permalink
dtls-client.c: add support_cid option.
Browse files Browse the repository at this point in the history
Signed-off-by: Achim Kraus <[email protected]>
  • Loading branch information
boaks committed Feb 25, 2023
1 parent 3f6fdb1 commit b604f6a
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions tests/dtls-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ 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;
#if (DTLS_MAX_CID_LENGTH > 0)
static unsigned int support_cid = 0;
#endif

static void
get_user_parameters(struct dtls_context_t *ctx,
Expand All @@ -240,6 +243,9 @@ get_user_parameters(struct dtls_context_t *ctx,
(void) session;
user_parameters->force_extended_master_secret = force_extended_master_secret;
user_parameters->force_renegotiation_info = force_renegotiation_info;
#if (DTLS_MAX_CID_LENGTH > 0)
user_parameters->support_cid = support_cid;
#endif
if (ciphers) {
int index = 0;
while (index < DTLS_MAX_CIPHER_SUITES) {
Expand Down Expand Up @@ -354,11 +360,15 @@ 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"
"usage: %s "
#ifdef DTLS_PSK
"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] [-r] addr [port]\n"
"[-i file] [-k file] "
#endif /* DTLS_PSK */
"[-o file] [-p port] [-v num] [-c cipher-suites] [-e] [-r] "
#if (DTLS_MAX_CID_LENGTH > 0)
"[-#] "
#endif
"addr [port]\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"
Expand All @@ -367,7 +377,11 @@ usage( const char *program, const char *version) {
"\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-r\t\tforce renegotiation info (RFC5746)\n",
"\t-r\t\tforce renegotiation info (RFC5746)\n"
#if (DTLS_MAX_CID_LENGTH > 0)
"\t-#\t\tsupport CID (RFC9146)\n"
#endif
,
program, version, program, DEFAULT_PORT);
cipher_suites_usage(stderr, "\t");
}
Expand Down Expand Up @@ -424,7 +438,7 @@ main(int argc, char **argv) {
memcpy(psk_key, PSK_DEFAULT_KEY, psk_key_length);
#endif /* DTLS_PSK */

while ((opt = getopt(argc, argv, "rep: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' :
Expand Down Expand Up @@ -472,6 +486,9 @@ main(int argc, char **argv) {
case 'r' :
force_renegotiation_info = 1;
break;
case '#' :
support_cid = 1;
break;
default:
usage(argv[0], dtls_package_version());
exit(1);
Expand Down

0 comments on commit b604f6a

Please sign in to comment.