Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed block sizes for hmac-sha2-256 and hmac-sha2-512 #156

Merged
merged 2 commits into from
Jan 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ signatures::
`ssh-rsa`, `ssh-dss`

mac::
`hmac-md5`, `hmac-md5-96`, `hmac-sha1`, `hmac-sha1-96`
`hmac-md5`, `hmac-md5-96`, `hmac-sha1`, `hmac-sha1-96`, `hmac-sha2-256`, `hmac-sha2-512`

compression::
`zlib` and `zlib@openssh.com` (delayed zlib)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/schmizz/sshj/transport/KeyExchanger.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ private void gotNewKeys() {

final MAC mac_C2S = Factory.Named.Util.create(transport.getConfig().getMACFactories(), negotiatedAlgs
.getClient2ServerMACAlgorithm());
mac_C2S.init(integrityKey_C2S);
mac_C2S.init(resizedKey(integrityKey_C2S, mac_C2S.getBlockSize(), hash, kex.getK(), kex.getH()));

final MAC mac_S2C = Factory.Named.Util.create(transport.getConfig().getMACFactories(),
negotiatedAlgs.getServer2ClientMACAlgorithm());
mac_S2C.init(integrityKey_S2C);
mac_S2C.init(resizedKey(integrityKey_S2C, mac_S2C.getBlockSize(), hash, kex.getK(), kex.getH()));

final Compression compression_S2C =
Factory.Named.Util.create(transport.getConfig().getCompressionFactories(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public String getName() {
}

public HMACSHA2256() {
super("HmacSHA256", 20, 20);
super("HmacSHA256", 32, 32);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public String getName() {
}

public HMACSHA2512() {
super("HmacSHA512", 20, 20);
super("HmacSHA512", 64, 64);
}
}