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

Both MACs have to use larger block/digest sizes than SHA1.
Additionally the KEX must be changed so that it will resize
the keys "E" and "F" to get keys of the right size for those
MACs (according to section 7.2 of rfc4253)
This commit is contained in:
Boris Wachtmeister
2014-11-11 19:25:55 +01:00
committed by Boris
parent 44e1ce1358
commit 70720de71b
3 changed files with 4 additions and 4 deletions

View File

@@ -310,11 +310,11 @@ final class KeyExchanger
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(),

View File

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

View File

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