[tor-commits] [stem/master] Note when ed25519 support was added

atagar at torproject.org atagar at torproject.org
Sun Oct 6 02:07:34 UTC 2019


commit d7608f7916e3af20805662a062cd76589ee144ec
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Sep 12 15:21:01 2019 -0700

    Note when ed25519 support was added
    
    The ed25519 module itself does not say when it was added [1], but the
    changelog [2] indicates that support was added in version 2.6...
    
      2.6 - 2019-02-27
      Added support for Ed25519 signing when using OpenSSL 1.1.1b or newer.
    
    [1] https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ed25519/
    [2] https://cryptography.io/en/latest/changelog/
---
 stem/descriptor/hsv3_crypto.py            | 4 +---
 stem/prereq.py                            | 7 +++----
 test/unit/descriptor/hidden_service_v3.py | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/stem/descriptor/hsv3_crypto.py b/stem/descriptor/hsv3_crypto.py
index 8f304c52..c3f1feb0 100644
--- a/stem/descriptor/hsv3_crypto.py
+++ b/stem/descriptor/hsv3_crypto.py
@@ -30,10 +30,8 @@ def decode_address(onion_address_str):
     :raises: ValueError
     """
 
-    # TODO: note the module version
-
     if not stem.prereq.is_crypto_available(ed25519 = True):
-      raise ImportError('Onion address decoding requires cryptography version XXX')
+      raise ImportError('Onion address decoding requires cryptography version 2.6')
 
     from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
 
diff --git a/stem/prereq.py b/stem/prereq.py
index 0aadb35a..bf86ddef 100644
--- a/stem/prereq.py
+++ b/stem/prereq.py
@@ -119,7 +119,9 @@ def is_crypto_available(ed25519 = False):
   Checks if the cryptography functions we use are available. This is used for
   verifying relay descriptor signatures.
 
-  :param bool ed25519: check for ed25519 support
+  :param bool ed25519: check for `ed25519 support
+    <https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ed25519/>`_,
+    which was added in version 2.6
 
   :returns: **True** if we can use the cryptography module and **False**
     otherwise
@@ -136,9 +138,6 @@ def is_crypto_available(ed25519 = False):
     if not hasattr(rsa.RSAPrivateKey, 'sign'):
       raise ImportError()
 
-    # TODO: Check when the cryptography module's ed25519 class was added
-    # (it's not present in 2.0.3).
-
     if ed25519:
       from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
 
diff --git a/test/unit/descriptor/hidden_service_v3.py b/test/unit/descriptor/hidden_service_v3.py
index f4c42008..4fdc72bd 100644
--- a/test/unit/descriptor/hidden_service_v3.py
+++ b/test/unit/descriptor/hidden_service_v3.py
@@ -40,7 +40,7 @@ class TestHiddenServiceDescriptorV3(unittest.TestCase):
     """
 
     if not stem.prereq.is_crypto_available(ed25519 = True):
-      self.skipTest('(requires cryptography ed25519 support)')  # TODO: note version here
+      self.skipTest('(requires cryptography v2.6)')
       return
 
     with open(get_resource('hidden_service_v3_test'), 'rb') as descriptor_file:





More information about the tor-commits mailing list