From f7a3280e271629fd5f6c048cf17d5bbba3ea1616 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 26 Jan 2020 16:46:16 +0000 Subject: [PATCH] Fix text name of hmac-sha1-96-buggy. I carefully set up separate mechanisms for the "-96" suffix on the hash name and the "bug-compatible" in parens after it, so that the latter could share its parens with annotations from the underlying hash. And then I forgot to _use_ the second mechanism! Also added ssh2_mac_text_name to the testcrypt API so I could check it easily. The result before this fix: >>> ssh2_mac_text_name(ssh2_mac_new("hmac_sha1_96_buggy", None)) 'HMAC-SHA-1-96 (bug-compatible) (unaccelerated)' And after, which is what I intended all along: >>> ssh2_mac_text_name(ssh2_mac_new("hmac_sha1_96_buggy", None)) 'HMAC-SHA-1-96 (bug-compatible, unaccelerated)' (cherry picked from commit 600bf247d304fc18c9d6b3ec0d18c609253d52a9) --- sshhmac.c | 4 ++-- testcrypt.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sshhmac.c b/sshhmac.c index 29db9fbf..2f870f36 100644 --- a/sshhmac.c +++ b/sshhmac.c @@ -222,7 +222,7 @@ const ssh2_macalg ssh_hmac_sha1_96 = { }; const struct hmac_extra ssh_hmac_sha1_buggy_extra = { - &ssh_sha1, " (bug-compatible)" + &ssh_sha1, "", "bug-compatible" }; const ssh2_macalg ssh_hmac_sha1_buggy = { @@ -233,7 +233,7 @@ const ssh2_macalg ssh_hmac_sha1_buggy = { }; const struct hmac_extra ssh_hmac_sha1_96_buggy_extra = { - &ssh_sha1, "-96 (bug-compatible)" + &ssh_sha1, "-96", "bug-compatible" }; const ssh2_macalg ssh_hmac_sha1_96_buggy = { diff --git a/testcrypt.h b/testcrypt.h index 98a1daf0..690bfa2b 100644 --- a/testcrypt.h +++ b/testcrypt.h @@ -136,6 +136,7 @@ FUNC2(void, ssh2_mac_setkey, val_mac, val_string_ptrlen) FUNC1(void, ssh2_mac_start, val_mac) FUNC2(void, ssh2_mac_update, val_mac, val_string_ptrlen) FUNC1(val_string, ssh2_mac_genresult, val_mac) +FUNC1(val_string_asciz_const, ssh2_mac_text_name, val_mac) /* * The ssh_key abstraction. All the uses of BinarySink and