Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAIL: test_der (__main__.X509NameTests) / FAIL: test_digest (__main__.X509Tests) #150

Closed
sandrotosi opened this issue Aug 18, 2014 · 10 comments

Comments

@sandrotosi
Copy link

When building pyopenssl 0.14 on Debian (with python-cryptography 0.5.2) I got these failures when running tests in a clean chroot:

FAIL: test_der (__main__.X509NameTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "OpenSSL/test/test_crypto.py", line 907, in test_der
    b('0\x1b1\x0b0\t\x06\x03U\x04\x06\x13\x02US'
AssertionError: b'0\x1b1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x0c0\n\x06\x03U\x04\x03\x0c\x03foo' != b'0\x1b1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x0c0\n\x06\x03U\x04\x03\x13\x03foo'

======================================================================
FAIL: test_digest (__main__.X509Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "OpenSSL/test/test_crypto.py", line 1454, in test_digest
    b("A8:EB:07:F8:53:25:0A:F2:56:05:C5:A5:C4:C4:C7:15"))
AssertionError: b'6E:DB:AA:35:8C:39:8C:86:95:0E:D6:51:7E:42:FF:F4' != b'A8:EB:07:F8:53:25:0A:F2:56:05:C5:A5:C4:C4:C7:15'

----------------------------------------------------------------------

the same on 2.7 and 3.4

@peterpramb
Copy link

For the first one see #115 - you must apply the fix there for OpenSSL >= 1.0.1h to let pyOpenSSL behave consistently.

@peterpramb
Copy link

The second one relates to #149 again - it's the same ASN1 structure change which causes different digest results.

OpenSSL 1.0.1e:

    0:d=0  hl=2 l=  37 cons: SEQUENCE          
    2:d=1  hl=2 l=  27 cons:  SEQUENCE          
    4:d=2  hl=2 l=   0 prim:   INTEGER           :00
    6:d=2  hl=2 l=   3 cons:   SEQUENCE          
    8:d=3  hl=2 l=   1 prim:    OBJECT            :itu-t
   11:d=2  hl=2 l=   0 cons:   SEQUENCE          
   13:d=2  hl=2 l=   4 cons:   SEQUENCE          

OpenSSL 1.0.1l:

    0:d=0  hl=2 l=  35 cons: SEQUENCE          
    2:d=1  hl=2 l=  26 cons:  SEQUENCE          
    4:d=2  hl=2 l=   1 prim:   INTEGER           :00
    7:d=2  hl=2 l=   2 cons:   SEQUENCE          
    9:d=3  hl=2 l=   0 prim:    OBJECT            :BAD OBJECT
   11:d=2  hl=2 l=   0 cons:   SEQUENCE          
   13:d=2  hl=2 l=   4 cons:   SEQUENCE          

@peterpramb
Copy link

Shortened test case from test_crypto.py:

from OpenSSL.crypto import X509, FILETYPE_PEM, dump_certificate

cert = X509()
cert.digest("MD5")
dump_certificate(FILETYPE_PEM, cert)

OpenSSL 1.0.1e:

cert.digest("MD5")
'A8:EB:07:F8:53:25:0A:F2:56:05:C5:A5:C4:C4:C7:15'
dump_certificate(FILETYPE_PEM, cert)
'-----BEGIN CERTIFICATE-----\nMCUwGwIAMAMGAQAwADAEHwAfADAAMAgwAwYBAAMBADADBgEAAwEA\n-----END CERTIFICATE-----\n'

OpenSSL 1.0.1l:

cert.digest("MD5")
'6E:DB:AA:35:8C:39:8C:86:95:0E:D6:51:7E:42:FF:F4'
dump_certificate(FILETYPE_PEM, cert)
'-----BEGIN CERTIFICATE-----\nMCMwGgIBADACBgAwADAEHwAfADAAMAcwAgYAAwEAMAIGAAMBAA==\n-----END CERTIFICATE-----\n'

@peterpramb
Copy link

Thanks, I can confirm that the test suite runs now cleanly with the fixes in #193 for both OpenSSL >= and < 1.0.1i.

@mrjefftang
Copy link
Contributor

@peterpramb Are you seeing any test failures for set_tmp_ecdh() like those in the TravisCI runs?

@peterpramb
Copy link

No, I don't have this function at all in 0.14.

@peterpramb
Copy link

No issues using the latest master branch checkout with both OpenSSL versions:

DEBUG: test_set_tmp_ecdh (OpenSSL.test.test_ssl.ContextTests) ... ok
...
DEBUG: Ran 395 tests in 23.996s
DEBUG: OK

The only strange thing is that the test suite tries to build an extension:

DEBUG: running build_ext
DEBUG: building '_cffi__x6ebbce47xf0efe0ea' extension

@sandrotosi
Copy link
Author

the test of the original post are still failing with pyopenssl 0.15 and python-cryptography 0.8.2-1 in the very same way

@alex
Copy link
Member

alex commented Jun 30, 2017

This has been fixed for a while I believe.

@alex alex closed this as completed Jun 30, 2017
@sandrotosi
Copy link
Author

correct, this is fixed

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants