Discussion:
[PATCH] Fix configure check for EVP_CIPHER_CTX_set_iv
Michael Forney
2018-11-05 05:41:27 UTC
Permalink
This causes EVP_CIPHER_CTX_set_iv to get replaced unnecessarily (or
a duplicate symbol error if linking statically).
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 10696513..199975fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2865,7 +2865,7 @@ if test "x$openssl" = "xyes" ; then
[AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
[Define if libcrypto has EVP_CIPHER_CTX_get_iv])])
AC_SEARCH_LIBS([EVP_CIPHER_CTX_set_iv], [crypto],
- [AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
+ [AC_DEFINE([HAVE_EVP_CIPHER_CTX_SET_IV], [1],
[Define if libcrypto has EVP_CIPHER_CTX_set_iv])])

AC_SEARCH_LIBS([RSA_get0_crt_params], [crypto],
--
2.19.1
Darren Tucker
2018-11-05 06:40:20 UTC
Permalink
Post by Michael Forney
This causes EVP_CIPHER_CTX_set_iv to get replaced unnecessarily (or
a duplicate symbol error if linking statically).
Applied, thanks.
Post by Michael Forney
AC_SEARCH_LIBS([EVP_CIPHER_CTX_set_iv], [crypto],
- [AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
+ [AC_DEFINE([HAVE_EVP_CIPHER_CTX_SET_IV], [1],
[Define if libcrypto has EVP_CIPHER_CTX_set_iv])])
AC_SEARCH_LIBS sets that definition by default anyway. Damien, is there
any reason we can't delete all those args?
--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new)
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
Damien Miller
2018-11-08 01:16:23 UTC
Permalink
Post by Darren Tucker
Post by Michael Forney
This causes EVP_CIPHER_CTX_set_iv to get replaced unnecessarily (or
a duplicate symbol error if linking statically).
Applied, thanks.
should this go on the V_7_9 branch too?
Post by Darren Tucker
Post by Michael Forney
AC_SEARCH_LIBS([EVP_CIPHER_CTX_set_iv], [crypto],
- [AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
+ [AC_DEFINE([HAVE_EVP_CIPHER_CTX_SET_IV], [1],
[Define if libcrypto has EVP_CIPHER_CTX_set_iv])])
AC_SEARCH_LIBS sets that definition by default anyway. Damien, is there
any reason we can't delete all those args?
IIRC I tried that and it didn't work, but maybe I'm misremembering.

-d
Darren Tucker
2018-11-08 02:26:48 UTC
Permalink
Post by Damien Miller
should this go on the V_7_9 branch too?
sure, cherry-picked.
Post by Damien Miller
AC_SEARCH_LIBS sets that definition by default anyway. Damien, is there
Post by Darren Tucker
any reason we can't delete all those args?
IIRC I tried that and it didn't work, but maybe I'm misremembering.
I think it should work. I'll give it a go.
--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new)
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
Darren Tucker
2018-11-08 03:07:29 UTC
Permalink
[...] AC_SEARCH_LIBS
Post by Damien Miller
IIRC I tried that and it didn't work, but maybe I'm misremembering.
I think it should work. I'll give it a go.
AC_SEARCH_LIBS isn't the ideal tool for that job :-) This produces an
identical config.h other than comments. ok?

diff --git a/configure.ac b/configure.ac
index 199975fe..29612439 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2722,6 +2722,43 @@ if test "x$openssl" = "xyes" ; then
HMAC_CTX_init \
RSA_generate_key_ex \
RSA_get_default_method \
+ EVP_CIPHER_CTX_ctrl \
+ ])
+ # LibreSSL/OpenSSL 1.1x API
+ AC_CHECK_FUNCS([ \
+ DH_get0_key \
+ DH_get0_pqg \
+ DH_set0_key \
+ DH_set_length \
+ DH_set0_pqg \
+ DSA_get0_key \
+ DSA_get0_pqg \
+ DSA_set0_key \
+ DSA_set0_pqg \
+ DSA_SIG_get0 \
+ DSA_SIG_set0 \
+ ECDSA_SIG_get0 \
+ ECDSA_SIG_set0 \
+ EVP_CIPHER_CTX_iv \
+ EVP_CIPHER_CTX_iv_noconst \
+ EVP_CIPHER_CTX_get_iv \
+ EVP_CIPHER_CTX_set_iv \
+ RSA_get0_crt_params \
+ RSA_get0_factors \
+ RSA_get0_key \
+ RSA_set0_crt_params \
+ RSA_set0_factors \
+ RSA_set0_key \
+ RSA_meth_free \
+ RSA_meth_dup \
+ RSA_meth_set1_name \
+ RSA_meth_get_finish \
+ RSA_meth_set_priv_enc \
+ RSA_meth_set_priv_dec \
+ RSA_meth_set_finish \
+ EVP_PKEY_get0_RSA \
+ EVP_MD_CTX_new \
+ EVP_MD_CTX_free \
])

