Coder Social home page Coder Social logo

crocs-muni / roca Goto Github PK

View Code? Open in Web Editor NEW
478.0 39.0 92.0 416 KB

ROCA: Infineon RSA key vulnerability

Home Page: https://roca.crocs.fi.muni.cz

License: MIT License

Python 88.80% Shell 0.08% Java 3.53% C# 5.97% Sage 1.61%
roca infineon rsa-keys discrete-logarithm rsa fingerprinting detector roca-detector python roca-detec

roca's Introduction

ROCA detection tool

Build Status

This tool is related to ACM CCS 2017 conference paper #124 Return of the Coppersmith’s Attack: Practical Factorization of Widely Used RSA Moduli.

It enables you to test public RSA keys for a presence of the described vulnerability.

Update 4.11.2017: Python 2.7, 3.4+ supported.

Update 30.10.2017: The paper of the attack is already online, ACM version.

Update 30.10.2017: The discrete logarithm detector is now implemented in the Python and used as a default. It detects the structure in the primes exploited by the factorizing algorithm.

Currently the tool supports the following key formats:

  • X509 Certificate, DER encoded, one per file, *.der, *.crt
  • X509 Certificate, PEM encoded, more per file, *.pem
  • X509 Certificate Signing Request, PEM encoded, more per file, *.pem
  • RSA PEM encoded private key, public key, more per file, *.pem (has to have correct header -----BEGIN RSA...)
  • SSH public key, *.pub, starting with "ssh-rsa", one per line
  • ASC encoded PGP key, *.pgp, *.asc. More per file, has to have correct header -----BEGIN PGP...
  • APK android application, *.apk
  • one modulus per line text file *.txt, modulus can be a) base64 encoded number, b) hex coded number, c) decimal coded number
  • JSON file with moduli, one record per line, record with modulus has key "mod" (int, base64, hex, dec encoding supported) certificate(s) with key "cert" / array of certificates with key "certs" are supported, base64 encoded DER.
  • LDIFF file - LDAP database dump. Any field ending with ;binary:: is attempted to decode as X509 certificate
  • Java Key Store file (JKS). Tries empty password & some common, specify more with --jks-pass-file
  • PKCS7 signature with user certificate

The detection tool is intentionally one-file implementation for easy integration / manipulation.

False positive

False positive detection rates:

  • Moduli detector: 2^-27
  • Discrete logarithm detector: 2^-154

Discrete logarithm detector is implemented only in the Python code, used as the default detection method.

Java and C# code ports are unmaintained since the original publication and we don't plan to upgrade these detectors to the more precise method. However PR are welcome!

Online checker

https://keychest.net/roca

The online checker is using the discrete logarithm detector algorithm.

Install with pip

Install the detector library + tool with pip (installs all dependencies):

pip install roca-detect

Local install

Execute in the root folder of the package:

pip install --upgrade --find-links=. .

Dependencies

It may be required to install additional dependencies so pip can install e.g. cryptography package.

CentOS / RHEL:

sudo yum install python-devel python-pip gcc gcc-c++ make automake autoreconf libtool openssl-devel libffi-devel dialog

Ubuntu:

sudo apt-get install python-pip python-dev build-essential libssl-dev libffi-dev swig

Usage

To print the basic usage:

# If installed with pip / manually
roca-detect --help

# Without installation (can miss dependencies)
python roca/detect.py

The testing tool accepts multiple file names / directories as the input argument. It returns the report showing how many files has been fingerprinted (and which are those).

Example (no vulnerabilities found):

Running recursively on all my SSH keys and known_hosts:

$> roca-detect ~/.ssh
2017-10-16 13:39:21 [51272] INFO ### SUMMARY ####################
2017-10-16 13:39:21 [51272] INFO Records tested: 92
2017-10-16 13:39:21 [51272] INFO .. PEM certs: . . . 0
2017-10-16 13:39:21 [51272] INFO .. DER certs: . . . 0
2017-10-16 13:39:21 [51272] INFO .. RSA key files: . 16
2017-10-16 13:39:21 [51272] INFO .. PGP master keys: 0
2017-10-16 13:39:21 [51272] INFO .. PGP total keys:  0
2017-10-16 13:39:21 [51272] INFO .. SSH keys:  . . . 76
2017-10-16 13:39:21 [51272] INFO .. APK keys:  . . . 0
2017-10-16 13:39:21 [51272] INFO .. JSON keys: . . . 0
2017-10-16 13:39:21 [51272] INFO .. LDIFF certs: . . 0
2017-10-16 13:39:21 [51272] INFO .. JKS certs: . . . 0
2017-10-16 13:39:21 [51272] INFO .. PKCS7: . . . . . 0
2017-10-16 13:39:21 [51272] INFO No fingerprinted keys found (OK)
2017-10-16 13:39:21 [51272] INFO ################################

Example (vulnerabilities found):

Running recursively on all my SSH keys and known_hosts:

$> roca-detect ~/.ssh
<b>2017-10-16 13:39:21 [51272] WARNING Fingerprint found in the Certificate</b>
...
2017-10-16 13:39:21 [51272] INFO ### SUMMARY ####################
2017-10-16 13:39:21 [51272] INFO Records tested: 92
2017-10-16 13:39:21 [51272] INFO .. PEM certs: . . . 0
2017-10-16 13:39:21 [51272] INFO .. DER certs: . . . 0
2017-10-16 13:39:21 [51272] INFO .. RSA key files: . 16
2017-10-16 13:39:21 [51272] INFO .. PGP master keys: 0
2017-10-16 13:39:21 [51272] INFO .. PGP total keys:  0
2017-10-16 13:39:21 [51272] INFO .. SSH keys:  . . . 76
2017-10-16 13:39:21 [51272] INFO .. APK keys:  . . . 0
2017-10-16 13:39:21 [51272] INFO .. JSON keys: . . . 0
2017-10-16 13:39:21 [51272] INFO .. LDIFF certs: . . 0
2017-10-16 13:39:21 [51272] INFO .. JKS certs: . . . 0
2017-10-16 13:39:21 [51272] INFO .. PKCS7: . . . . . 0
2017-10-16 13:39:21 [51272] INFO Fingerprinted keys found: 1
2017-10-16 13:39:21 [51272] INFO WARNING: Potential vulnerability
2017-10-16 13:39:21 [51272] INFO ################################

PGP key

In order to test your PGP key you can export it from your email client or download it from the PGP key server such as https://pgp.mit.edu/

You can also use gpg command line utility to export your public key:

gpg --armor --export [email protected] > mykey.asc

Advanced use case

Detection tool extracts information about the key which can be displayed:

roca-detect.py --dump --flatten --indent  ~/.ssh/

TLS/SSL detection

The roca-detect-tls detects certificates from remote TLS/SSL ports. Provide a file with a newline-delimited list of address:port entries and use that file as input.

Example file: tls_list.txt

github.com:443
google.com:443
internal.example.com:8080

Then run:

roca-detect-tls tls_list.txt

Fake moduli

It is possible to generate moduli that passes the moduli fingerprinting test but actually do not contain structure the factorization algorithm is using. Dlog moduli test do not mark those as positive.

Advanced installation methods

Virtual environment

It is usually recommended to create a new python virtual environment for the project:

virtualenv ~/pyenv
source ~/pyenv/bin/activate
pip install --upgrade pip
pip install --upgrade --find-links=. .

Separate Python 2.7.13

We tested tool with Python 2.7.13 and it works (see Travis for more info). We have reports saying lower versions (<=2.6) do not work properly so we highly recommend using up to date Python 2.7

Use pyenv to install a new Python version locally if you cannot / don't want to update system Python.

It internally downloads Python sources and installs it to ~/.pyenv.

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
exec $SHELL
pyenv install 2.7.13
pyenv local 2.7.13

Python 3

Detection tools works also with Python 3.4+

Docker container

Run via Docker container to avoid environment inconsistency. Dockerfile source can be audited at https://hub.docker.com/r/unnawut/roca-detect/.

docker run --rm -v /path/to/your/keys:/keys --network none unnawut/roca-detect

Make sure to use --rm and --network none flags to disable container's network connection and delete the container after running.

Licensing

Code is licensed under permissive MIT license.

As there were requests on dual licensing under Apache 2.0 license (due to some doubts on compatibility) we are licensing the code also under Apache 2.0 license.

Pick license that suits you better, either MIT or Apache 2.0.

Language ports

This section contains links to different GIT repositories with language ports

roca's People

Contributors

fcharlier avatar hoexer avatar jariq avatar jhart-r7 avatar kalinych avatar matusn avatar petrs avatar ph4r05 avatar pirxthepilot avatar reaperhulk avatar scholtz avatar titanous avatar unnawut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roca's Issues

false positives on safe key lengths

Online checker marks keys with a length of 1920 bits as vulnerables. But this key size is safe to Coppersmith's attack (figure 1 on paper).

Is the detection tool aware of the lengths considered safe?

Add support for URLs

Seems it would be useful to allow giving URLs on the command line for testing. Or am I totally misunderstanding something?

roca and Python 2 (dependency on future)

I have one simple question – Do you still need to support Python 2 for roca? I'm asking because this project uses future. future will no longer work with Python 3.12 because imp module has been removed from stdlib and the situation will be even worse with 3.13 because the lib2to3 which is the core of the future will be removed from stdlib as well.

