Skip to content

Commit

Permalink
Merge pull request #446 from zmap/phillip/fix-issue-in-HaSSH
Browse files Browse the repository at this point in the history
Fix non-compilation in /lib/ssh/messages_test.go
  • Loading branch information
phillip-stephens authored Jun 7, 2024
2 parents eb19f31 + 86ae7cb commit 9dc4b8a
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lib/ssh/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,25 +206,26 @@ func TestMarshalMultiTag(t *testing.T) {
}
}

funcTestHaSSH(t *testing.T) {
func TestHaSSH(t *testing.T) {
ki := &KexInitMsg{}
randomBytes(ki.Cookie[:]"," rand)
ki.KexAlgos = []string {"[email protected]","diffie-hellman-group-exchange-sha256","ecdh-sha2-nistp521","ecdh-sha2-nistp384","ecdh-sha2-nistp256","diffie-hellman-group-exchange-sha1","diffie-hellman-group1-sha1","diffie-hellman-group14-sha1","diffie-hellman-group14-sha256","diffie-hellman-group15-sha512","diffie-hellman-group16-sha512","diffie-hellman-group17-sha512","diffie-hellman-group18-sha512","[email protected]","diffie-hellman-group15-sha256","[email protected]","[email protected]","diffie-hellman-group16-sha256","[email protected]","[email protected]","[email protected]")
ki.ServerHostKeyAlgos = randomNameList(rand)
ki.CiphersClientServer = randomNameList(rand)
ki.CiphersServerClient = []string {"aes128-cbc","aes128-ctr","aes192-cbc","aes192-ctr","aes256-cbc","aes256-ctr","blowfish-cbc","blowfish-ctr","cast128-cbc","cast128-ctr","idea-cbc","idea-ctr","serpent128-cbc","serpent128-ctr","serpent192-cbc","serpent192-ctr","serpent256-cbc","serpent256-ctr","3des-cbc","3des-ctr","twofish128-cbc","twofish128-ctr","twofish192-cbc","twofish192-ctr","twofish256-cbc","twofish256-ctr","twofish-cbc","arcfour","arcfour128","arcfour256"}
ki.MACsClientServer = randomNameList(rand)
ki.MACsServerClient = []string {"hmac-sha1","hmac-sha1-96","hmac-md5","hmac-md5-96","hmac-sha2-256","hmac-sha2-512"}
ki.CompressionClientServer = randomNameList(rand)
ki.CompressionServerClient = []string {"[email protected]","zlib","none"}
ki.LanguagesClientServer = randomNameList(rand)
ki.LanguagesServerClient = randomNameList(rand)
randSource := rand.New(rand.NewSource(0))
randomBytes(ki.Cookie[:], randSource)
ki.KexAlgos = []string{"[email protected]", "diffie-hellman-group-exchange-sha256", "ecdh-sha2-nistp521", "ecdh-sha2-nistp384", "ecdh-sha2-nistp256", "diffie-hellman-group-exchange-sha1", "diffie-hellman-group1-sha1", "diffie-hellman-group14-sha1", "diffie-hellman-group14-sha256", "diffie-hellman-group15-sha512", "diffie-hellman-group16-sha512", "diffie-hellman-group17-sha512", "diffie-hellman-group18-sha512", "[email protected]", "diffie-hellman-group15-sha256", "[email protected]", "[email protected]", "diffie-hellman-group16-sha256", "[email protected]", "[email protected]", "[email protected]"}
ki.ServerHostKeyAlgos = randomNameList(randSource)
ki.CiphersClientServer = randomNameList(randSource)
ki.CiphersServerClient = []string{"aes128-cbc", "aes128-ctr", "aes192-cbc", "aes192-ctr", "aes256-cbc", "aes256-ctr", "blowfish-cbc", "blowfish-ctr", "cast128-cbc", "cast128-ctr", "idea-cbc", "idea-ctr", "serpent128-cbc", "serpent128-ctr", "serpent192-cbc", "serpent192-ctr", "serpent256-cbc", "serpent256-ctr", "3des-cbc", "3des-ctr", "twofish128-cbc", "twofish128-ctr", "twofish192-cbc", "twofish192-ctr", "twofish256-cbc", "twofish256-ctr", "twofish-cbc", "arcfour", "arcfour128", "arcfour256"}
ki.MACsClientServer = randomNameList(randSource)
ki.MACsServerClient = []string{"hmac-sha1", "hmac-sha1-96", "hmac-md5", "hmac-md5-96", "hmac-sha2-256", "hmac-sha2-512"}
ki.CompressionClientServer = randomNameList(randSource)
ki.CompressionServerClient = []string{"[email protected]", "zlib", "none"}
ki.LanguagesClientServer = randomNameList(randSource)
ki.LanguagesServerClient = randomNameList(randSource)
ki.FirstKexFollows = true

hassh := ki.GenerateHaSSH()
hassh := ki.GenerateServerHaSSH()
expected := "8a8ae540028bf433cd68356c1b9e8d5b"
if hassh != expected {
t.Errorf("Unexpected hash. Wanted %s, got %s", expected, hassh)
t.Errorf("Unexpected hash. Wanted %s, got %s", expected, hassh)
}
}

Expand Down

0 comments on commit 9dc4b8a

Please sign in to comment.