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

test_ssl: failures on OpenBSD with LibreSSL #67366

Closed
vstinner opened this issue Jan 6, 2015 · 12 comments
Closed

test_ssl: failures on OpenBSD with LibreSSL #67366

vstinner opened this issue Jan 6, 2015 · 12 comments
Labels
tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Jan 6, 2015

BPO 23177
Nosy @vstinner, @tiran

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-09-08.15:32:28.515>
created_at = <Date 2015-01-06.10:54:16.088>
labels = ['tests']
title = 'test_ssl: failures on OpenBSD with LibreSSL'
updated_at = <Date 2016-09-08.15:32:28.513>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2016-09-08.15:32:28.513>
actor = 'christian.heimes'
assignee = 'none'
closed = True
closed_date = <Date 2016-09-08.15:32:28.515>
closer = 'christian.heimes'
components = ['Tests']
creation = <Date 2015-01-06.10:54:16.088>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 23177
keywords = []
message_count = 12.0
messages = ['233514', '233519', '233534', '233536', '233576', '233578', '233632', '233633', '234815', '251167', '251208', '275050']
nosy_count = 5.0
nosy_names = ['vstinner', 'christian.heimes', 'python-dev', 'rpointel', 'spil']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue23177'
versions = ['Python 3.5']

@vstinner
Copy link
Member Author

vstinner commented Jan 6, 2015

(See also the issue bpo-21356.)

http://buildbot.python.org/all/builders/x86%20OpenBSD%205.5%203.x/builds/1242/steps/test/logs/stdio

======================================================================
FAIL: test_options (test.test_ssl.ContextTests)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/home/python-builds/3.x.borja-openbsd-x86/build/Lib/test/test_ssl.py", line 764, in test_options
    ctx.options)
AssertionError: -2130705409 != -2097150977

======================================================================
FAIL: test_openssl_version (test.test_ssl.BasicSocketTests)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/home/python-builds/3.x.borja-openbsd-x86/build/Lib/test/test_ssl.py", line 315, in test_openssl_version
    (s, t))
AssertionError: False is not true : ('LibreSSL 2.1', (2, 0, 0, 0, 0))

@vstinner vstinner added the tests Tests in the Lib/test dir label Jan 6, 2015
@vstinner
Copy link
Member Author

vstinner commented Jan 6, 2015

changeset: 94041:87976d72fd5c
user: Victor Stinner <victor.stinner@gmail.com>
date: Tue Jan 06 11:51:06 2015 +0100
files: Lib/test/test_ssl.py
description:
test_ssl: add more debug to investigate test_openssl_version() failure on
OpenBSD with LibreSSL.

@vstinner
Copy link
Member Author

vstinner commented Jan 6, 2015

It looks like OPENSSL_VERSION_NUMBER is consistent with OPENSSL_VERSION_INFO (version 2.1). But the OPENSSL_VERSION contains a different version (2.0). It looks like an issue in LibreSSL.

======================================================================
FAIL: test_openssl_version (test.test_ssl.BasicSocketTests)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/home/python-builds/3.x.borja-openbsd-x86/build/Lib/test/test_ssl.py", line 315, in test_openssl_version
    (s, t, hex(n)))
AssertionError: False is not true : ('LibreSSL 2.1', (2, 0, 0, 0, 0), '0x20000000')

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jan 6, 2015

New changeset 05d7550bd2d9 by Victor Stinner in branch 'default':
Issue bpo-23177: Document that ssl.RAND_egd() is not available with LibreSSL
https://hg.python.org/cpython/rev/05d7550bd2d9

@spil
Copy link
Mannequin

spil mannequin commented Jan 7, 2015

Note that the FreeBSD port modifies the OPENSSL_VERSION_NUMBER and sets the version number to 1.0.1g.
https://svnweb.freebsd.org/ports?view=revision&revision=361642

@vstinner
Copy link
Member Author

vstinner commented Jan 7, 2015

Note that the FreeBSD port modifies the OPENSSL_VERSION_NUMBER and sets the version number to 1.0.1g.

Maybe we should remove the test on OPENSSL_VERSION (string) for LibreSSL?

@spil
Copy link
Mannequin

spil mannequin commented Jan 8, 2015

LibreSSL defines in opensslv.h
#define LIBRESSL_VERSION_NUMBER 0x20000000L
#define OPENSSL_VERSION_NUMBER 0x20000000L

And FreeBSD replaces
#define OPENSSL_VERSION_NUMBER 0x1000107fL

Proper way would be to check for LIBRESSL_VERSION_NUMBER string, FreeBSD modifies the OpenSSL version number to indicate its compatibility level (as stated in commit log)

@vstinner
Copy link
Member Author

vstinner commented Jan 8, 2015

Proper way would be to check for LIBRESSL_VERSION_NUMBER string, FreeBSD modifies the OpenSSL version number to indicate its compatibility level (as stated in commit log)

Please see the unit test: it checks that the version number and version string are consistent. It's not the case on OpenBSD with LibreSSL (2.0 vs 2.1) nor on FreeBSD (1.0 vs 2.1).

@vstinner
Copy link
Member Author

_ssl cannot be compiled with LibreSSL anymore (on OpenBSD 5.5) because of ALPN: see issue bpo-23329.

@rpointel
Copy link
Mannequin

rpointel mannequin commented Sep 20, 2015

Hi,

maybe we should add the LIBRESSL_ information available in opensslv.h (as it has be done for OpenSSL):

$ grep LIBRESSL /usr/include/ssl/opensslv.h 
#define LIBRESSL_VERSION_NUMBER 0x20030000L
#define LIBRESSL_VERSION_TEXT   "LibreSSL 2.3.0"
#define OPENSSL_VERSION_TEXT    LIBRESSL_VERSION_TEXT

What do you think about that?

Remi.

@vstinner
Copy link
Member Author

I don't care so much of issues introduced by LibreSSL, I don't understand why they broke the API. For me, it doesn't seem right to have a version different if it's a number or if it's a string: OPENSSL_VERSION_NUMBER should be consistent with OPENSSL_VERSION_INFO.

If you propose a patch for Python and it fixes test_ssl, I will apply it :-)

@tiran
Copy link
Member

tiran commented Sep 8, 2016

I have fixed all libressl related test failures while I added support for OpenSSL 1.1.0.

@tiran tiran closed this as completed Sep 8, 2016
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

No branches or pull requests

2 participants