Commits

Karl Ramm  committed 5ad6caf

Accepting that CTX_get_options was signed was causing headaches

The flags in the python interpreter(s) are treated as positive numbers, but
if the high bit is set it comes back out of openssl as negative. This is
pedantically incorrect but produces sanity-enhancing results.

(CTX_set_options is also altered similarly for consiswtency as it's the
same underlying function behind the macro)

  • Participants
  • Parent commits b7d7b92
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/module/_ssl/test/test_ssl.py

         raises(ValueError, _ssl._SSLContext, -1)
         raises(ValueError, _ssl._SSLContext, 42)
 
+    def test_options(self):
+        import _ssl
+        ctx = _ssl._SSLContext(_ssl.PROTOCOL_TLSv1)
+        assert _ssl.OP_ALL == ctx.options
+
+
 
 SSL_CERTIFICATE = """
 -----BEGIN CERTIFICATE-----

File rpython/rlib/ropenssl.py

 ssl_external('SSLv23_method', [], SSL_METHOD)
 ssl_external('SSL_CTX_use_PrivateKey_file', [SSL_CTX, rffi.CCHARP, rffi.INT], rffi.INT)
 ssl_external('SSL_CTX_use_certificate_chain_file', [SSL_CTX, rffi.CCHARP], rffi.INT)
-ssl_external('SSL_CTX_get_options', [SSL_CTX], rffi.INT, macro=True)
-ssl_external('SSL_CTX_set_options', [SSL_CTX, rffi.INT], rffi.INT, macro=True)
+ssl_external('SSL_CTX_get_options', [SSL_CTX], rffi.UINT, macro=True)
+ssl_external('SSL_CTX_set_options', [SSL_CTX, rffi.INT], rffi.UINT, macro=True)
 if HAVE_SSL_CTX_CLEAR_OPTIONS:
     ssl_external('SSL_CTX_clear_options', [SSL_CTX, rffi.INT], rffi.INT,
                  macro=True)