mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
Add tests and implementation for Encrypt-then-MAC mode
This adds the OpenSSH HMACs that do encrypt then mac. This is a more secure mode than the original HMAC. Newer AEAD ciphers like chacha20 and AES-GCM are already encrypt-then-mac, but this also adds it for older legacy clients that don't support those ciphers yet. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Reviewed-by: Jon Simons <jon@jonsimons.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Andreas Schneider
parent
e4c7912b35
commit
4a67c19118
@@ -184,15 +184,15 @@ static void torture_options_set_macs(void **state) {
|
||||
/* Test multiple known MACs */
|
||||
rc = ssh_options_set(session,
|
||||
SSH_OPTIONS_HMAC_S_C,
|
||||
"hmac-sha1,hmac-sha2-256");
|
||||
"hmac-sha1-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha1,hmac-sha2-256");
|
||||
assert_true(rc == 0);
|
||||
assert_string_equal(session->opts.wanted_methods[SSH_MAC_S_C],
|
||||
"hmac-sha1,hmac-sha2-256");
|
||||
"hmac-sha1-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha1,hmac-sha2-256");
|
||||
|
||||
/* Test unknown MACs */
|
||||
rc = ssh_options_set(session, SSH_OPTIONS_HMAC_S_C, "unknown-crap@example.com,hmac-sha1,unknown@example.com");
|
||||
rc = ssh_options_set(session, SSH_OPTIONS_HMAC_S_C, "unknown-crap@example.com,hmac-sha1-etm@openssh.com,unknown@example.com");
|
||||
assert_true(rc == 0);
|
||||
assert_string_equal(session->opts.wanted_methods[SSH_MAC_S_C], "hmac-sha1");
|
||||
assert_string_equal(session->opts.wanted_methods[SSH_MAC_S_C], "hmac-sha1-etm@openssh.com");
|
||||
|
||||
/* Test all unknown MACs */
|
||||
rc = ssh_options_set(session, SSH_OPTIONS_HMAC_S_C, "unknown-crap@example.com");
|
||||
|
||||
Reference in New Issue
Block a user