Skip to content

Support for both OpenSSL 1.0.x and 1.1.x#19

Merged
gdanezis merged 8 commits intogdanezis:masterfrom
bogdan-kulynych:openssl-dual-version-support
May 26, 2019
Merged

Support for both OpenSSL 1.0.x and 1.1.x#19
gdanezis merged 8 commits intogdanezis:masterfrom
bogdan-kulynych:openssl-dual-version-support

Conversation

@bogdan-kulynych
Copy link
Contributor

@bogdan-kulynych bogdan-kulynych commented Oct 4, 2018

Fix #13

Core changes:

  • Add petlib/_cffi_src directory that contains C headers and sources for OpenSSL 1.0 and 1.1 bindings
  • Add utilities to get the current OpenSSL version in petlib/_compat.py
  • Update Travis config to test against both OpenSSL versions and add a script petlib/_cff_src/install_openssl_v1_1.sh that downloads and builds OpenSSL 1.1 on a Travis Ubuntu 14.04 machine. This will have to change once Travis moves to a more modern distro.

Side changes:

  • Fix a bug when importing from petlib import * (commit f87d763)
  • Update mentions of OpenSSL version in docs. Since docs and README had different instructions, I reformatted README as rst and made the documentation directly include README to avoid duplications (commit abfd257)
  • Run all the python files we touched through autopep8 formatting tool (commit 48a8d61)
  • In tox, use Python 3.6 instead of 3.4 or 3.5

Feel free to rollback any of the side changes.

We did not increment the version.

Linter output for reference:

---> pavement.lint

----------Run pylint on the library----------

pylint --rcfile=pylintrc petlib
************* Module petlib.ecdsa
petlib/ecdsa.py:223:4: W0104: Statement seems to have no effect (pointless-statement)
petlib/ecdsa.py:228:8: W0612: Unused variable 'y' (unused-variable)
************* Module petlib.bn
petlib/bn.py:27:0: E0012: Bad option value 'star-args' (bad-option-value)
petlib/bn.py:87:4: W0231: __init__ method from base class 'BnCtx' is not called (super-init-not-called)
petlib/bn.py:100:4: W0603: Using the global statement (global-statement)
petlib/bn.py:784:8: W0603: Using the global statement (global-statement)
petlib/bn.py:1032:4: W0104: Statement seems to have no effect (pointless-statement)
petlib/bn.py:1034:4: W0612: Unused variable 'X' (unused-variable)
************* Module petlib.ec
petlib/ec.py:609:16: E1130: bad operand type for unary -: NoneType (invalid-unary-operand-type)
petlib/ec.py:617:11: E1130: bad operand type for unary -: NoneType (invalid-unary-operand-type)
petlib/ec.py:650:-1: W0105: String statement has no effect (pointless-string-statement)
petlib/ec.py:657:-1: W0105: String statement has no effect (pointless-string-statement)
petlib/ec.py:669:-1: W0105: String statement has no effect (pointless-string-statement)
petlib/ec.py:676:-1: W0105: String statement has no effect (pointless-string-statement)
petlib/ec.py:688:-1: W0105: String statement has no effect (pointless-string-statement)
petlib/ec.py:695:-1: W0105: String statement has no effect (pointless-string-statement)
petlib/ec.py:707:-1: W0105: String statement has no effect (pointless-string-statement)
petlib/ec.py:714:-1: W0105: String statement has no effect (pointless-string-statement)
petlib/ec.py:1:0: W0611: Unused Const imported from bindings (unused-import)
petlib/ec.py:2:0: W0611: Unused force_Bn imported from bn (unused-import)
************* Module petlib.pack
petlib/pack.py:99:4: W0603: Using the global statement (global-statement)
petlib/pack.py:299:19: W0613: Unused argument 'obj' (unused-argument)
petlib/pack.py:302:19: W0613: Unused argument 'data' (unused-argument)
************* Module petlib.bindings
petlib/bindings.py:9:4: E0611: No name 'ffi' in module 'petlib._petlib' (no-name-in-module)
petlib/bindings.py:9:4: E0611: No name 'lib' in module 'petlib._petlib' (no-name-in-module)
petlib/bindings.py:3:0: W0611: Unused import os (unused-import)
petlib/bindings.py:4:0: W0611: Unused import platform (unused-import)
petlib/bindings.py:5:0: W0611: Unused import cffi (unused-import)
petlib/bindings.py:6:0: W0611: Unused import sys (unused-import)

------------------------------------------------------------------
Your code has been rated at 9.72/10 (previous run: 9.69/10, +0.03)

wouterl and others added 6 commits October 4, 2018 15:15
Co-authored-by: Bogdan Kulynych <hello@bogdankulynych.me>
Co-authored-by: Wouter Lueks <wouter@telox.net>
Co-authored-by: Wouter Lueks <wouter@telox.net>
Co-authored-by: Bogdan Kulynych <hello@bogdankulynych.me>
@jaromil
Copy link

jaromil commented Oct 4, 2018

Knowing the work it took to update, this is an great contribution! congrats. About the outdated travis image: its also possible to build using docker images of more recent distros.

@bogdan-kulynych bogdan-kulynych changed the title Support for both OpenSSL 1.0.2 and 1.1.x Support for both OpenSSL 1.0.x and 1.1.x Oct 4, 2018
The code automatically detects the correct homebrew installed OpenSSL version, preferring version 1.1.x to version 1.0. Updated the README to always advice people to install the 1.1 version.
@wouterl
Copy link

wouterl commented Oct 29, 2018

Tweaked the code a bit to make version detection on MacOS more robust. It will now automatically pick openssl version 1.1 over version 1.0 if installed.

@wouterl
Copy link

wouterl commented Dec 20, 2018

Extra fix to include C source files for the binding so that bplib -- which hooks directly into them -- compiles against the new version of petlib.

Sorry, one of the Travis builds failed because of an apt-get update quirk (and I cannot request another build).

@gdanezis gdanezis merged commit 0f3c109 into gdanezis:master May 26, 2019
@gdanezis
Copy link
Owner

Merging the OpenSSL 1.1 compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

petlib fails to compile with openssl 1.1

4 participants