]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1263379 - Remove support for Windows 2000
authorFrédéric Buclin <LpSolit@gmail.com>
Sun, 11 Sep 2016 03:08:04 +0000 (23:08 -0400)
committerDylan William Hardison <dylan@hardison.net>
Sun, 11 Sep 2016 03:08:04 +0000 (23:08 -0400)
Bugzilla/RNG.pm

index 69693c722577d9af65fb31dfab3ffadbcecff3f8..3c7d3d3077b12efdda9ae4711110a136c5a89391 100644 (file)
@@ -33,18 +33,6 @@ use constant SEED_SIZE => 16; # 128 bits.
 # Windows Stuff #
 #################
 
-# The type of cryptographic service provider we want to use.
-# This doesn't really matter for our purposes, so we just pick
-# PROV_RSA_FULL, which seems reasonable. For more info, see
-# http://msdn.microsoft.com/en-us/library/aa380244(v=VS.85).aspx
-use constant PROV_RSA_FULL => 1;
-
-# Flags for CryptGenRandom:
-# Don't ever display a UI to the user, just fail if one would be needed.
-use constant CRYPT_SILENT => 64;
-# Don't require existing public/private keypairs.
-use constant CRYPT_VERIFYCONTEXT => 0xF0000000;
-
 # For some reason, BOOLEAN doesn't work properly as a return type with 
 # Win32::API.
 use constant RTLGENRANDOM_PROTO => <<END;
@@ -158,13 +146,8 @@ sub _read_seed_from {
 
 sub _windows_seed {
     my ($major, $minor) = (Win32::GetOSVersion())[1,2];
-    if ($major < 5) {
-        die "Bugzilla does not support versions of Windows before"
-            . " Windows 2000";
-    }
-    # This means Windows 2000.
-    if ($major == 5 and $minor == 0) {
-        return _win2k_seed();
+    if ($major < 5 || ($major == 5 and $minor == 0)) {
+        die 'Bugzilla does not support versions of Windows before Windows XP';
     }
 
     my $rtlgenrand = Win32::API->new('advapi32', RTLGENRANDOM_PROTO);
@@ -179,46 +162,6 @@ sub _windows_seed {
     return $buffer;
 }
 
-sub _win2k_seed {
-    my $crypt_acquire = Win32::API->new(
-        "advapi32", 'CryptAcquireContext', 'PPPNN', 'I');
-    if (!defined $crypt_acquire) {
-        die "Could not import CryptAcquireContext: $^E";
-    }
-
-    my $crypt_release = Win32::API->new(
-        "advapi32", 'CryptReleaseContext', 'NN', 'I');
-    if (!defined $crypt_release) {
-        die "Could not import CryptReleaseContext: $^E";
-    }
-
-    my $crypt_gen_random = Win32::API->new(
-        "advapi32", 'CryptGenRandom', 'NNP', 'I');
-    if (!defined $crypt_gen_random) {
-        die "Could not import CryptGenRandom: $^E";
-    }
-
-    my $context = chr(0) x Win32::API::Type->sizeof('PULONG');
-    my $acquire_result = $crypt_acquire->Call(
-        $context, 0, 0, PROV_RSA_FULL, CRYPT_SILENT | CRYPT_VERIFYCONTEXT);
-    if (!defined $acquire_result) {
-        die "CryptAcquireContext failed: $^E";
-    }
-
-    my $pack_type = Win32::API::Type::packing('PULONG');
-    $context = unpack($pack_type, $context);
-
-    my $buffer = chr(0) x SEED_SIZE;
-    my $rand_result = $crypt_gen_random->Call($context, SEED_SIZE, $buffer);
-    my $rand_error = $^E;
-    # We don't check this if it fails, we don't care.
-    $crypt_release->Call($context, 0);
-    if (!defined $rand_result) {
-        die "CryptGenRandom failed: $rand_error";
-    }
-    return $buffer;
-}
-
 1;
 
 =head1 B<Methods in need of POD>