From 9efa989d096fad71e8b0889cbe5f4a287eee0e46 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 15:11:25 -0700 Subject: A tox thing which attempts to check for errors (should be failing now) --- .travis.yml | 1 + tox.ini | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index defcd77b..f68d5ff6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: python python: 2.7 env: + - TOX_ENV=cffi - TOX_ENV=py26 - TOX_ENV=py27 - TOX_ENV=py32 diff --git a/tox.ini b/tox.ini index 4d17ebe8..0b7acd66 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26,py27,pypy,py32,py33,docs,pep8 +envlist = cffi,py26,py27,pypy,py32,py33,docs,pep8 [testenv] deps = @@ -7,6 +7,14 @@ deps = pretend commands = py.test --cov=cryptography/ --cov=tests/ +[testenv:cffi] +basepython = python2.7 +install_command = +setenv = + CFLAGS="-Wall -Wconversion -Wpedantic -Werror" +commands = + python -c "import cryptography.bindings.openssl" + [testenv:docs] deps = sphinx basepython = python2.7 -- cgit v1.2.3 From 1a2b774be6c554c9c4533341f9386cc644d7de1b Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 15:13:43 -0700 Subject: This isn't useful --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 0b7acd66..3ae8cfe8 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,6 @@ commands = py.test --cov=cryptography/ --cov=tests/ [testenv:cffi] basepython = python2.7 -install_command = setenv = CFLAGS="-Wall -Wconversion -Wpedantic -Werror" commands = -- cgit v1.2.3 From 0745587dc174adba539ab555da72bcaa0b21cd85 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 15:56:16 -0700 Subject: Try without this --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 3ae8cfe8..b198943f 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ commands = py.test --cov=cryptography/ --cov=tests/ [testenv:cffi] basepython = python2.7 setenv = - CFLAGS="-Wall -Wconversion -Wpedantic -Werror" + CFLAGS="-Wall -Wconversion -Werror" commands = python -c "import cryptography.bindings.openssl" -- cgit v1.2.3 From 89b4cc0454209b132400582f081ac1929d6b94c5 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 16:09:07 -0700 Subject: Software. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index b198943f..9c1aade6 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ commands = py.test --cov=cryptography/ --cov=tests/ [testenv:cffi] basepython = python2.7 setenv = - CFLAGS="-Wall -Wconversion -Werror" + CFLAGS=-Wall -Wconversion -Wpedantic -Werror commands = python -c "import cryptography.bindings.openssl" -- cgit v1.2.3 From ca110d6412cb226f49d960b1eba7fe01ca3c80cf Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 16:18:09 -0700 Subject: Remove --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9c1aade6..7d73fcef 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ commands = py.test --cov=cryptography/ --cov=tests/ [testenv:cffi] basepython = python2.7 setenv = - CFLAGS=-Wall -Wconversion -Wpedantic -Werror + CFLAGS=-Wall -Wconversion -Werror commands = python -c "import cryptography.bindings.openssl" -- cgit v1.2.3 From e63f0c1bea8ee0c3986a92026493109f62bb3f05 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 16:44:18 -0700 Subject: We can't compile cffi itself with warnings --- tox.ini | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 7d73fcef..b4b20ec4 100644 --- a/tox.ini +++ b/tox.ini @@ -9,10 +9,9 @@ commands = py.test --cov=cryptography/ --cov=tests/ [testenv:cffi] basepython = python2.7 -setenv = - CFLAGS=-Wall -Wconversion -Werror commands = - python -c "import cryptography.bindings.openssl" + git clean -x -f -d + CFLAGS="-Wall -Wconversion -Werror" python -c "import cryptography.bindings.openssl" [testenv:docs] deps = sphinx -- cgit v1.2.3 From 479cc0902e0243b59284145932e73ce0ea2ecf09 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 16:54:39 -0700 Subject: Do this always --- cryptography/bindings/openssl/api.py | 3 ++- tox.ini | 8 +------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index d648d491..5b58c775 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -41,7 +41,8 @@ class API(object): self.lib = self.ffi.verify( source="\n".join(includes), - libraries=["crypto"] + libraries=["crypto"], + extra_compile_args=["-Wall", "-Werror", "-Wpedantic", "-Wconversion"] ) self.lib.OpenSSL_add_all_algorithms() diff --git a/tox.ini b/tox.ini index b4b20ec4..4d17ebe8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = cffi,py26,py27,pypy,py32,py33,docs,pep8 +envlist = py26,py27,pypy,py32,py33,docs,pep8 [testenv] deps = @@ -7,12 +7,6 @@ deps = pretend commands = py.test --cov=cryptography/ --cov=tests/ -[testenv:cffi] -basepython = python2.7 -commands = - git clean -x -f -d - CFLAGS="-Wall -Wconversion -Werror" python -c "import cryptography.bindings.openssl" - [testenv:docs] deps = sphinx basepython = python2.7 -- cgit v1.2.3 From a52219710bd9032ddafd8000afdaf05927aaa6a6 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 16:56:55 -0700 Subject: Different flags --- cryptography/bindings/openssl/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 5b58c775..2850f24a 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -42,7 +42,10 @@ class API(object): self.lib = self.ffi.verify( source="\n".join(includes), libraries=["crypto"], - extra_compile_args=["-Wall", "-Werror", "-Wpedantic", "-Wconversion"] + extra_compile_args=[ + "-Qunused-arguments", "-Wno-deprecated", + "-Wall", "-Werror", "-Wpedantic", "-Wconversion" + ] ) self.lib.OpenSSL_add_all_algorithms() -- cgit v1.2.3 From 3727881c4d69201dc51803c40b01efe321df3bd7 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 16:58:52 -0700 Subject: Some comments --- cryptography/bindings/openssl/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 2850f24a..49edc92e 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -43,7 +43,12 @@ class API(object): source="\n".join(includes), libraries=["crypto"], extra_compile_args=[ - "-Qunused-arguments", "-Wno-deprecated", + # Disabled because on stock OS X there is an "-mno-fused-madd" + # which is ignored. + "-Qunused-arguments", + # All of OpenSSL is deprecated on OS X, so we ignore this. + "-Wno-deprecated", + # Be very loud about everything else "-Wall", "-Werror", "-Wpedantic", "-Wconversion" ] ) -- cgit v1.2.3 From d7eb42875412655da819f9aeec67f16fbe617e75 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 17:41:01 -0700 Subject: I removed this --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f68d5ff6..defcd77b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: python python: 2.7 env: - - TOX_ENV=cffi - TOX_ENV=py26 - TOX_ENV=py27 - TOX_ENV=py32 -- cgit v1.2.3 From 85681a380776e62a140eb127a5dcd11de8d45af8 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 17:45:39 -0700 Subject: only pass these on OS X --- cryptography/bindings/openssl/api.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 49edc92e..6de5445d 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -39,18 +39,21 @@ class API(object): self.ffi.cdef(module.FUNCTIONS) includes.append(module.INCLUDES) + extra_compile_args = [ + # Be very loud about everything else + "-Wall", "-Werror", "-Wpedantic", "-Wconversion" + ] + if sys.platform == "darwin": + # All of OpenSSL is deprecated on OS X, so we ignore this. + extra_compile_args.append("-Wno-deprecated") + # Disabled because on stock OS X there is an "-mno-fused-madd" + # which is ignored. + extra_compile_args.append("-Qunused-arguments") + self.lib = self.ffi.verify( source="\n".join(includes), libraries=["crypto"], - extra_compile_args=[ - # Disabled because on stock OS X there is an "-mno-fused-madd" - # which is ignored. - "-Qunused-arguments", - # All of OpenSSL is deprecated on OS X, so we ignore this. - "-Wno-deprecated", - # Be very loud about everything else - "-Wall", "-Werror", "-Wpedantic", "-Wconversion" - ] + extra_compile_args=extra_compile_args, ) self.lib.OpenSSL_add_all_algorithms() -- cgit v1.2.3 From 6742ba8df7969ccc3fc7a2720269fdad4cf483da Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 17:52:23 -0700 Subject: A flag too far --- cryptography/bindings/openssl/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 6de5445d..1bb1f65c 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -41,7 +41,7 @@ class API(object): extra_compile_args = [ # Be very loud about everything else - "-Wall", "-Werror", "-Wpedantic", "-Wconversion" + "-Wall", "-Werror", "-Wconversion" ] if sys.platform == "darwin": # All of OpenSSL is deprecated on OS X, so we ignore this. -- cgit v1.2.3 From 818bcb7a7f8bd6c496c42e953ecc474dedd0096c Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 17:55:11 -0700 Subject: Everything but shut some off --- cryptography/bindings/openssl/api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 1bb1f65c..1dfae28d 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -41,7 +41,14 @@ class API(object): extra_compile_args = [ # Be very loud about everything else - "-Wall", "-Werror", "-Wconversion" + "-Wall", "-Werror", "-Weverything", + + "-Wno-unused-parameter", + "-Wno-unused-macros", + "-Wno-missing-prototypes", + "-Wno-missing-field-initializers", + "-Wno-unreachable-code", + "-Wno-padded", ] if sys.platform == "darwin": # All of OpenSSL is deprecated on OS X, so we ignore this. -- cgit v1.2.3 From a4688e23bd92fbed535b8e4fd2859b42641a8f3c Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 18:00:36 -0700 Subject: Give up --- cryptography/bindings/openssl/api.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 1dfae28d..a8cf545c 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -41,14 +41,7 @@ class API(object): extra_compile_args = [ # Be very loud about everything else - "-Wall", "-Werror", "-Weverything", - - "-Wno-unused-parameter", - "-Wno-unused-macros", - "-Wno-missing-prototypes", - "-Wno-missing-field-initializers", - "-Wno-unreachable-code", - "-Wno-padded", + "-Werror", "-Wconversion", ] if sys.platform == "darwin": # All of OpenSSL is deprecated on OS X, so we ignore this. -- cgit v1.2.3 From 32ecb669c6b0c3b5eed25121f977d9bd9e983662 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 30 Sep 2013 18:09:24 -0700 Subject: Try without this --- cryptography/bindings/openssl/api.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index a8cf545c..f4e5ab3d 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -39,10 +39,8 @@ class API(object): self.ffi.cdef(module.FUNCTIONS) includes.append(module.INCLUDES) - extra_compile_args = [ - # Be very loud about everything else - "-Werror", "-Wconversion", - ] + # Be very loud about everything else + extra_compile_args = ["-Werror"] if sys.platform == "darwin": # All of OpenSSL is deprecated on OS X, so we ignore this. extra_compile_args.append("-Wno-deprecated") -- cgit v1.2.3 From 30176cedde60094f011c7b55f58d1d83d54cc5ed Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 1 Oct 2013 10:05:47 -0700 Subject: Rewrite this comment --- cryptography/bindings/openssl/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index f4e5ab3d..58885ab7 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -39,7 +39,7 @@ class API(object): self.ffi.cdef(module.FUNCTIONS) includes.append(module.INCLUDES) - # Be very loud about everything else + # Turn any warnings into an error extra_compile_args = ["-Werror"] if sys.platform == "darwin": # All of OpenSSL is deprecated on OS X, so we ignore this. -- cgit v1.2.3 From dccaf36474ab55c6530d8fb5d8df07546d1f21f1 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 2 Oct 2013 10:10:28 -0700 Subject: Move to a saner approach --- cryptography/bindings/openssl/api.py | 16 +++++----------- cryptography/bindings/openssl/evp.py | 7 +++++-- cryptography/bindings/openssl/opensslv.py | 3 +++ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 58885ab7..f9c75e64 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -32,26 +32,20 @@ class API(object): def __init__(self): self.ffi = cffi.FFI() includes = [] + functions = [] for name in self._modules: __import__("cryptography.bindings.openssl." + name) module = sys.modules["cryptography.bindings.openssl." + name] self.ffi.cdef(module.TYPES) self.ffi.cdef(module.FUNCTIONS) - includes.append(module.INCLUDES) + self.ffi.cdef(module.MACROS) - # Turn any warnings into an error - extra_compile_args = ["-Werror"] - if sys.platform == "darwin": - # All of OpenSSL is deprecated on OS X, so we ignore this. - extra_compile_args.append("-Wno-deprecated") - # Disabled because on stock OS X there is an "-mno-fused-madd" - # which is ignored. - extra_compile_args.append("-Qunused-arguments") + functions.append(module.FUNCTIONS) + includes.append(module.INCLUDES) self.lib = self.ffi.verify( - source="\n".join(includes), + source="\n".join(includes + functions), libraries=["crypto"], - extra_compile_args=extra_compile_args, ) self.lib.OpenSSL_add_all_algorithms() diff --git a/cryptography/bindings/openssl/evp.py b/cryptography/bindings/openssl/evp.py index 8d2230fd..740f125e 100644 --- a/cryptography/bindings/openssl/evp.py +++ b/cryptography/bindings/openssl/evp.py @@ -27,12 +27,15 @@ FUNCTIONS = """ void OpenSSL_add_all_algorithms(); const EVP_CIPHER *EVP_get_cipherbyname(const char *); int EVP_EncryptInit_ex(EVP_CIPHER_CTX *, const EVP_CIPHER *, ENGINE *, - unsigned char *, unsigned char *); + const unsigned char *, const unsigned char *); int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *, int); int EVP_EncryptUpdate(EVP_CIPHER_CTX *, unsigned char *, int *, - unsigned char *, int); + const unsigned char *, int); int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *, unsigned char *, int *); int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *); const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *); int EVP_CIPHER_block_size(const EVP_CIPHER *); """ + +MACROS = """ +""" diff --git a/cryptography/bindings/openssl/opensslv.py b/cryptography/bindings/openssl/opensslv.py index 9b2db270..d1a1b3e6 100644 --- a/cryptography/bindings/openssl/opensslv.py +++ b/cryptography/bindings/openssl/opensslv.py @@ -21,3 +21,6 @@ static char *const OPENSSL_VERSION_TEXT; FUNCTIONS = """ """ + +MACROS = """ +""" -- cgit v1.2.3 From 678149022b84ce275489afef4edf84a34a3074c1 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 2 Oct 2013 10:21:17 -0700 Subject: Added an explanatory comment --- cryptography/bindings/openssl/api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index f9c75e64..93863b31 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -43,6 +43,14 @@ class API(object): functions.append(module.FUNCTIONS) includes.append(module.INCLUDES) + # We include functions here so that if we got any of their definitions + # wrong, the underlying C compiler will explode. In C you are allowed + # to re-declare a function if it has the same signature. That is: + # int foo(int); + # int foo(int); + # is legal, but the following will fail to compile: + # int foo(int); + # int foo(short); self.lib = self.ffi.verify( source="\n".join(includes + functions), libraries=["crypto"], -- cgit v1.2.3