tests/pkd: support --rekey to set rekey data limit
Support an optional --rekey input to set the SSH session rekey data limit using SSH_OPTIONS_REKEY_DATA. This flag can be used together with --buffer to test out server rekeying. Signed-off-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
03a1f1dd0c
Коммит
175375bc09
@ -249,6 +249,7 @@ static int pkd_exec_hello(int fd, struct pkd_daemon_args *args)
|
||||
const char *default_kex = NULL;
|
||||
char *all_kex = NULL;
|
||||
size_t kex_len = 0;
|
||||
const uint64_t rekey_data_limit = args->rekey_data_limit;
|
||||
|
||||
pkd_state.eof_received = 0;
|
||||
pkd_state.close_received = 0;
|
||||
@ -311,6 +312,12 @@ static int pkd_exec_hello(int fd, struct pkd_daemon_args *args)
|
||||
goto outclose;
|
||||
}
|
||||
|
||||
rc = ssh_options_set(s, SSH_OPTIONS_REKEY_DATA, &rekey_data_limit);
|
||||
if (rc != 0) {
|
||||
pkderr("ssh_options_set rekey data: %s\n", ssh_get_error(s));
|
||||
goto outclose;
|
||||
}
|
||||
|
||||
/*
|
||||
* ssh_bind_accept loads host key as side-effect. If this
|
||||
* succeeds, the given 'fd' will be closed upon 'ssh_free(s)'.
|
||||
|
@ -28,6 +28,8 @@ struct pkd_daemon_args {
|
||||
size_t len;
|
||||
} payload;
|
||||
|
||||
uint64_t rekey_data_limit;
|
||||
|
||||
struct {
|
||||
int list;
|
||||
|
||||
|
@ -64,6 +64,8 @@ static struct argp_option options[] = {
|
||||
"Run in socket-wrapper mode using the given mkdtemp directory template", 0 },
|
||||
{ "stdout", 'o', NULL, 0,
|
||||
"Emit pkd stdout messages", 0 },
|
||||
{ "rekey", 'r', "limit", 0,
|
||||
"Set the given rekey data limit, in bytes, using SSH_OPTIONS_REKEY_DATA", 0 },
|
||||
{ "test", 't', "testname", 0,
|
||||
"Run tests matching the given testname", 0 },
|
||||
{ "verbose", 'v', NULL, 0,
|
||||
@ -96,6 +98,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||
case 'o':
|
||||
pkd_dargs.opts.log_stdout = 1;
|
||||
break;
|
||||
case 'r':
|
||||
pkd_dargs.rekey_data_limit = atoi(arg);
|
||||
break;
|
||||
case 't':
|
||||
pkd_dargs.opts.testname = arg;
|
||||
break;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user