It should be simple to remove the dependency on future, it's a good idea to do it, and I can help you with that if you want to.

Summary shows wrong info

When using the versions 1.2.1 and 1.2.0, the summary doesn't show a warning:

 roca-detect ~/Applications/roca/roca/tests/data/cert04.pem 
2017-11-07 09:51:43 [24167] WARNING Fingerprint found in the Certificate [SNIPPED]/Applications/roca/roca/tests/data/cert04.pem idx 0 
{"type": "pem-cert", "fname": "[SNIPPED]/Applications/roca/roca/tests/data/cert04.pem", "idx": 0, "fprint": "f49266bd45ac6a55cfb36b032d7c3c9725f557c053054f4a91523b4a45277b58", "subject": "CN: localhost", "issuer": "CN: localhost", "issuer_org": null, "created_at": "2017-10-16", "created_at_utc": 1508182701.0, "not_valid_after_utc": 1539718701.0, "pem": "-----BEGIN CERTIFICATE-----\nMIICpTCCAYwCCQC2u0PIfFaGMjANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAls\nb2NhbGhvc3QwHhcNMTcxMDE2MTkzODIxWhcNMTgxMDE2MTkzODIxWjAUMRIwEAYD\nVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQJZ\nJ7UrpeaMjJJou5IY83ZzYUymVBj0dFsUPNTuU/lJHJoOHC8jqVFjBq/784ZnuHG8\nDMguYPW7Gp+hWlZxp2XJ8huVh9gBFZZDcqODyIOw3L9sd1cGsx6v8+P9SIVZoIze\nog+al8TFm2uKjuykV9SoINSVCfdZM2MCvKGjaQsICRgR+Fjy6M6lpiNVrW4EHRk1\n7aWSibWXaDtz4mV650v/x2Dk1RPMh9uTVZGOqgjTmLvl9oNdyHElIRubNrOgvHC5\nk6bLP30stAYd5z25cslCrfmVW2/kzZDwDQiK7ASvH17/kfIa9e1EYXx9uAk/lTZt\nsmWAxK85neuU+bFBMFvhAgMBAAEwDQYJKoZIhvcNAQELBQADggECAAG7W49CYRUk\nYAFRGXu3M85MKOISyc/kkJ8nbHdV6GxJ05FkoDKbcbZ7nncJiIp2VMAMEIP4bRTJ\n5U4g4vSZlmCs8BDmV3Ts/tbDCM6eqK+2hwjhUnCnmmsLt4xVUeAAsWUHl9AVtjzd\noYlm1Kk20QBzNpsvM/gFS5B+duHvTSfELfoq9Pdfvmn2gEXJHe9scO8bfT3fm15z\nR6AUYsSsxAhup2Rix6jgJ14KGsh6uVm6jhz9aBTBcgx7iMuuP8zUbUE6nryHYXnR\ncSvuYSesTCoFfnL7elrZDak/n0jLfwUD80aWnReJfu9QQGdqdDnSG8lSQ1XPOC7O\n/hFW9l0TCzOE\n-----END CERTIFICATE-----", "aux": null, "e": "0x10001", "n": "0x25927b52ba5e68c8c9268bb9218f37673614ca65418f4745b143cd4ee53f9491c9a0e1c2f23a9516306affbf38667b871bc0cc82e60f5bb1a9fa15a5671a765c9f21b9587d80115964372a383c883b0dcbf6c775706b31eaff3e3fd488559a08cdea20f9a97c4c59b6b8a8eeca457d4a820d49509f759336302bca1a3690b08091811f858f2e8cea5a62355ad6e041d1935eda59289b597683b73e2657ae74bffc760e4d513cc87db9355918eaa08d398bbe5f6835dc87125211b9b36b3a0bc70b993a6cb3f7d2cb4061de73db972c942adf9955b6fe4cd90f00d088aec04af1f5eff91f21af5ed44617c7db8093f95366db26580c4af399deb94f9b141305be1", "marked": true, "time_years": 85.25100750352632, "price_aws_c4": 37365.516588795595}
2017-11-07 09:51:43 [24167] INFO ### SUMMARY ####################
2017-11-07 09:51:43 [24167] INFO Records tested: 0
2017-11-07 09:51:43 [24167] INFO .. PEM certs: . . . 1
2017-11-07 09:51:43 [24167] INFO .. DER certs: . . . 0
2017-11-07 09:51:43 [24167] INFO .. RSA key files: . 0
2017-11-07 09:51:43 [24167] INFO .. PGP master keys: 0
2017-11-07 09:51:43 [24167] INFO .. PGP total keys:  0
2017-11-07 09:51:43 [24167] INFO .. SSH keys:  . . . 0
2017-11-07 09:51:43 [24167] INFO .. APK keys:  . . . 0
2017-11-07 09:51:43 [24167] INFO .. JSON keys: . . . 0
2017-11-07 09:51:43 [24167] INFO .. LDIFF certs: . . 0
2017-11-07 09:51:43 [24167] INFO .. JKS certs: . . . 0
2017-11-07 09:51:43 [24167] INFO .. PKCS7: . . . . . 0
2017-11-07 09:51:43 [24167] INFO No fingerprinted keys found (OK)
2017-11-07 09:51:43 [24167] INFO ################################

When using the version 1.0.3, the output is:

$ roca-detect ~/Applications/roca/roca/tests/data/cert04.pem 
2017-11-07 09:56:10 [24355] WARNING Fingerprint found in the Certificate [SNIPPED]/Applications/roca/roca/tests/data/cert04.pem idx 0 
{"type": "pem-cert", "fname": "[SNIPPED]/Applications/roca/roca/tests/data/cert04.pem", "idx": 0, "fprint": "f49266bd45ac6a55cfb36b032d7c3c9725f557c053054f4a91523b4a45277b58", "subject": "CN: localhost", "issuer": "CN: localhost", "issuer_org": null, "created_at": "2017-10-16", "created_at_utc": 1508182701.0, "not_valid_after_utc": 1539718701.0, "pem": "-----BEGIN CERTIFICATE-----\nMIICpTCCAYwCCQC2u0PIfFaGMjANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAls\nb2NhbGhvc3QwHhcNMTcxMDE2MTkzODIxWhcNMTgxMDE2MTkzODIxWjAUMRIwEAYD\nVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQJZ\nJ7UrpeaMjJJou5IY83ZzYUymVBj0dFsUPNTuU/lJHJoOHC8jqVFjBq/784ZnuHG8\nDMguYPW7Gp+hWlZxp2XJ8huVh9gBFZZDcqODyIOw3L9sd1cGsx6v8+P9SIVZoIze\nog+al8TFm2uKjuykV9SoINSVCfdZM2MCvKGjaQsICRgR+Fjy6M6lpiNVrW4EHRk1\n7aWSibWXaDtz4mV650v/x2Dk1RPMh9uTVZGOqgjTmLvl9oNdyHElIRubNrOgvHC5\nk6bLP30stAYd5z25cslCrfmVW2/kzZDwDQiK7ASvH17/kfIa9e1EYXx9uAk/lTZt\nsmWAxK85neuU+bFBMFvhAgMBAAEwDQYJKoZIhvcNAQELBQADggECAAG7W49CYRUk\nYAFRGXu3M85MKOISyc/kkJ8nbHdV6GxJ05FkoDKbcbZ7nncJiIp2VMAMEIP4bRTJ\n5U4g4vSZlmCs8BDmV3Ts/tbDCM6eqK+2hwjhUnCnmmsLt4xVUeAAsWUHl9AVtjzd\noYlm1Kk20QBzNpsvM/gFS5B+duHvTSfELfoq9Pdfvmn2gEXJHe9scO8bfT3fm15z\nR6AUYsSsxAhup2Rix6jgJ14KGsh6uVm6jhz9aBTBcgx7iMuuP8zUbUE6nryHYXnR\ncSvuYSesTCoFfnL7elrZDak/n0jLfwUD80aWnReJfu9QQGdqdDnSG8lSQ1XPOC7O\n/hFW9l0TCzOE\n-----END CERTIFICATE-----", "aux": null, "e": "0x10001", "n": "0x25927b52ba5e68c8c9268bb9218f37673614ca65418f4745b143cd4ee53f9491c9a0e1c2f23a9516306affbf38667b871bc0cc82e60f5bb1a9fa15a5671a765c9f21b9587d80115964372a383c883b0dcbf6c775706b31eaff3e3fd488559a08cdea20f9a97c4c59b6b8a8eeca457d4a820d49509f759336302bca1a3690b08091811f858f2e8cea5a62355ad6e041d1935eda59289b597683b73e2657ae74bffc760e4d513cc87db9355918eaa08d398bbe5f6835dc87125211b9b36b3a0bc70b993a6cb3f7d2cb4061de73db972c942adf9955b6fe4cd90f00d088aec04af1f5eff91f21af5ed44617c7db8093f95366db26580c4af399deb94f9b141305be1", "marked": true, "time_years": 85.25100750352632, "price_aws_c4": 37365.516588795595}
2017-11-07 09:56:10 [24355] INFO ### SUMMARY ####################
2017-11-07 09:56:10 [24355] INFO Records tested: 1
2017-11-07 09:56:10 [24355] INFO .. PEM certs: . . . 1
2017-11-07 09:56:10 [24355] INFO .. DER certs: . . . 0
2017-11-07 09:56:10 [24355] INFO .. RSA key files: . 0
2017-11-07 09:56:10 [24355] INFO .. PGP master keys: 0
2017-11-07 09:56:10 [24355] INFO .. PGP total keys:  0
2017-11-07 09:56:10 [24355] INFO .. SSH keys:  . . . 0
2017-11-07 09:56:10 [24355] INFO .. APK keys:  . . . 0
2017-11-07 09:56:10 [24355] INFO .. JSON keys: . . . 0
2017-11-07 09:56:10 [24355] INFO .. LDIFF certs: . . 0
2017-11-07 09:56:10 [24355] INFO .. JKS certs: . . . 0
2017-11-07 09:56:10 [24355] INFO .. PKCS7: . . . . . 0
2017-11-07 09:56:10 [24355] INFO Fingerprinted keys found: 1
2017-11-07 09:56:10 [24355] INFO WARNING: Potential vulnerability
2017-11-07 09:56:10 [24355] INFO ################################

