Suppress the PowmInsecureWarning from PyCrypto. refs #1586
authordavid-sarah <david-sarah@jacaranda.org>
Mon, 14 May 2012 03:23:52 +0000 (03:23 +0000)
committerdavid-sarah <david-sarah@jacaranda.org>
Mon, 14 May 2012 03:23:52 +0000 (03:23 +0000)
src/allmydata/__init__.py
src/allmydata/_auto_deps.py

index c342ac5c0c0fd9de76a05ed900acce4c5eb5654e..f7906e01cbdcca4b6e049437f2e24cbb81b511b4 100644 (file)
@@ -145,7 +145,7 @@ def normalized_version(verstr, what=None):
 def get_package_versions_and_locations():
     import warnings
     from _auto_deps import package_imports, deprecation_messages, \
-        user_warning_messages, warning_imports
+        user_warning_messages, runtime_warning_messages, warning_imports
 
     def package_dir(srcfile):
         return os.path.dirname(os.path.dirname(os.path.normcase(os.path.realpath(srcfile))))
@@ -169,6 +169,8 @@ def get_package_versions_and_locations():
         warnings.filterwarnings("ignore", category=DeprecationWarning, message=msg, append=True)
     for msg in user_warning_messages:
         warnings.filterwarnings("ignore", category=UserWarning, message=msg, append=True)
+    for msg in runtime_warning_messages:
+        warnings.filterwarnings("ignore", category=RuntimeWarning, message=msg, append=True)
     try:
         for modulename in warning_imports:
             try:
@@ -176,9 +178,7 @@ def get_package_versions_and_locations():
             except ImportError:
                 pass
     finally:
-        for ign in user_warning_messages:
-            warnings.filters.pop()
-        for ign in deprecation_messages:
+        for ign in runtime_warning_messages + user_warning_messages + deprecation_messages:
             warnings.filters.pop()
 
     packages = []
index fc68c6c359c85c48041d78fab6789ae4d2ebf02c..5bb2c0c282a20f2445e66b6a2ff87e8b069fef9b 100644 (file)
@@ -115,6 +115,10 @@ user_warning_messages = [
     "Reliable disconnection notification requires pywin32 215 or later",
 ]
 
+runtime_warning_messages = [
+    "Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.",
+]
+
 warning_imports = [
     'nevow',
     'twisted.persisted.sob',