if test "x$openssl_engine" = "xyes" ; then
@@ -2807,119 +2844,6 @@ if test "x$openssl" = "xyes" ; then
]
)

- AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
- [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
- [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
-
- # LibreSSL/OpenSSL 1.1x API
- AC_SEARCH_LIBS([DH_get0_key], [crypto],
- [AC_DEFINE([HAVE_DH_GET0_KEY], [1],
- [Define if libcrypto has DH_get0_key])])
- AC_SEARCH_LIBS([DH_get0_pqg], [crypto],
- [AC_DEFINE([HAVE_DH_GET0_PQG], [1],
- [Define if libcrypto has DH_get0_pqg])])
- AC_SEARCH_LIBS([DH_set0_key], [crypto],
- [AC_DEFINE([HAVE_DH_SET0_KEY], [1],
- [Define if libcrypto has DH_set0_key])])
- AC_SEARCH_LIBS([DH_set_length], [crypto],
- [AC_DEFINE([HAVE_DH_SET_LENGTH], [1],
- [Define if libcrypto has DH_set_length])])
- AC_SEARCH_LIBS([DH_set0_pqg], [crypto],
- [AC_DEFINE([HAVE_DH_SET0_PQG], [1],
- [Define if libcrypto has DH_set0_pqg])])
-
- AC_SEARCH_LIBS([DSA_get0_key], [crypto],
- [AC_DEFINE([HAVE_DSA_GET0_KEY], [1],
- [Define if libcrypto has DSA_get0_key])])
- AC_SEARCH_LIBS([DSA_get0_pqg], [crypto],
- [AC_DEFINE([HAVE_DSA_GET0_PQG], [1],
- [Define if libcrypto has DSA_get0_pqg])])
- AC_SEARCH_LIBS([DSA_set0_key], [crypto],
- [AC_DEFINE([HAVE_DSA_SET0_KEY], [1],
- [Define if libcrypto has DSA_set0_key])])
- AC_SEARCH_LIBS([DSA_set0_pqg], [crypto],
- [AC_DEFINE([HAVE_DSA_SET0_PQG], [1],
- [Define if libcrypto has DSA_set0_pqg])])
-
- AC_SEARCH_LIBS([DSA_SIG_get0], [crypto],
- [AC_DEFINE([HAVE_DSA_SIG_GET0], [1],
- [Define if libcrypto has DSA_SIG_get0])])
- AC_SEARCH_LIBS([DSA_SIG_set0], [crypto],
- [AC_DEFINE([HAVE_DSA_SIG_SET0], [1],
- [Define if libcrypto has DSA_SIG_set0])])
-
- AC_SEARCH_LIBS([ECDSA_SIG_get0], [crypto],
- [AC_DEFINE([HAVE_ECDSA_SIG_GET0], [1],
- [Define if libcrypto has ECDSA_SIG_get0])])
- AC_SEARCH_LIBS([ECDSA_SIG_set0], [crypto],
- [AC_DEFINE([HAVE_ECDSA_SIG_SET0], [1],
- [Define if libcrypto has ECDSA_SIG_set0])])
-
- AC_SEARCH_LIBS([EVP_CIPHER_CTX_iv], [crypto],
- [AC_DEFINE([HAVE_EVP_CIPHER_CTX_IV], [1],
- [Define if libcrypto has EVP_CIPHER_CTX_iv])])
- AC_SEARCH_LIBS([EVP_CIPHER_CTX_iv_noconst], [crypto],
- [AC_DEFINE([HAVE_EVP_CIPHER_CTX_IV_NOCONST], [1],
- [Define if libcrypto has EVP_CIPHER_CTX_iv_noconst])])
- AC_SEARCH_LIBS([EVP_CIPHER_CTX_get_iv], [crypto],
- [AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
- [Define if libcrypto has EVP_CIPHER_CTX_get_iv])])
- AC_SEARCH_LIBS([EVP_CIPHER_CTX_set_iv], [crypto],
- [AC_DEFINE([HAVE_EVP_CIPHER_CTX_SET_IV], [1],
- [Define if libcrypto has EVP_CIPHER_CTX_set_iv])])
-
- AC_SEARCH_LIBS([RSA_get0_crt_params], [crypto],
- [AC_DEFINE([HAVE_RSA_GET0_CRT_PARAMS], [1],
- [Define if libcrypto has RSA_get0_crt_params])])
- AC_SEARCH_LIBS([RSA_get0_factors], [crypto],
- [AC_DEFINE([HAVE_RSA_GET0_FACTORS], [1],
- [Define if libcrypto has RSA_get0_factors])])
- AC_SEARCH_LIBS([RSA_get0_key], [crypto],
- [AC_DEFINE([HAVE_RSA_GET0_KEY], [1],
- [Define if libcrypto has RSA_get0_key])])
- AC_SEARCH_LIBS([RSA_set0_crt_params], [crypto],
- [AC_DEFINE([HAVE_RSA_SET0_CRT_PARAMS], [1],
- [Define if libcrypto has RSA_get0_srt_params])])
- AC_SEARCH_LIBS([RSA_set0_factors], [crypto],
- [AC_DEFINE([HAVE_RSA_SET0_FACTORS], [1],
- [Define if libcrypto has RSA_set0_factors])])
- AC_SEARCH_LIBS([RSA_set0_key], [crypto],
- [AC_DEFINE([HAVE_RSA_SET0_KEY], [1],
- [Define if libcrypto has RSA_set0_key])])
-
- AC_SEARCH_LIBS([RSA_meth_free], [crypto],
- [AC_DEFINE([HAVE_RSA_METH_FREE], [1],
- [Define if libcrypto has RSA_meth_free])])
- AC_SEARCH_LIBS([RSA_meth_dup], [crypto],
- [AC_DEFINE([HAVE_RSA_METH_DUP], [1],
- [Define if libcrypto has RSA_meth_dup])])
- AC_SEARCH_LIBS([RSA_meth_set1_name], [crypto],
- [AC_DEFINE([HAVE_RSA_METH_SET1_NAME], [1],
- [Define if libcrypto has RSA_meth_set1_name])])
- AC_SEARCH_LIBS([RSA_meth_get_finish], [crypto],
- [AC_DEFINE([HAVE_RSA_METH_GET_FINISH], [1],
- [Define if libcrypto has RSA_meth_get_finish])])
- AC_SEARCH_LIBS([RSA_meth_set_priv_enc], [crypto],
- [AC_DEFINE([HAVE_RSA_METH_SET_PRIV_ENC], [1],
- [Define if libcrypto has RSA_meth_set_priv_enc])])
- AC_SEARCH_LIBS([RSA_meth_set_priv_dec], [crypto],
- [AC_DEFINE([HAVE_RSA_METH_SET_PRIV_DEC], [1],
- [Define if libcrypto has RSA_meth_set_priv_dec])])
- AC_SEARCH_LIBS([RSA_meth_set_finish], [crypto],
- [AC_DEFINE([HAVE_RSA_METH_SET_FINISH], [1],
- [Define if libcrypto has RSA_meth_set_finish])])
-
- AC_SEARCH_LIBS([EVP_PKEY_get0_RSA], [crypto],
- [AC_DEFINE([HAVE_EVP_PKEY_GET0_RSA], [1],
- [Define if libcrypto has EVP_PKEY_get0_RSA])])
-
- AC_SEARCH_LIBS([EVP_MD_CTX_new], [crypto],
- [AC_DEFINE([HAVE_EVP_MD_CTX_NEW], [1],
- [Define if libcrypto has EVP_MD_CTX_new])])
- AC_SEARCH_LIBS([EVP_MD_CTX_free], [crypto],
- [AC_DEFINE([HAVE_EVP_MD_CTX_FREE], [1],
- [Define if libcrypto has EVP_MD_CTX_free])])
-
AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new)
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
Damien Miller
2018-11-08 03:32:01 UTC
Permalink
ok djm
Post by Darren Tucker
[...] AC_SEARCH_LIBS
Post by Damien Miller
IIRC I tried that and it didn't work, but maybe I'm misremembering.
I think it should work. I'll give it a go.
AC_SEARCH_LIBS isn't the ideal tool for that job :-) This produces an
identical config.h other than comments. ok?
diff --git a/configure.ac b/configure.ac
index 199975fe..29612439 100644
--- a/configure.ac
+++ b/configure.ac
[snip]

Loading...