Please correct me, if this is a feature.

Vulnerable certificates in tests not detected

With the latest 1.2.11, the certificates under tests failed when trying to get the STREET_ADDRESS attribute and they are not detected:

14:09:58 02 jbiosca@alien ~/roca/rocacheck/roca-detect/roca-master/roca
python3 detect.py --debug tests/data/cert04.pem
2018-03-02 14:09:59 [12274] DEBUG processing tests/data/cert04.pem as PEM
2018-03-02 14:10:00 [12274] DEBUG PEM processing failed: type object 'NameOID' has no attribute 'STREET_ADDRESS'
2018-03-02 14:10:00 [12274] DEBUG type object 'NameOID' has no attribute 'STREET_ADDRESS'
2018-03-02 14:10:00 [12274] DEBUG Traceback (most recent call last):
File "detect.py", line 1288, in process_pem_cert
return self.process_x509(x509, name=name, idx=idx, data=data, pem=True, source='pem-cert')
File "detect.py", line 1403, in process_x509
js['subject'] = utf8ize(try_get_dn_string(x509.subject, shorten=True))
File "detect.py", line 250, in try_get_dn_string
NameOID.STREET_ADDRESS: "St",
AttributeError: type object 'NameOID' has no attribute 'STREET_ADDRESS'

2018-03-02 14:10:00 [12274] INFO ### SUMMARY ####################
2018-03-02 14:10:00 [12274] INFO Records tested: 0
2018-03-02 14:10:00 [12274] INFO .. PEM certs: . . . 1
2018-03-02 14:10:00 [12274] INFO .. DER certs: . . . 0
2018-03-02 14:10:00 [12274] INFO .. RSA key files: . 0
2018-03-02 14:10:00 [12274] INFO .. PGP master keys: 0
2018-03-02 14:10:00 [12274] INFO .. PGP total keys: 0
2018-03-02 14:10:00 [12274] INFO .. SSH keys: . . . 0
2018-03-02 14:10:00 [12274] INFO .. APK keys: . . . 0
2018-03-02 14:10:00 [12274] INFO .. JSON keys: . . . 0
2018-03-02 14:10:00 [12274] INFO .. LDIFF certs: . . 0
2018-03-02 14:10:00 [12274] INFO .. JKS certs: . . . 0
2018-03-02 14:10:00 [12274] INFO .. PKCS7: . . . . . 0
2018-03-02 14:10:00 [12274] DEBUG . Total RSA keys . 1 (# of keys RSA extracted & analyzed)
2018-03-02 14:10:00 [12274] INFO No fingerprinted keys found (OK)
2018-03-02 14:10:00 [12274] INFO ################################

Withouth --debug there are not warnings or errors and they appear to be valid.

would like positive X.509 certificate test vector

I'm trying to embed the Java code into another testing tool that is aimed at X.509 certificates, and I'm therefore looking for an X.509 test vector.

At the moment it looks like the certificate-format test files (cert01.pem, cert02.pem, cert03.pem) are all negative tests. Similarly privkey03.pem.

It would be useful to have an X.509 version of one of the other positive tests, or a private key file that I could use with openssl to create one myself.

non-ascii-armored, non-vulnerable pgp keys show warning

I'm seeing warnings for PGP keys that should be perfectly fine.

Take for example my own key:
gpg --recv-key FE73757FA60E4E21B937579FA5880072BBB51E42

If you export it with ascii armor it's perfectly fine:
gpg --export --armor FE73757FA60E4E21B937579FA5880072BBB51E42 > foo.asc
roca-detect foo.asc

However if you take the non-ascii-armor version:
gpg --export FE73757FA60E4E21B937579FA5880072BBB51E42 > foo
roca-detect foo
2017-10-16 22:26:18 [17716] WARNING Fingerprint found in modulus foo idx 237
{"type": "mod-hex", "fname": "foo", "idx": 237, "aux": null, "n": "0x1", "marked": true, "time_years": -1, "price_aws_c4": -1}
2017-10-16 22:26:18 [17716] WARNING Fingerprint found in modulus foo idx 237
{"type": "mod-dec", "fname": "foo", "idx": 237, "aux": null, "n": "0x1", "marked": true, "time_years": -1, "price_aws_c4": -1}

My guess is that it's not properly detecting the pgp key format and interpreting the key as something else which triggers the warning. In any case: I'm 100% sure this key was generated with gpg itself and not any infineon chip, so it can't be vulnerable (unless gpg suffers from the same vuln in some strange way).

Parse public keys in PGP and S/MIME formats out of common mailbox types?

Is there a relatively clean way to parse a mail archive for public keys and feed that to roca-detect?

Archives might be in formats like mbox, maildir, mix, dbox, etc, and would have a variety of public key formats including -----BEGIN PGP PUBLIC KEY BLOCK----- embedded in message bodies, MIME attachments like application/pgp-keys, etc.

Rozklad N

Čaute, snažíme sa rozložiť konkrétne číslo na 2 prvočísla.. na základe tohto threadu https://platforma.slovensko.digital/t/eid-prelomene/4291/378 tu: https://platforma.slovensko.digital/t/hackovanie-suchalovho-kluca/4348

Nechcete pomôcť?

Ináč som si všimol, že v .net teste sa vracia true iba v prípade ak celá iterácia roca testu nič nenájde. Nechápem prečo, lebo ak si vymyslím vlastnú iteráciu, npr či N % 2 = 0 a nenájde mi to žiadny výsledok, automaticky to hádam neznamená, že certifikát je chybný ? Správne by malo byť, že ak sa identifikuje nejaké číslo napríklad N % 3 = 1, tak práve vtedy test detekuje chybný certifikát.

C# code unusable after merge of #18 and #20

Changes introduced by @scholtz and merged by @ph4r05 in PRs #18 and #20 turned C# sample code unusable. IMO these changes should be reverted and any further changes to C# codebase should be reviewed by someone familiar with .NET tooling.

Problems in PR #18

  • as @darinkes correctly pointed out this change has broken validation of certificate files from data directory
  • introduces dependency on AGPL licensed iTextSharp which IMO should not be used in MIT licensed project
  • does not correctly set project references and makes it impossible to build the project without manual tweaking
  • information printed to the console cannot be easily understood without reading the code first

Problems in PR #20

  • does not correctly set project references and makes it impossible to build the project without manual tweaking
  • information printed to the console cannot be easily understood without reading the code first

I first wanted to open new PR and fix problems mentioned above but then gave up because of lack of free time and lack of will to deal with introduced code formatting.

Vulnerable key output

Can you post example output of roca-detect for vulnerable keys? It is not clear to how to interpret console output.

False negative rate

The documentation mentions the false positive rate.
Is there any estimation of the false negative rate?

False positive warnings with random files

When running roca-detect I see that arbitrary files sometimes give warnings of this form:

2018-02-01 11:13:58 [7088] WARNING Fingerprint found in modulus roca-false idx 1 
{"type": "mod-hex", "fname": "roca-false", "idx": 1, "aux": null, "n": "0x1", "marked": true, "time_years": -1, "price_aws_c4": -1}

In this case the file is just random garbage (example attached). But I often see that roca-detect seems to think that legit files that aren't cryptographic keys at all (pdfs, executables etc.) show up with this warning. Can these be avoided?
roca-false.zip

roca-detect not analyzing RSA/SSH keys

Case 1: Newly-generated RSA keypair

Commands:

$ ssh-keygen -t rsa -C "[email protected]" -f test_key
$ roca-detect test_key
$ roca-detect test_key.pub

Output:

2017-10-17 04:11:20 [1987] INFO ### SUMMARY ####################
2017-10-17 04:11:20 [1987] INFO Records tested: 12
2017-10-17 04:11:20 [1987] INFO .. PEM certs: . . . 0
2017-10-17 04:11:20 [1987] INFO .. DER certs: . . . 0
2017-10-17 04:11:20 [1987] INFO .. RSA key files: . 0
2017-10-17 04:11:20 [1987] INFO .. PGP master keys: 0
2017-10-17 04:11:20 [1987] INFO .. PGP total keys:  0
2017-10-17 04:11:20 [1987] INFO .. SSH keys:  . . . 0
2017-10-17 04:11:20 [1987] INFO .. APK keys:  . . . 0
2017-10-17 04:11:20 [1987] INFO .. JSON keys: . . . 0
2017-10-17 04:11:20 [1987] INFO .. LDIFF certs: . . 0
2017-10-17 04:11:20 [1987] INFO .. JKS certs: . . . 0
2017-10-17 04:11:20 [1987] INFO .. PKCS7: . . . . . 0
2017-10-17 04:11:20 [1987] INFO No fingerprinted keys found (OK)
2017-10-17 04:11:20 [1987] INFO ################################

Note that by removing test_key and test_key.pub and run the command with roca-detect ., the command still outputs Records tested: 12. No files (including hidden) are in the given folder.

Expected: The command detects the keys (I'm not sure if it should be PEM certs, RSA key files, or SSH keys, or other, but none is showing).


Case 2: Downloaded crocs-muni/roca's positive pem key

Commands:

$ curl https://raw.githubusercontent.com/crocs-muni/roca/master/roca/tests/data/cert05.pem --output cert05.pem
$ roca-detect cert05.pem

Output:

2017-10-17 04:17:45 [2034] INFO ### SUMMARY ####################
2017-10-17 04:17:45 [2034] INFO Records tested: 0
2017-10-17 04:17:45 [2034] INFO .. PEM certs: . . . 0
2017-10-17 04:17:45 [2034] INFO .. DER certs: . . . 0
2017-10-17 04:17:45 [2034] INFO .. RSA key files: . 0
2017-10-17 04:17:45 [2034] INFO .. PGP master keys: 0
2017-10-17 04:17:45 [2034] INFO .. PGP total keys:  0
2017-10-17 04:17:45 [2034] INFO .. SSH keys:  . . . 0
2017-10-17 04:17:45 [2034] INFO .. APK keys:  . . . 0
2017-10-17 04:17:45 [2034] INFO .. JSON keys: . . . 0
2017-10-17 04:17:45 [2034] INFO .. LDIFF certs: . . 0
2017-10-17 04:17:45 [2034] INFO .. JKS certs: . . . 0
2017-10-17 04:17:45 [2034] INFO .. PKCS7: . . . . . 0
2017-10-17 04:17:45 [2034] INFO No fingerprinted keys found (OK)
2017-10-17 04:17:45 [2034] INFO ################################

Expected: The command warns of potential vulnerability.


Case 3: Downloaded crocs-muni/roca's positive GPG key

Commands:

$ curl https://raw.githubusercontent.com/crocs-muni/roca/master/roca/tests/data/key04.pgp --output key04.pgp
$ roca-detect key04.pgp

Output:

2017-10-17 04:19:30 [2041] WARNING Fingerprint found in PGP key key04.pgp key ID 0x85052d6915c34dc4
{"type": "pgp", "fname": "key04.pgp", "fname_idx": 0, "master_key_id": "69825656415676c0", "master_fprint": "42FC1322AE0C0E495687454269825656415676C0", "identities": [{"name": "[email protected]", "email": "[email protected]"}], "signatures_count": 3, "packets_count": 7, "keys_count": 3, "signature_keys": ["85052D6915C34DC4"], "created_at": "2017-05-06", "created_at_utc": 1494098780.0, "is_master": false, "kid": "85052d6915c34dc4", "bitsize": 4096, "master_kid": "69825656415676c0", "e": "0x10001", "n": "0x9226986e6f4d3c3121d7676c5431a79dbb3187f325ce56928610c984b42015b1f87ca59ae6fa98ba0761b166d58f22ad2bb542e6c88c29c2d5270bc10cc7c9e5948fe6d5a7ac433d6479c69966e88bcbb82c98339c61b7451c781c18ae5b8fb9942f1f867c7405f3a1487d1c9d1d1a6c2b3f984f25778ffdf73ddc431197e5572946ed42f97afa54fd6d6f33c876133982214797adbf81e33b7e0d005cd974ae369bf4537f5c2a94c7634c45009a8c42d679d37933680acd74e64256a8a9b97cda4f410140d588450cc85c9a7761f2625ba68cacf103e2971e5773467a039c563a7f64645a897f2a75797a8d091c9b389561c063357490f8dab4f4b77930bd95ab3c80c07be6c5a6d3e64ba71579d3bf5375370dcaf3209fa62f4167dab58587df343646bd31bf8d1933cb5993f739ce431cb42c64f2f55219589ac77a94d4f5d9ef886ed2c6b40db0b6a9e1560778b09aa618436fa84e84ad5751be8230adeefce7d8aae9b4b800a1bae65cd4380eea2dc0bd1068db06af5f6f6d46496bc68c7f8f8b1bc155160f276df04326e4771e344ea7570b0c33f267c1a068f54da7aa82846acdcddd534e38b00138db38d94399aac16189bd8711a40d1a71d50f02a139bde5292c9a76e573e1eaefbfd69794b5b5525499651e6973912b54b86a2f7b58e7b80adf3626f54ff2d488fdfb8f2b70aee44d97d6bda170bffee6e9dc55b3", "marked": true, "time_years": 776705277.0892105, "price_aws_c4": 340429922948.201}
2017-10-17 04:19:30 [2041] WARNING Fingerprint found in PGP key key04.pgp key ID 0x6f2887dba4bbd140
{"type": "pgp", "fname": "key04.pgp", "fname_idx": 0, "master_key_id": "69825656415676c0", "master_fprint": "42FC1322AE0C0E495687454269825656415676C0", "identities": [{"name": "[email protected]", "email": "[email protected]"}], "signatures_count": 3, "packets_count": 7, "keys_count": 3, "signature_keys": ["85052D6915C34DC4"], "created_at": "2017-05-06", "created_at_utc": 1494098780.0, "is_master": false, "kid": "6f2887dba4bbd140", "bitsize": 4032, "master_kid": "69825656415676c0", "e": "0x10001", "n": "0x9a652f174b36fef8371f9b67a383452485b2b7a052dc18f423e2dc809107161564b81eb59b5c6888d4ee0bba4c6b876b5709c112ce5be098ad3e4d1833a02d0a567f9747c3bd0e10e2a2c3d91c49b603f793176091904e51f1d0f23949b40dbd587a41bf30a589b06b39002de657b6e795cd626d09a4c7561dce67e7d69f9cd7f1a6c97fa4a56a04a6eb75eb3e12781c4badfa1b5a0b2e76a61a23e4938a21312d5473c35d7ecbf218dbc4b7399b019bf3c1348be1c9bc36adcfc1ebc60538304a7ef608d273318a9d2c808fba076be98994c129057410cee6308cc259743ecb6a45702a760b2d724f55537f78036c685c5ff9dbc5ef4825357db83d6d59344d6cee1b7900e9e37b57fc022d3d5bba20920c2467eb2426969acd28f6ece1870daa86ce1007478f0b7b9848f701693c4f7eee41b6935ba372455775be0ff897f378b1030ddf7ce7acefbc9ec59412350af801637e94d2345de6856330b1c47920fa2fa14aa6ba7185c03fdf7523aace3bd51087e43f466eefe65a818c2a2a1a6e7cb483ee0a61a5c4d562168f18822a72cc3684f83077d7702ad29bc45812e8fa8aee16af4976a8eab02be6140c6a28f518b2434fecf4ab9ef83f4cce90aac7bb49ae786d4776e6000b473cd80703e7a39693ee65056efb9affa8f1e252134e933dbdc13477d76199729453519b3a8a6fce564de145a32865", "marked": true, "time_years": 122124147.91450001, "price_aws_c4": 53527014030.92536}
2017-10-17 04:19:30 [2041] WARNING Fingerprint found in PGP key key04.pgp key ID 0x69825656415676c0
{"type": "pgp", "fname": "key04.pgp", "fname_idx": 0, "master_key_id": "69825656415676c0", "master_fprint": "42FC1322AE0C0E495687454269825656415676C0", "identities": [{"name": "[email protected]", "email": "[email protected]"}], "signatures_count": 3, "packets_count": 7, "keys_count": 3, "signature_keys": ["85052D6915C34DC4"], "created_at": "2017-05-06", "created_at_utc": 1494098780.0, "is_master": true, "kid": "69825656415676c0", "bitsize": 3968, "master_kid": "69825656415676c0", "e": "0x10001", "n": "0x93d74f131fc356077aee29fd528e908c78c6504e3dda636d936aa4c05a6279e431c012f2fce107e9b1817336ec1ec51c39aebff73766582fbc6f3735c1764bbdc543a4e9b5ab9189dc1ac7ec3f82305744dca485c452880ea7031d1e926ec4a00ecb4073eaf735dd8c468de1f449bd67d36161c30a5ec9d0eaf457b3608784d8be3be42408d751711e129787572c94ab06bb46fc1b884cf9128843bc86f72cfef64c658329d2bc0d9d632ec4dfc7d67d3c985a28172e50953bc15bed73dfb2203bf60a47616bcdd25102123a53a371080fa5104f97424a6fed67bc83ed8a8731a8551fd66babdbebd9bd4ab589656a4de6c9fd1502632ed8498b5e1b7e37ec338ff19a91b974ac92fc166c47d0f03d10d0dcc3ce76a36b131973b1b36752592dc17d0f4ce6709de44ae1d2c702e8198a81f7b1a1c12298471675ac86bb75e2c4623619747bb57880d10cc5ff4b3d1c9ca908256fec52032a1230751500cbbc84d125d96c60bf5a3d6bf92240197c3244455f22b48654b7e2bf58c033b17022b829abf8572b1d4f5cd512bf472febf4c59819c700ad6d7929c5cb008b5754cf5176d00b024d2c64131087c8a4dc9db0615558af041d8d543b7b21c9c5f118382dbebe139e95b8ae7c810f330f7c3be1a6273d758679ee2b000916b82f048b54c8f0084142fae999cf763bd7a573580d23", "marked": true, "time_years": 29022724.31603158, "price_aws_c4": 12720660067.716642}
2017-10-17 04:19:30 [2041] INFO ### SUMMARY ####################
2017-10-17 04:19:30 [2041] INFO Records tested: 3
2017-10-17 04:19:30 [2041] INFO .. PEM certs: . . . 0
2017-10-17 04:19:30 [2041] INFO .. DER certs: . . . 0
2017-10-17 04:19:30 [2041] INFO .. RSA key files: . 0
2017-10-17 04:19:30 [2041] INFO .. PGP master keys: 1
2017-10-17 04:19:30 [2041] INFO .. PGP total keys:  3
2017-10-17 04:19:30 [2041] INFO .. SSH keys:  . . . 0
2017-10-17 04:19:30 [2041] INFO .. APK keys:  . . . 0
2017-10-17 04:19:30 [2041] INFO .. JSON keys: . . . 0
2017-10-17 04:19:30 [2041] INFO .. LDIFF certs: . . 0
2017-10-17 04:19:30 [2041] INFO .. JKS certs: . . . 0
2017-10-17 04:19:30 [2041] INFO .. PKCS7: . . . . . 0
2017-10-17 04:19:30 [2041] INFO Fingerprinted keys found: 3
2017-10-17 04:19:30 [2041] INFO WARNING: Potential vulnerability
2017-10-17 04:19:30 [2041] INFO ################################

Only in this case the command warns of vulnerable PGP keys as expected.

Simplify/optimize/deobfuscate checker code

The core of the key checker seems to be written in an oddly obtuse way for some reason, including some tests that are redundant. Specifically, the only primes that matter are 11,13,17,19,37,53,61,71,73,79,97,103,107,109,127,151,157. The others have check bitmasks that are all 1s (except for bit 0 = residue 0), which pass for all RSA keys (unless they have a small prime factor, but then you have bigger issues to worry about than the Infineon bug).

For some reason the bitmasks are expressed as decimal numbers (instead of hex or binary), which further obfuscates their meaning. These masks apparently have been generated from a simpler relation of the form n ^ r mod p = 1 for a prime p and a small exponent r, as documented here.

I've written a simpler implementation which omits the useless entries and directly computes the sets of indicator residues from the simpler relation, using more Pythonic constructs (sets instead of bitmasks). I think something along these lines would make more sense than the current code, and it is also ~3 times faster.

pip install build fails on Debian 9

Stock Debian 9.2 install fails to build roca-detect via pip.

$ pip install roca-detect
Collecting roca-detect
Collecting six (from roca-detect)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting cryptography (from roca-detect)
  Using cached cryptography-2.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Collecting python-dateutil (from roca-detect)
  Using cached python_dateutil-2.6.1-py2.py3-none-any.whl
Collecting pycrypto>=2.6 (from roca-detect)
Collecting coloredlogs (from roca-detect)
  Using cached coloredlogs-7.3-py2.py3-none-any.whl
Collecting future (from roca-detect)
Collecting apk-parse-ph4>=0.1.7 (from roca-detect)
Collecting M2Crypto (from roca-detect)
  Using cached M2Crypto-0.27.0.tar.gz
Collecting setuptools>=1.0 (from roca-detect)
  Using cached setuptools-36.6.0-py2.py3-none-any.whl
Collecting pgpdump (from roca-detect)
Collecting pyjks (from roca-detect)
  Using cached pyjks-17.1.0-py2.py3-none-any.whl
Collecting pyx509-ph4 (from roca-detect)
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography->roca-detect)
  Using cached cffi-1.11.2-cp27-cp27mu-manylinux1_x86_64.whl
Collecting enum34; python_version < "3" (from cryptography->roca-detect)
  Using cached enum34-1.1.6-py2-none-any.whl
Collecting idna>=2.1 (from cryptography->roca-detect)
  Using cached idna-2.6-py2.py3-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography->roca-detect)
  Using cached asn1crypto-0.23.0-py2.py3-none-any.whl
