Skip to content

Commit

Permalink
ncm-ssh: Rewrite two validation functions
Browse files Browse the repository at this point in the history
The regexps were clever, but hard to understand and maintain.
  • Loading branch information
jrha committed Nov 29, 2024
1 parent 0ed5add commit 4001143
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions ncm-ssh/src/main/pan/components/ssh/schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,32 @@ type ssh_gssapikexalgorithms = choice(
);

function is_valid_ssh_MAC = {
match(ARGV[0], "^(hmac-(sha2-256|sha2-512|ripemd160)|(hmac-ripemd160|umac-64|umac-128|hmac-sha2-256-etm" +
"|hmac-sha2-512-etm|hmac-ripemd160-etm|umac-64-etm|umac-128-etm)@openssh.com)$");
valid_options = list(
'hmac-ripemd160',
'[email protected]',
'[email protected]',
'hmac-sha2-256',
'[email protected]',
'hmac-sha2-512',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
);
index(ARGV[0], valid_options) >= 0;
};

function is_valid_ssh_cipher = {
match (ARGV[0], "^((aes128|aes192|aes256)-ctr|(aes128-gcm|aes256-gcm|chacha20-poly1305)@openssh.com)$");
};
valid_options = list(
'aes128-ctr',
'aes192-ctr',
'aes256-ctr',
'[email protected]',
'[email protected]',
'[email protected]',
);
index(ARGV[0], valid_options) >= 0;
};

type legacy_ssh_MACs = string with {
Expand Down

0 comments on commit 4001143

Please sign in to comment.