mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-09-28 07:09:01 +00:00
Merge branch '2.0'
This commit is contained in:
commit
54deb16da8
@ -1394,7 +1394,7 @@ class SSH2
|
|||||||
|
|
||||||
if ($kex_algorithm === 'curve25519-sha256@libssh.org') {
|
if ($kex_algorithm === 'curve25519-sha256@libssh.org') {
|
||||||
$x = Random::string(32);
|
$x = Random::string(32);
|
||||||
$eBytes = \Sodium::crypto_box_publickey_from_secretkey($x);
|
$eBytes = \Sodium\crypto_box_publickey_from_secretkey($x);
|
||||||
$clientKexInitMessage = NET_SSH2_MSG_KEX_ECDH_INIT;
|
$clientKexInitMessage = NET_SSH2_MSG_KEX_ECDH_INIT;
|
||||||
$serverKexReplyMessage = NET_SSH2_MSG_KEX_ECDH_REPLY;
|
$serverKexReplyMessage = NET_SSH2_MSG_KEX_ECDH_REPLY;
|
||||||
$kexHash = new Hash('sha256');
|
$kexHash = new Hash('sha256');
|
||||||
@ -1536,8 +1536,8 @@ class SSH2
|
|||||||
user_error('Received curve25519 public key of invalid length.');
|
user_error('Received curve25519 public key of invalid length.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$key = new BigInteger(\Sodium::crypto_scalarmult($x, $fBytes), 256);
|
$key = new BigInteger(\Sodium\crypto_scalarmult($x, $fBytes), 256);
|
||||||
\Sodium::sodium_memzero($x);
|
\Sodium\memzero($x);
|
||||||
} else {
|
} else {
|
||||||
$f = new BigInteger($fBytes, -256);
|
$f = new BigInteger($fBytes, -256);
|
||||||
$key = $f->modPow($x, $prime);
|
$key = $f->modPow($x, $prime);
|
||||||
|
Loading…
Reference in New Issue
Block a user