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

Make BIO_METHOD initialization for OpenSSL 1.1 thread-safe #2

Merged
merged 1 commit into from
Mar 7, 2018

Conversation

Lastique
Copy link
Contributor

@Lastique Lastique commented Mar 6, 2018

The implementation attempts to select one of the following implementations,
in the decreasing order of preference:

  • On C++11 compilers, use function-local statics initialization, which is
    thread-safe.
  • On POSIX systems, use pthreads as it supports static initialization.
  • On all other systems, use PMutex from PTLib.

The last option is, strictly speaking, a regression from OpenSSL 1.0, which
allows to statically initialize the BIO_METHOD structure. It should not be
significant, though, as users are unlikely to work with PSSLChannel in global
constructors and destructors.

Only tested for compilation on Linux with OpenSSL 1.0 and 1.1.

The implementation attempts to select one of the following implementations,
in the decreasing order of preference:

- On C++11 compilers, use function-local statics initialization, which is
  thread-safe.
- On POSIX systems, use pthreads as it supports static initialization.
- On all other systems, use PMutex from PTLib.

The last option is, strictly speaking, a regression from OpenSSL 1.0, which
allows to statically initialize the BIO_METHOD structure. It should not be
significant, though, as users are unlikely to work with PSSLChannel in global
constructors and destructors.
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.

None yet

2 participants