Merge pull request #156 from Boris-de/fix_hmac-sha2

fixed block sizes for hmac-sha2-256 and hmac-sha2-512
This commit is contained in:
Jeroen van Erp
2015-01-09 14:15:14 +01:00
4 changed files with 5 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ signatures::
`ssh-rsa`, `ssh-dss` `ssh-rsa`, `ssh-dss`
mac:: 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:: compression::
`zlib` and `zlib@openssh.com` (delayed zlib) `zlib` and `zlib@openssh.com` (delayed zlib)

View File

@@ -310,11 +310,11 @@ final class KeyExchanger
final MAC mac_C2S = Factory.Named.Util.create(transport.getConfig().getMACFactories(), negotiatedAlgs final MAC mac_C2S = Factory.Named.Util.create(transport.getConfig().getMACFactories(), negotiatedAlgs
.getClient2ServerMACAlgorithm()); .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(), final MAC mac_S2C = Factory.Named.Util.create(transport.getConfig().getMACFactories(),
negotiatedAlgs.getServer2ClientMACAlgorithm()); 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 = final Compression compression_S2C =
Factory.Named.Util.create(transport.getConfig().getCompressionFactories(), Factory.Named.Util.create(transport.getConfig().getCompressionFactories(),

View File

@@ -35,6 +35,6 @@ public class HMACSHA2256
} }
public HMACSHA2256() { public HMACSHA2256() {
super("HmacSHA256", 20, 20); super("HmacSHA256", 32, 32);
} }
} }

View File

@@ -35,6 +35,6 @@ public class HMACSHA2512
} }
public HMACSHA2512() { public HMACSHA2512() {
super("HmacSHA512", 20, 20); super("HmacSHA512", 64, 64);
} }
} }