summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2014-03-09 03:47:32 +0100
committerMichael Tänzer <neo@nhng.de>2014-03-09 03:47:32 +0100
commitf8a00d63f4f858401f611bad51c1a9f839013ceb (patch)
tree6a434f6779001ce471405fde2475354a674c8d35
parent91f4bf7234d97491b04db05564de1b4a1e939f9e (diff)
downloadcacert-devel-f8a00d63f4f858401f611bad51c1a9f839013ceb.tar.gz
cacert-devel-f8a00d63f4f858401f611bad51c1a9f839013ceb.tar.xz
cacert-devel-f8a00d63f4f858401f611bad51c1a9f839013ceb.zip
bug 1255: Mixed up variable names for pub/Y, don't calculate the bit size
of all variables Signed-off-by: Michael Tänzer <neo@nhng.de>
-rw-r--r--includes/lib/check_weak_key.php8
1 files changed, 2 insertions, 6 deletions
diff --git a/includes/lib/check_weak_key.php b/includes/lib/check_weak_key.php
index 6628bed..090d66b 100644
--- a/includes/lib/check_weak_key.php
+++ b/includes/lib/check_weak_key.php
@@ -222,11 +222,7 @@ function checkWeakKeyText($text)
$num_Q = @gmp_init($key_Q, 16);
$num_G = @gmp_init($key_G, 16);
- $bit_pub = ltrim(gmp_strval($num_pub, 2), "0");
$bit_P = ltrim(gmp_strval($num_P, 2), "0");
- $bit_Q = ltrim(gmp_strval($num_Q, 2), "0");
- $bit_G = ltrim(gmp_strval($num_G, 2), "0");
-
$keysize = strlen($bit_P);
if ($keysize < 2048) {
@@ -261,9 +257,9 @@ function checkWeakKeyText($text)
}
//Check the numbers are all less than the public modulus P
- if(0 <= gmp_cmp($num_Q, $num_P) || 0 <= gmp_cmp($num_G, $num_P) || 0 <= gmp_cmp($num_Y, $num_P)) {
+ if(0 <= gmp_cmp($num_Q, $num_P) || 0 <= gmp_cmp($num_G, $num_P) || 0 <= gmp_cmp($num_pub, $num_P)) {
return failWithId("checkWeakKeyText(): The supplied DSA ".
- "key does seem to be normalized to have Q < P, G < P and Y < P.\nData:\n$text");
+ "key does seem to be normalized to have Q < P, G < P and pub < P.\nData:\n$text");
}
break;