Collecting ipaddress; python_version < "3" (from cryptography->roca-detect)
  Using cached ipaddress-1.0.18-py2-none-any.whl
Collecting humanfriendly>=3.2 (from coloredlogs->roca-detect)
  Using cached humanfriendly-4.4.1-py2.py3-none-any.whl
Collecting mock (from apk-parse-ph4>=0.1.7->roca-detect)
  Using cached mock-2.0.0-py2.py3-none-any.whl
Collecting typing (from M2Crypto->roca-detect)
  Using cached typing-3.6.2-py2-none-any.whl
Collecting pyasn1 (from pyjks->roca-detect)
  Using cached pyasn1-0.3.7-py2.py3-none-any.whl
Collecting javaobj-py3 (from pyjks->roca-detect)
  Using cached javaobj_py3-0.2.3-py2.py3-none-any.whl
Collecting pyasn1-modules (from pyjks->roca-detect)
  Using cached pyasn1_modules-0.1.5-py2.py3-none-any.whl
Collecting twofish (from pyjks->roca-detect)
Collecting pycryptodome (from pyjks->roca-detect)
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography->roca-detect)
Collecting monotonic; python_version == "2.6" or python_version == "2.7" or python_version == "3.0" or python_version == "3.1" or python_version == "3.2" (from humanfriendly>=3.2->coloredlogs->roca-detect)
  Using cached monotonic-1.3-py2.py3-none-any.whl
