Skip to content

Fix building against OpenSSL v1.1#4195

Merged
ethomson merged 2 commits intolibgit2:masterfrom
pks-t:pks/openssl-1.1
Apr 11, 2017
Merged

Fix building against OpenSSL v1.1#4195
ethomson merged 2 commits intolibgit2:masterfrom
pks-t:pks/openssl-1.1

Conversation

@pks-t
Copy link
Copy Markdown
Member

@pks-t pks-t commented Apr 7, 2017

This fixes the issues raised by #4194. When bulding against OpenSSL without deprecated features, we currently fail. This can be provoked by defining "-DOPENSSL_API_COMPAT=0x10100000L" when OpenSSL 1.1 is installed.

#ifdef GIT_THREADS
#ifndef GIT_THREADS
giterr_set(GITERR_THREAD, "libgit2 was not built with threads");
return -1;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized this does not make any sense when building against 1.1. I should probably just return success if GIT_THREADS && OPENSSL_VERSION >= 0x10100000L.

@pks-t pks-t force-pushed the pks/openssl-1.1 branch from 951e957 to 8852015 Compare April 10, 2017 09:28
pks-t added 2 commits April 10, 2017 11:29
Up to version 1.0, OpenSSL required us to provide a callback which implements
a locking mechanism. Due to problems in the API design though this mechanism was
inherently broken, especially regarding that the locking callback cannot report
errors in an obvious way. Due to this shortcoming, the locking initialization
has been completely removed in OpenSSL version 1.1. As the library has also been
refactored to not make any use of these callback functions, we can safely remove
all initialization of the locking subsystem if compiling against OpenSSL version
1.1 or higher.

This fixes a compilation error when compiling against OpenSSL version 1.1 which
has been built without stubs for deprecated syntax.
Previous to OpenSSL version 1.1, the user had to initialize at least the error
strings as well as the SSL algorithms by himself. OpenSSL version 1.1 instead
provides a new function `OPENSSL_init_ssl`, which handles initialization of all
subsystems. As the new API call will by default load error strings and
initialize the SSL algorithms, we can safely replace these calls when compiling
against version 1.1 or later.

This fixes a compiler error when compiling against OpenSSL version 1.1 which has
been built without stubs for deprecated syntax.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants