Skip to content

Commit

Permalink
Merge pull request #595 from h2o/kazuho/mlkem
Browse files Browse the repository at this point in the history
[cli] add support for mlkem
  • Loading branch information
kazuho authored Nov 21, 2024
2 parents 384b18a + 6711687 commit 6d241bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
26 changes: 8 additions & 18 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1707,27 +1707,17 @@ int main(int argc, char **argv)
raw_pubkey_file = optarg;
break;
case 'x': {
size_t i;
for (i = 0; key_exchanges[i] != NULL; ++i)
;
#define MATCH(name) \
if (key_exchanges[i] == NULL && strcasecmp(optarg, #name) == 0) \
key_exchanges[i] = &ptls_openssl_##name
MATCH(secp256r1);
#if PTLS_OPENSSL_HAVE_SECP384R1
MATCH(secp384r1);
#endif
#if PTLS_OPENSSL_HAVE_SECP521R1
MATCH(secp521r1);
#endif
#if PTLS_OPENSSL_HAVE_X25519
MATCH(x25519);
#endif
#undef MATCH
if (key_exchanges[i] == NULL) {
ptls_key_exchange_algorithm_t **named, **slot;
for (named = ptls_openssl_key_exchanges_all; *named != NULL; ++named)
if (strcasecmp((*named)->name, optarg) == 0)
break;
if (*named == NULL) {
fprintf(stderr, "unknown key exchange: %s\n", optarg);
exit(1);
}
for (slot = key_exchanges; *slot != NULL; ++slot)
;
*slot = *named;
} break;
case 'X':
if (sscanf(optarg, "%" SCNu64, &ctx.transport_params.max_streams_bidi) != 1) {
Expand Down

0 comments on commit 6d241bd

Please sign in to comment.