Collecting funcsigs>=1; python_version < "3.3" (from mock->apk-parse-ph4>=0.1.7->roca-detect)
  Using cached funcsigs-1.0.2-py2.py3-none-any.whl
Collecting pbr>=0.11 (from mock->apk-parse-ph4>=0.1.7->roca-detect)
  Using cached pbr-3.1.1-py2.py3-none-any.whl
Building wheels for collected packages: M2Crypto
  Running setup.py bdist_wheel for M2Crypto: started
  Running setup.py bdist_wheel for M2Crypto: finished with status 'error'
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lRkmvk/M2Crypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp9MqFDhpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/BIO.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/DSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/m2.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/six.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.7/M2Crypto
  copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
  creating build/lib.linux-x86_64-2.7/M2Crypto/PGP
  copying M2Crypto/PGP/PublicKey.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
  copying M2Crypto/PGP/PublicKeyRing.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
  copying M2Crypto/PGP/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
  copying M2Crypto/PGP/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
  copying M2Crypto/PGP/constants.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
  copying M2Crypto/PGP/packet.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
  creating build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
  running build_ext
  building 'M2Crypto._m2crypto' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/SWIG
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/usr/lib/gcc/x86_64-linux-gnu/6/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include -I/usr/include/openssl -I/tmp/pip-build-lRkmvk/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -Wno-deprecated-declarations -DTHREADING
  SWIG/_m2crypto_wrap.c: In function ‘_wrap__STACK_num_set’:
  SWIG/_m2crypto_wrap.c:9548:19: error: dereferencing pointer to incomplete type ‘struct stack_st’
     if (arg1) (arg1)->num = arg2;
                     ^~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_new__STACK’:
  SWIG/_m2crypto_wrap.c:9775:48: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st’
     result = (struct stack_st *)calloc(1, sizeof(struct stack_st));
                                                  ^~~~~~
  SWIG/_m2crypto_wrap.c:9778:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_new_null’:
  SWIG/_m2crypto_wrap.c:9921:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_deep_copy’:
  SWIG/_m2crypto_wrap.c:10006:40: warning: passing argument 2 of ‘OPENSSL_sk_deep_copy’ from incompatible pointer type [-Wincompatible-pointer-types]
     result = (_STACK *)sk_deep_copy(arg1,arg2,arg3);
                                          ^~~~
  In file included from /usr/include/openssl/crypto.h:28:0,
                   from /usr/include/openssl/bio.h:20,
                   from /usr/include/openssl/err.h:21,
                   from SWIG/_m2crypto_wrap.c:3554:
  /usr/include/openssl/stack.h:32:16: note: expected ‘OPENSSL_sk_copyfunc {aka void * (*)(const void *)}’ but argument is of type ‘void * (*)(void *)’
   OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, OPENSSL_sk_copyfunc c, OPENSSL_sk_freefunc f);
                  ^~~~~~~~~~~~~~~~~~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_stack_st_OPENSSL_STRING_stack_set’:
  SWIG/_m2crypto_wrap.c:10409:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_STRING’
     if (arg1) (arg1)->stack = *arg2;
                     ^~
  SWIG/_m2crypto_wrap.c:10409:29: error: dereferencing pointer to incomplete type ‘OPENSSL_STACK {aka struct stack_st}’
     if (arg1) (arg1)->stack = *arg2;
                               ^~~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_STRING’:
  SWIG/_m2crypto_wrap.c:10441:63: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_STRING’
     result = (struct stack_st_OPENSSL_STRING *)calloc(1, sizeof(struct stack_st_OPENSSL_STRING));
                                                                 ^~~~~~
  SWIG/_m2crypto_wrap.c:10444:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_stack_st_OPENSSL_BLOCK_stack_set’:
  SWIG/_m2crypto_wrap.c:10489:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_BLOCK’
     if (arg1) (arg1)->stack = *arg2;
                     ^~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_BLOCK’:
  SWIG/_m2crypto_wrap.c:10521:62: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_BLOCK’
     result = (struct stack_st_OPENSSL_BLOCK *)calloc(1, sizeof(struct stack_st_OPENSSL_BLOCK));
                                                                ^~~~~~
  SWIG/_m2crypto_wrap.c:10524:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_threading_init’:
  SWIG/_m2crypto_wrap.c:10554:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_threading_cleanup’:
  SWIG/_m2crypto_wrap.c:10565:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_lib_init’:
  SWIG/_m2crypto_wrap.c:10576:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_err_get_error’:
  SWIG/_m2crypto_wrap.c:10743:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_err_peek_error’:
  SWIG/_m2crypto_wrap.c:10755:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_s_bio’:
  SWIG/_m2crypto_wrap.c:10833:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_s_mem’:
  SWIG/_m2crypto_wrap.c:10845:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_s_socket’:
  SWIG/_m2crypto_wrap.c:10857:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_f_ssl’:
  SWIG/_m2crypto_wrap.c:10869:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_f_buffer’:
  SWIG/_m2crypto_wrap.c:10881:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_f_cipher’:
  SWIG/_m2crypto_wrap.c:10893:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_rand_cleanup’:
  SWIG/_m2crypto_wrap.c:12150:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_rand_file_name__SWIG_1’:
  SWIG/_m2crypto_wrap.c:12303:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_rand_screen’:
  SWIG/_m2crypto_wrap.c:12351:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_md5’:
  SWIG/_m2crypto_wrap.c:12406:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha1’:
  SWIG/_m2crypto_wrap.c:12418:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_ripemd160’:
  SWIG/_m2crypto_wrap.c:12430:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha224’:
  SWIG/_m2crypto_wrap.c:12442:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha256’:
  SWIG/_m2crypto_wrap.c:12454:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha384’:
  SWIG/_m2crypto_wrap.c:12466:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha512’:
  SWIG/_m2crypto_wrap.c:12478:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ecb’:
  SWIG/_m2crypto_wrap.c:12559:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede_ecb’:
  SWIG/_m2crypto_wrap.c:12571:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede3_ecb’:
  SWIG/_m2crypto_wrap.c:12583:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_cbc’:
  SWIG/_m2crypto_wrap.c:12595:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede_cbc’:
  SWIG/_m2crypto_wrap.c:12607:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede3_cbc’:
  SWIG/_m2crypto_wrap.c:12619:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_cfb’:
  SWIG/_m2crypto_wrap.c:12631:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede_cfb’:
  SWIG/_m2crypto_wrap.c:12643:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede3_cfb’:
  SWIG/_m2crypto_wrap.c:12655:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ofb’:
  SWIG/_m2crypto_wrap.c:12667:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede_ofb’:
  SWIG/_m2crypto_wrap.c:12679:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede3_ofb’:
  SWIG/_m2crypto_wrap.c:12691:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bf_ecb’:
  SWIG/_m2crypto_wrap.c:12703:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bf_cbc’:
  SWIG/_m2crypto_wrap.c:12715:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bf_cfb’:
  SWIG/_m2crypto_wrap.c:12727:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_bf_ofb’:
  SWIG/_m2crypto_wrap.c:12739:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_cast5_ecb’:
  SWIG/_m2crypto_wrap.c:12751:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_cast5_cbc’:
  SWIG/_m2crypto_wrap.c:12763:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_cast5_cfb’:
  SWIG/_m2crypto_wrap.c:12775:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_cast5_ofb’:
  SWIG/_m2crypto_wrap.c:12787:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_rc4’:
  SWIG/_m2crypto_wrap.c:12799:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_rc2_40_cbc’:
  SWIG/_m2crypto_wrap.c:12811:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_ecb’:
  SWIG/_m2crypto_wrap.c:12823:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_cbc’:
  SWIG/_m2crypto_wrap.c:12835:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_cfb’:
  SWIG/_m2crypto_wrap.c:12847:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_ofb’:
  SWIG/_m2crypto_wrap.c:12859:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_ctr’:
  SWIG/_m2crypto_wrap.c:12871:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_ecb’:
  SWIG/_m2crypto_wrap.c:12883:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_cbc’:
  SWIG/_m2crypto_wrap.c:12895:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_cfb’:
  SWIG/_m2crypto_wrap.c:12907:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_ofb’:
  SWIG/_m2crypto_wrap.c:12919:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_ctr’:
  SWIG/_m2crypto_wrap.c:12931:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_ecb’:
  SWIG/_m2crypto_wrap.c:12943:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_cbc’:
  SWIG/_m2crypto_wrap.c:12955:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_cfb’:
  SWIG/_m2crypto_wrap.c:12967:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_ofb’:
  SWIG/_m2crypto_wrap.c:12979:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_ctr’:
  SWIG/_m2crypto_wrap.c:12991:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_pkey_new’:
  SWIG/_m2crypto_wrap.c:13042:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_md_ctx_new’:
  SWIG/_m2crypto_wrap.c:13444:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_hmac_ctx_new’:
  SWIG/_m2crypto_wrap.c:13546:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_cipher_ctx_new’:
  SWIG/_m2crypto_wrap.c:13734:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_new’:
  SWIG/_m2crypto_wrap.c:14419:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_rc4_new’:
  SWIG/_m2crypto_wrap.c:14591:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_dh_new’:
  SWIG/_m2crypto_wrap.c:14727:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_rsa_new’:
  SWIG/_m2crypto_wrap.c:15265:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_dsa_new’:
  SWIG/_m2crypto_wrap.c:16386:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sslv23_method’:
  SWIG/_m2crypto_wrap.c:17642:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sslv3_method’:
  SWIG/_m2crypto_wrap.c:19295:26: warning: implicit declaration of function ‘sslv3_method’ [-Wimplicit-function-declaration]
     result = (SSL_METHOD *)sslv3_method();
                            ^~~~~~~~~~~~
  SWIG/_m2crypto_wrap.c:19295:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     result = (SSL_METHOD *)sslv3_method();
              ^
  SWIG/_m2crypto_wrap.c:19298:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_tlsv1_method’:
  SWIG/_m2crypto_wrap.c:19310:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_new’:
  SWIG/_m2crypto_wrap.c:20979:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_crl_new’:
  SWIG/_m2crypto_wrap.c:21070:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_name_new’:
  SWIG/_m2crypto_wrap.c:21906:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_name_entry_new’:
  SWIG/_m2crypto_wrap.c:22474:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_req_new’:
  SWIG/_m2crypto_wrap.c:22723:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_store_new’:
  SWIG/_m2crypto_wrap.c:23122:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_x509_new_null’:
  SWIG/_m2crypto_wrap.c:24159:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509v3_set_nconf’:
  SWIG/_m2crypto_wrap.c:24561:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_x509_extension_new_null’:
  SWIG/_m2crypto_wrap.c:24671:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_object_new’:
  SWIG/_m2crypto_wrap.c:25028:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_bit_string_new’:
  SWIG/_m2crypto_wrap.c:25209:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_string_new’:
  SWIG/_m2crypto_wrap.c:25221:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_time_new’:
  SWIG/_m2crypto_wrap.c:25417:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_integer_new’:
  SWIG/_m2crypto_wrap.c:25611:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_pkcs7_new’:
  SWIG/_m2crypto_wrap.c:25787:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_ec_key_new’:
  SWIG/_m2crypto_wrap.c:26949:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_ec_get_builtin_curves’:
  SWIG/_m2crypto_wrap.c:27121:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_load_builtin_engines’:
  SWIG/_m2crypto_wrap.c:27811:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_load_dynamic’:
  SWIG/_m2crypto_wrap.c:27822:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_load_openssl’:
  SWIG/_m2crypto_wrap.c:27833:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_cleanup’:
  SWIG/_m2crypto_wrap.c:27844:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_new’:
  SWIG/_m2crypto_wrap.c:27856:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_ui_openssl’:
  SWIG/_m2crypto_wrap.c:28105:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  SWIG/_m2crypto_wrap.c: In function ‘_wrap_new__cbd_t’:
  SWIG/_m2crypto_wrap.c:28233:1: warning: label ‘fail’ defined but not used [-Wunused-label]
   fail:
   ^~~~
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for M2Crypto
  Running setup.py clean for M2Crypto
