Skip to content

Commit e3b25cc

Browse files
Mike Frysingervapier
authored andcommitted
avoid deprecated ERR_load_crypto_strings API
This function was deprecated in 1.1.0 which setting OpenSSL API compt to 0x10100000L disables the API. Trying to build with OpenSSL 1.1.1w fails now with: ssherr-libcrypto.c:39:2: error: call to undeclared function 'ERR_load_crypto_strings'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 39 | ERR_load_crypto_strings(); | ^ From the OpenSSL CHANGES file: > However, applications are strongly advised to compile their source files with > -DOPENSSL_API_COMPAT=0x10100000L, which hides the declarations of all interfaces > deprecated in 0.9.8, 1.0.0 or the 1.1.0 releases. Switch to the replacement API which is available in OpenSSL 1.1.1 (the oldest OpenSSH supports) and all current versions.
1 parent 4168c90 commit e3b25cc

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,7 +3189,7 @@ if test "x$openssl" = "xyes" ; then
31893189
AC_MSG_CHECKING([if programs using OpenSSL functions will link])
31903190
AC_LINK_IFELSE(
31913191
[AC_LANG_PROGRAM([[ #include <openssl/err.h> ]],
3192-
[[ ERR_load_crypto_strings(); ]])],
3192+
[[ OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); ]])],
31933193
[
31943194
AC_MSG_RESULT([yes])
31953195
],
@@ -3199,7 +3199,7 @@ if test "x$openssl" = "xyes" ; then
31993199
AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
32003200
AC_LINK_IFELSE(
32013201
[AC_LANG_PROGRAM([[ #include <openssl/err.h> ]],
3202-
[[ ERR_load_crypto_strings(); ]])],
3202+
[[ OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); ]])],
32033203
[
32043204
AC_MSG_RESULT([yes])
32053205
CHANNELLIBS="$CHANNELLIBS -ldl"

regress/misc/ssh-verify-attestation/ssh-verify-attestation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ main(int argc, char **argv)
339339
extern int optind;
340340
/* extern char *optarg; */
341341

342-
ERR_load_crypto_strings();
342+
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
343343

344344
sanitise_stdfd();
345345
log_init(__progname, log_level, SYSLOG_FACILITY_AUTH, 1);

regress/unittests/sshsig/tests.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <unistd.h>
1818

1919
#ifdef WITH_OPENSSL
20+
#include <openssl/err.h>
2021
#include <openssl/evp.h>
2122
#include <openssl/crypto.h>
2223
#endif
@@ -85,7 +86,7 @@ tests(void)
8586

8687
#ifdef WITH_OPENSSL
8788
OpenSSL_add_all_algorithms();
88-
ERR_load_crypto_strings();
89+
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
8990
#endif
9091

9192
TEST_START("load data");

regress/unittests/test_helper/test_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ main(int argc, char **argv)
151151

152152
seed_rng();
153153
#ifdef WITH_OPENSSL
154-
ERR_load_crypto_strings();
154+
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
155155
#endif
156156

157157
/* Handle systems without __progname */

ssherr-libcrypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ssherr_libcrypto(void)
3636
const char *reason = NULL, *file, *data;
3737
int ln, fl;
3838

39-
ERR_load_crypto_strings();
39+
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
4040
while ((e = ERR_get_error_line_data(&file, &ln, &data, &fl)) != 0) {
4141
ERR_error_string_n(e, buf, sizeof(buf));
4242
snprintf(msg, sizeof(msg), "%s:%s:%d:%s", buf, file, ln,

0 commit comments

Comments
 (0)