[feature/elliptic-curve] Assign a variable to Math_BigInteger(1).

This commit is contained in:
Andreas Fischer 2013-06-07 00:43:40 +02:00
parent a730ed6e4c
commit 50f5f3f97e

View File

@ -1193,13 +1193,13 @@ class Net_SSH2 {
[VAN-OORSCHOT].
-- http://tools.ietf.org/html/rfc4419#section-6.2 */
$q = new Math_BigInteger(1);
$q = $q->bitwise_leftShift(16 * $keyLength); // 2 * 8 * $keyLength
$q = $q->subtract(new Math_BigInteger(1));
$one = new Math_BigInteger(1);
$q = $one->bitwise_leftShift(16 * $keyLength); // 2 * 8 * $keyLength
$q = $q->subtract($one);
$g = new Math_BigInteger(2);
$x = new Math_BigInteger();
$x = $x->random(new Math_BigInteger(1), $q);
$x = $x->random($one, $q);
$e = $g->modPow($x, $p);
$eBytes = $e->toBytes(true);