Failed to build M2Crypto
Installing collected packages: six, pycparser, cffi, enum34, idna, asn1crypto, ipaddress, cryptography, python-dateutil, pycrypto, monotonic, humanfriendly, coloredlogs, future, typing, M2Crypto, funcsigs, pbr, mock, apk-parse-ph4, setuptools, pgpdump, pyasn1, javaobj-py3, pyasn1-modules, twofish, pycryptodome, pyjks, pyx509-ph4, roca-detect
  Running setup.py install for M2Crypto: started
    Running setup.py install for M2Crypto: finished with status 'error'
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lRkmvk/M2Crypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vw7Xh8-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/BIO.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/DSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/six.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.7/M2Crypto
    copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
    creating build/lib.linux-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/PublicKey.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/PublicKeyRing.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/constants.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
    copying M2Crypto/PGP/packet.py -> build/lib.linux-x86_64-2.7/M2Crypto/PGP
    creating build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
    running build_ext
    building 'M2Crypto._m2crypto' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/SWIG
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-HVkOs2/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/usr/lib/gcc/x86_64-linux-gnu/6/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include -I/usr/include/openssl -I/tmp/pip-build-lRkmvk/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -Wno-deprecated-declarations -DTHREADING
    SWIG/_m2crypto_wrap.c: In function ‘_wrap__STACK_num_set’:
    SWIG/_m2crypto_wrap.c:9548:19: error: dereferencing pointer to incomplete type ‘struct stack_st’
       if (arg1) (arg1)->num = arg2;
                       ^~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new__STACK’:
    SWIG/_m2crypto_wrap.c:9775:48: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st’
       result = (struct stack_st *)calloc(1, sizeof(struct stack_st));
                                                    ^~~~~~
    SWIG/_m2crypto_wrap.c:9778:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_new_null’:
    SWIG/_m2crypto_wrap.c:9921:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_deep_copy’:
    SWIG/_m2crypto_wrap.c:10006:40: warning: passing argument 2 of ‘OPENSSL_sk_deep_copy’ from incompatible pointer type [-Wincompatible-pointer-types]
       result = (_STACK *)sk_deep_copy(arg1,arg2,arg3);
                                            ^~~~
    In file included from /usr/include/openssl/crypto.h:28:0,
                     from /usr/include/openssl/bio.h:20,
                     from /usr/include/openssl/err.h:21,
                     from SWIG/_m2crypto_wrap.c:3554:
    /usr/include/openssl/stack.h:32:16: note: expected ‘OPENSSL_sk_copyfunc {aka void * (*)(const void *)}’ but argument is of type ‘void * (*)(void *)’
     OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, OPENSSL_sk_copyfunc c, OPENSSL_sk_freefunc f);
                    ^~~~~~~~~~~~~~~~~~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_stack_st_OPENSSL_STRING_stack_set’:
    SWIG/_m2crypto_wrap.c:10409:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_STRING’
       if (arg1) (arg1)->stack = *arg2;
                       ^~
    SWIG/_m2crypto_wrap.c:10409:29: error: dereferencing pointer to incomplete type ‘OPENSSL_STACK {aka struct stack_st}’
       if (arg1) (arg1)->stack = *arg2;
                                 ^~~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_STRING’:
    SWIG/_m2crypto_wrap.c:10441:63: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_STRING’
       result = (struct stack_st_OPENSSL_STRING *)calloc(1, sizeof(struct stack_st_OPENSSL_STRING));
                                                                   ^~~~~~
    SWIG/_m2crypto_wrap.c:10444:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_stack_st_OPENSSL_BLOCK_stack_set’:
    SWIG/_m2crypto_wrap.c:10489:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_BLOCK’
       if (arg1) (arg1)->stack = *arg2;
                       ^~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_BLOCK’:
    SWIG/_m2crypto_wrap.c:10521:62: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_BLOCK’
       result = (struct stack_st_OPENSSL_BLOCK *)calloc(1, sizeof(struct stack_st_OPENSSL_BLOCK));
                                                                  ^~~~~~
    SWIG/_m2crypto_wrap.c:10524:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_threading_init’:
    SWIG/_m2crypto_wrap.c:10554:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_threading_cleanup’:
    SWIG/_m2crypto_wrap.c:10565:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_lib_init’:
    SWIG/_m2crypto_wrap.c:10576:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_err_get_error’:
    SWIG/_m2crypto_wrap.c:10743:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_err_peek_error’:
    SWIG/_m2crypto_wrap.c:10755:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_s_bio’:
    SWIG/_m2crypto_wrap.c:10833:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_s_mem’:
    SWIG/_m2crypto_wrap.c:10845:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_s_socket’:
    SWIG/_m2crypto_wrap.c:10857:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_f_ssl’:
    SWIG/_m2crypto_wrap.c:10869:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_f_buffer’:
    SWIG/_m2crypto_wrap.c:10881:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bio_f_cipher’:
    SWIG/_m2crypto_wrap.c:10893:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_rand_cleanup’:
    SWIG/_m2crypto_wrap.c:12150:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_rand_file_name__SWIG_1’:
    SWIG/_m2crypto_wrap.c:12303:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_rand_screen’:
    SWIG/_m2crypto_wrap.c:12351:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_md5’:
    SWIG/_m2crypto_wrap.c:12406:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha1’:
    SWIG/_m2crypto_wrap.c:12418:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_ripemd160’:
    SWIG/_m2crypto_wrap.c:12430:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha224’:
    SWIG/_m2crypto_wrap.c:12442:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha256’:
    SWIG/_m2crypto_wrap.c:12454:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha384’:
    SWIG/_m2crypto_wrap.c:12466:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sha512’:
    SWIG/_m2crypto_wrap.c:12478:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ecb’:
    SWIG/_m2crypto_wrap.c:12559:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede_ecb’:
    SWIG/_m2crypto_wrap.c:12571:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede3_ecb’:
    SWIG/_m2crypto_wrap.c:12583:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_cbc’:
    SWIG/_m2crypto_wrap.c:12595:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede_cbc’:
    SWIG/_m2crypto_wrap.c:12607:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede3_cbc’:
    SWIG/_m2crypto_wrap.c:12619:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_cfb’:
    SWIG/_m2crypto_wrap.c:12631:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede_cfb’:
    SWIG/_m2crypto_wrap.c:12643:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede3_cfb’:
    SWIG/_m2crypto_wrap.c:12655:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ofb’:
    SWIG/_m2crypto_wrap.c:12667:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede_ofb’:
    SWIG/_m2crypto_wrap.c:12679:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_des_ede3_ofb’:
    SWIG/_m2crypto_wrap.c:12691:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bf_ecb’:
    SWIG/_m2crypto_wrap.c:12703:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bf_cbc’:
    SWIG/_m2crypto_wrap.c:12715:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bf_cfb’:
    SWIG/_m2crypto_wrap.c:12727:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_bf_ofb’:
    SWIG/_m2crypto_wrap.c:12739:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_cast5_ecb’:
    SWIG/_m2crypto_wrap.c:12751:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_cast5_cbc’:
    SWIG/_m2crypto_wrap.c:12763:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_cast5_cfb’:
    SWIG/_m2crypto_wrap.c:12775:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_cast5_ofb’:
    SWIG/_m2crypto_wrap.c:12787:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_rc4’:
    SWIG/_m2crypto_wrap.c:12799:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_rc2_40_cbc’:
    SWIG/_m2crypto_wrap.c:12811:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_ecb’:
    SWIG/_m2crypto_wrap.c:12823:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_cbc’:
    SWIG/_m2crypto_wrap.c:12835:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_cfb’:
    SWIG/_m2crypto_wrap.c:12847:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_ofb’:
    SWIG/_m2crypto_wrap.c:12859:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_128_ctr’:
    SWIG/_m2crypto_wrap.c:12871:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_ecb’:
    SWIG/_m2crypto_wrap.c:12883:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_cbc’:
    SWIG/_m2crypto_wrap.c:12895:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_cfb’:
    SWIG/_m2crypto_wrap.c:12907:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_ofb’:
    SWIG/_m2crypto_wrap.c:12919:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_192_ctr’:
    SWIG/_m2crypto_wrap.c:12931:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_ecb’:
    SWIG/_m2crypto_wrap.c:12943:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_cbc’:
    SWIG/_m2crypto_wrap.c:12955:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_cfb’:
    SWIG/_m2crypto_wrap.c:12967:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_ofb’:
    SWIG/_m2crypto_wrap.c:12979:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_256_ctr’:
    SWIG/_m2crypto_wrap.c:12991:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_pkey_new’:
    SWIG/_m2crypto_wrap.c:13042:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_md_ctx_new’:
    SWIG/_m2crypto_wrap.c:13444:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_hmac_ctx_new’:
    SWIG/_m2crypto_wrap.c:13546:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_cipher_ctx_new’:
    SWIG/_m2crypto_wrap.c:13734:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_aes_new’:
    SWIG/_m2crypto_wrap.c:14419:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_rc4_new’:
    SWIG/_m2crypto_wrap.c:14591:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_dh_new’:
    SWIG/_m2crypto_wrap.c:14727:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_rsa_new’:
    SWIG/_m2crypto_wrap.c:15265:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_dsa_new’:
    SWIG/_m2crypto_wrap.c:16386:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sslv23_method’:
    SWIG/_m2crypto_wrap.c:17642:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sslv3_method’:
    SWIG/_m2crypto_wrap.c:19295:26: warning: implicit declaration of function ‘sslv3_method’ [-Wimplicit-function-declaration]
       result = (SSL_METHOD *)sslv3_method();
                              ^~~~~~~~~~~~
    SWIG/_m2crypto_wrap.c:19295:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       result = (SSL_METHOD *)sslv3_method();
                ^
    SWIG/_m2crypto_wrap.c:19298:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_tlsv1_method’:
    SWIG/_m2crypto_wrap.c:19310:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_new’:
    SWIG/_m2crypto_wrap.c:20979:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_crl_new’:
    SWIG/_m2crypto_wrap.c:21070:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_name_new’:
    SWIG/_m2crypto_wrap.c:21906:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_name_entry_new’:
    SWIG/_m2crypto_wrap.c:22474:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_req_new’:
    SWIG/_m2crypto_wrap.c:22723:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509_store_new’:
    SWIG/_m2crypto_wrap.c:23122:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_x509_new_null’:
    SWIG/_m2crypto_wrap.c:24159:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_x509v3_set_nconf’:
    SWIG/_m2crypto_wrap.c:24561:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_x509_extension_new_null’:
    SWIG/_m2crypto_wrap.c:24671:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_object_new’:
    SWIG/_m2crypto_wrap.c:25028:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_bit_string_new’:
    SWIG/_m2crypto_wrap.c:25209:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_string_new’:
    SWIG/_m2crypto_wrap.c:25221:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_time_new’:
    SWIG/_m2crypto_wrap.c:25417:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_asn1_integer_new’:
    SWIG/_m2crypto_wrap.c:25611:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_pkcs7_new’:
    SWIG/_m2crypto_wrap.c:25787:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_ec_key_new’:
    SWIG/_m2crypto_wrap.c:26949:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_ec_get_builtin_curves’:
    SWIG/_m2crypto_wrap.c:27121:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_load_builtin_engines’:
    SWIG/_m2crypto_wrap.c:27811:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_load_dynamic’:
    SWIG/_m2crypto_wrap.c:27822:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_load_openssl’:
    SWIG/_m2crypto_wrap.c:27833:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_cleanup’:
    SWIG/_m2crypto_wrap.c:27844:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_engine_new’:
    SWIG/_m2crypto_wrap.c:27856:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_ui_openssl’:
    SWIG/_m2crypto_wrap.c:28105:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new__cbd_t’:
    SWIG/_m2crypto_wrap.c:28233:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lRkmvk/M2Crypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vw7Xh8-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-lRkmvk/M2Crypto/```

Support for Python 3

The current code works with Python 2.7.13. Not with 2.7.6, or with Python 3.
With Python 3, users get errors like

  • TypeError: startswith first arg must be bytes or a tuple of bytes, not str (#23)

The README.md shows how to use Docker, or pyenv to get 2.7.13 (or any other Python version).

Porting to Python 3 would make it easier to run in many environments. Great tips and tools are available:

DNSKEY support

I did some very rough work to verify that the DNSKEYs for the root zone and the TLDs are not affected. Unless I made a mistake in my testing, none of them are affected.

It might be nice to add DNSKEY support to roca directly - however I do not have time to work on this right now, so I'm leaving the rough work here in case some enterprising soul wants to pick it up. I suggest labeling this issue with #hacktoberfest.

Script: https://gist.github.com/Habbie/23ef81ac9c4fed95720fe1970adddf23

Usage:

$ dig dnskey powerdns.com | grep DNSKEY | grep -v '^;' | ./convert-dnskey.py  > powerdns.out
awk '{print $1}' < powerdns.out > powerdns.out.txt
python roca/detect.py  powerdns.out.txt

Then, if detect actually detects anything, grep for the modulus in powerdns.out to find the affected DNSKEY.

CSR Testing?

Is it possible to test a .CSR file currently? If not is there any plan for implementing this in the future?

Parsing GPG keys

I'm not sure if this is the proper place to report this but I think there's a small script issue on the website with parsing GPG keys in both pasted text and pulling from a key server.

When parsing a GPG key, the website assumes the ---- BEGIN ... part as the first line of text. The script from a quick glance here looks to be the same.

When using the website and using the GPG key from public key ring option, it seems to always returns "no keys found". My key is on the public SKS keyservers and I think this is where your site is pulling keys from. If I copy and paste my key as shown in the link below to the copy / paste section of the site, it returns the same response "no keys found".
http://pool.sks-keyservers.net:11371/pks/lookup?op=get&search=0x4407e1da78574978c681315981bab00d69e5096d

If I remove the first line from the text "Public Key Server ..." and try again with the site, it is then accepted.

I think the script needs to be adjusted so it checks all of the lines instead of just the first line.

roca-detect-tls throws: ModuleNotFoundError: No module named 'detect'

Hi there...
Seems I've come across a bit of a bug in the roca-detect-tls code.
I am getting the same error with both pip install roca-detect and an installation done also with pip from a local github clone. Here it the output:

$roca-detect-tls ./tls-list.txt
Traceback (most recent call last):
  File "/usr/bin/roca-detect-tls", line 11, in <module>
    load_entry_point('roca-detect==1.2.5', 'console_scripts', 'roca-detect-tls')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2409, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2415, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.6/site-packages/roca/detect_tls.py", line 23, in <module>
    from detect import RocaFingerprinter, logger, LOG_FORMAT
ModuleNotFoundError: No module named 'detect'
$cat ./tls-list.txt
localhost:443
$uname -a
Linux 4.9.56-1-lts #1 SMP Thu Oct 12 22:34:15 CEST 2017 x86_64 GNU/Linux
$python -V
Python 3.6.2
$pip -V
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)

Python codes?

Could you add your python codes in this repository? Thanks.

Generate/Iterate vulnerable private keys

With the information currently available is it possible to GENERATE vulnerable private keys (other than bruteforce), and if so what sort of keyspace is vulnerable?

I have a use case where I would like to search for vulnerable keys from a hash of the private key. Would obviously need to generate keys to be able to test this but not currently sure of the feasibility of this.

Handle unkonwn public key types in GPG

Right now an unknown public key in GPG stops all processing of that public key block; it'd be great if it ignored such keys and still tested all other keys. To reproduce:

(t) root@6a5c5567c5c4:/roca# gpg --export --armor --keyring /usr/share/keyrings/debian-maintainers.gpg > x
(t) root@6a5c5567c5c4:/roca# roca-detect x
2017-10-16 15:25:39 [6961] ERROR Exception in processing PGP rec file x: Unsupported public key algorithm 22
2017-10-16 15:25:39 [6961] INFO ### SUMMARY ####################
2017-10-16 15:25:39 [6961] INFO Records tested: 0
2017-10-16 15:25:39 [6961] INFO .. PEM certs: . . . 0
2017-10-16 15:25:39 [6961] INFO .. DER certs: . . . 0
2017-10-16 15:25:39 [6961] INFO .. RSA key files: . 0
2017-10-16 15:25:39 [6961] INFO .. PGP master keys: 0
2017-10-16 15:25:39 [6961] INFO .. PGP total keys:  0
2017-10-16 15:25:39 [6961] INFO .. SSH keys:  . . . 0
2017-10-16 15:25:39 [6961] INFO .. APK keys:  . . . 0
2017-10-16 15:25:39 [6961] INFO .. JSON keys: . . . 0
2017-10-16 15:25:39 [6961] INFO .. LDIFF certs: . . 0
2017-10-16 15:25:39 [6961] INFO .. JKS certs: . . . 0
2017-10-16 15:25:39 [6961] INFO No fingerprinted keys found (OK)
2017-10-16 15:25:39 [6961] INFO ################################

(Run on debian/buster)

Add optional licence Apache 2.0

Some users requested Apache 2.0 license. I believe that MIT is even more permissive, but ok from my side to give option to users to use any if these two which suits better

Show the affected file

When checking an directory, only the message that Potential vulnerability keys was found is shown.
But it will be nice, when the affected file will be shown.

TypeError: startswith first arg must be bytes or a tuple of bytes, not str

Traceback (most recent call last):
  File "./roca-detect", line 11, in <module>
    load_entry_point('roca-detect==1.0.5', 'console_scripts', 'roca-detect')()
  File "/home/xxxxx/.local/lib64/python3.4/site-packages/roca/detect.py", line 1782, in main
    app.mainxxxxx
  File "/home/xxxxx/.local/lib64/python3.4/site-packages/roca/detect.py", line 1777, in main
    self.work()
  File "/home/xxxxx/.local/lib64/python3.4/site-packages/roca/detect.py", line 1675, in work
    ret = self.process_inputs()
  File "/home/xxxxx/.local/lib64/python3.4/site-packages/roca/detect.py", line 691, in process_inputs
    sub = self.process_file(data, fname)
  File "/home/xxxxx/.local/lib64/python3.4/site-packages/roca/detect.py", line 779, in process_file
    ret.append(self.process_pkcs7(data, name))
  File "/home/xxxxx/.local/lib64/python3.4/site-packages/roca/detect.py", line 1605, in process_pkcs7
    is_pem = data.startswith('-----')
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

I've tried changing data.startswith('-----') to data.startswith(b'-----'), but got another error:

  File "/home/xxxxx/.local/lib64/python3.4/site-packages/roca/detect.py", line 1606, in process_pkcs7
    if re.match(r'^[a-zA-Z0-9-\s+=/]+$', data):
  File "/usr/lib64/python3.4/re.py", line 160, in match
    return _compile(pattern, flags).match(string)
TypeError: can't use a string pattern on a bytes-like object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.