mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 23:30:55 +03:00
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:
@@ -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)
|
||||||
|
|||||||
@@ -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(),
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ public class HMACSHA2256
|
|||||||
}
|
}
|
||||||
|
|
||||||
public HMACSHA2256() {
|
public HMACSHA2256() {
|
||||||
super("HmacSHA256", 20, 20);
|
super("HmacSHA256", 32, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ public class HMACSHA2512
|
|||||||
}
|
}
|
||||||
|
|
||||||
public HMACSHA2512() {
|
public HMACSHA2512() {
|
||||||
super("HmacSHA512", 20, 20);
|
super("HmacSHA512", 64, 64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user