-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ncm-ssh: Rewrite two validation functions
The regexps were clever, but hard to understand and maintain.
- Loading branch information
Showing
1 changed file
with
23 additions
and
4 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 |
---|---|---|
|
@@ -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 { | ||
|