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

Allow compilation with newer openssl version #8

Closed
wants to merge 1 commit into from
Closed

Allow compilation with newer openssl version #8

wants to merge 1 commit into from

Conversation

popovec
Copy link
Member

@popovec popovec commented May 17, 2018

from https://www.openssl.org/news/changelog.html#x4:
EVP_MD_CTX_cleanup(), EVP_CIPHER_CTX_cleanup() and
HMAC_CTX_cleanup() were removed. HMAC_CTX_reset() and
EVP_MD_CTX_reset() should be called instead to reinitialise
an already created structure.

from https://www.openssl.org/news/changelog.html#x4:
   EVP_MD_CTX_cleanup(), EVP_CIPHER_CTX_cleanup() and
   HMAC_CTX_cleanup() were removed.  HMAC_CTX_reset() and
   EVP_MD_CTX_reset() should be called instead to reinitialise
   an already created structure.
@frankmorgner
Copy link
Member

please check for EVP_MD_CTX_cleanup() in configure.ac to distinguish both cases.

@frankmorgner
Copy link
Member

The version check is not very robust, e.g. it may fail for libressl.

@popovec
Copy link
Member Author

popovec commented Jun 11, 2018

Hi Frank,

To get pam_p11 really portable (old/new openssl, libressl) there is necessary to fix more deprecated functions in code. For example from libressl 2.7.3 manual:

EVP_MD_CTX_create(), EVP_MD_CTX_cleanup(), and EVP_MD_CTX_destroy() are deprecated aliases for EVP_MD_CTX_new(), EVP_MD_CTX_reset(), and EVP_MD_CTX_free(), respectively.

Similar to this, documentation for Openssl 1.1.0:
EVP_MD_CTX_create() and EVP_MD_CTX_destroy() were renamed to EVP_MD_CTX_new() and EVP_MD_CTX_free() in OpenSSL 1.1.

Even in OpenSC project some of deprecated functions are used:
src/tools/pkcs11-tool.c: md_ctx = EVP_MD_CTX_create();

I do not have elegant solution for this now, but I agree, testing only OPENSSL_VERSION_NUMBER is not enough.

@frankmorgner
Copy link
Member

One typical approach would be to use the new API everywhere and replicate it with the old API if needed...

@popovec
Copy link
Member Author

popovec commented Jun 12, 2018

Hi,

I have created a new patch, draft can be found at https://github.com/popovec/pam_p11/tree/openssl-deprecated . This patch handles only part of deprecated functions. Probably it would be best to replace all old API functions by new API functions. But I have a problem, how to elegantly discard deprecated calls to functions:

OpenSSL_add_all_algorithms();
EVP_cleanup();
ERR_load_crypto_strings();
ERR_free_strings();

Any idea ? Or is it acceptable to leave these functions in code for now ?

@frankmorgner
Copy link
Member

Yes, your alternative patch looks (almost) good. Just leave the deprecated initialization calls as is.

frankmorgner referenced this pull request in popovec/pam_p11 Aug 21, 2018
Use new OpenSSL API functions: EVP_MD_CTX_new(), EVP_MD_CTX_reset(),
EVP_MD_CTX_free() in code. Emulate this API for old version of OpenSSL.
@frankmorgner
Copy link
Member

closed with #12

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