Repository navigation
Closed
Description
Describe the bug
Tried compiling libssh2 (latest master) with an OpenSSL 3
configured with its no-deprecated option.
To Reproduce
- build OpenSSL 3 with
no-deprecated:
./Configure no-depcrecated - build libssh2 against the above OpenSSL.
Expected behavior
Successful build.
Version (please complete the following information):
- OS and version: (any)
- libssh2 version: 1.11.1-DEV master
- crypto backend and version: OpenSSL 3 +
no-deprecated
Additional context
It seems to come down to missing HMAC_*() APIs and a remaining.
reference to EC_KEY [FIXED in #1236]
I used a patched curl-for-win build for tests. Here is the output
(this is a macOS build with Xcode):
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:34:
src/knownhost.c:424:21: error: implicit declaration of function 'HMAC_CTX_new' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_ctx_init(ctx);
^
src/openssl.h:330:42: note: expanded from macro 'libssh2_hmac_ctx_init'
#define libssh2_hmac_ctx_init(ctx) ctx = HMAC_CTX_new()
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:34:
src/knownhost.c:424:21: warning: incompatible integer to pointer conversion assigning to 'HMAC_CTX *' (aka 'struct hmac_ctx_st *') from 'int' [-Wint-conversion]
libssh2_hmac_ctx_init(ctx);
^~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.h:330:40: note: expanded from macro 'libssh2_hmac_ctx_init'
#define libssh2_hmac_ctx_init(ctx) ctx = HMAC_CTX_new()
^ ~~~~~~~~~~~~~~
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:34:
src/knownhost.c:431:21: error: implicit declaration of function 'HMAC_Init_ex' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_sha1_init(&ctx, (unsigned char *)node->salt,
^
src/openssl.h:332:5: note: expanded from macro 'libssh2_hmac_sha1_init'
HMAC_Init_ex(*(ctx), key, (int)keylen, EVP_sha1(), NULL)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:34:
src/knownhost.c:433:21: error: implicit declaration of function 'HMAC_Update' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_update(ctx, (unsigned char *)host,
^
src/openssl.h:348:5: note: expanded from macro 'libssh2_hmac_update'
HMAC_Update(ctx, data, datalen)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:34:
src/knownhost.c:435:21: error: implicit declaration of function 'HMAC_Final' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_final(ctx, hash);
^
src/openssl.h:350:39: note: expanded from macro 'libssh2_hmac_final'
#define libssh2_hmac_final(ctx, data) HMAC_Final(ctx, data, NULL)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:34:
src/knownhost.c:436:21: error: implicit declaration of function 'HMAC_CTX_free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_cleanup(&ctx);
^
src/openssl.h:351:35: note: expanded from macro 'libssh2_hmac_cleanup'
#define libssh2_hmac_cleanup(ctx) HMAC_CTX_free(*(ctx))
^
src/knownhost.c:436:21: note: did you mean 'HMAC_CTX_new'?
src/openssl.h:351:35: note: expanded from macro 'libssh2_hmac_cleanup'
#define libssh2_hmac_cleanup(ctx) HMAC_CTX_free(*(ctx))
^
src/knownhost.c:424:21: note: 'HMAC_CTX_new' declared here
libssh2_hmac_ctx_init(ctx);
^
src/openssl.h:330:42: note: expanded from macro 'libssh2_hmac_ctx_init'
#define libssh2_hmac_ctx_init(ctx) ctx = HMAC_CTX_new()
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:131:5: error: implicit declaration of function 'HMAC_CTX_new' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_ctx_init(ctx);
^
src/openssl.h:330:42: note: expanded from macro 'libssh2_hmac_ctx_init'
#define libssh2_hmac_ctx_init(ctx) ctx = HMAC_CTX_new()
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:131:5: warning: incompatible integer to pointer conversion assigning to 'HMAC_CTX *' (aka 'struct hmac_ctx_st *') from 'int' [-Wint-conversion]
libssh2_hmac_ctx_init(ctx);
^~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.h:330:40: note: expanded from macro 'libssh2_hmac_ctx_init'
#define libssh2_hmac_ctx_init(ctx) ctx = HMAC_CTX_new()
^ ~~~~~~~~~~~~~~
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:132:5: error: implicit declaration of function 'HMAC_Init_ex' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_sha512_init(&ctx, *abstract, 64);
^
src/openssl.h:340:5: note: expanded from macro 'libssh2_hmac_sha512_init'
HMAC_Init_ex(*(ctx), key, (int)keylen, EVP_sha512(), NULL)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:133:5: error: implicit declaration of function 'HMAC_Update' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_update(ctx, seqno_buf, 4);
^
src/openssl.h:348:5: note: expanded from macro 'libssh2_hmac_update'
HMAC_Update(ctx, data, datalen)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:138:5: error: implicit declaration of function 'HMAC_Final' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_final(ctx, buf);
^
src/openssl.h:350:39: note: expanded from macro 'libssh2_hmac_final'
#define libssh2_hmac_final(ctx, data) HMAC_Final(ctx, data, NULL)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:139:5: error: implicit declaration of function 'HMAC_CTX_free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_cleanup(&ctx);
^
src/openssl.h:351:35: note: expanded from macro 'libssh2_hmac_cleanup'
#define libssh2_hmac_cleanup(ctx) HMAC_CTX_free(*(ctx))
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:186:5: error: implicit declaration of function 'HMAC_CTX_new' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_ctx_init(ctx);
^
src/openssl.h:330:42: note: expanded from macro 'libssh2_hmac_ctx_init'
#define libssh2_hmac_ctx_init(ctx) ctx = HMAC_CTX_new()
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:186:5: warning: incompatible integer to pointer conversion assigning to 'HMAC_CTX *' (aka 'struct hmac_ctx_st *') from 'int' [-Wint-conversion]
libssh2_hmac_ctx_init(ctx);
^~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.h:330:40: note: expanded from macro 'libssh2_hmac_ctx_init'
#define libssh2_hmac_ctx_init(ctx) ctx = HMAC_CTX_new()
^ ~~~~~~~~~~~~~~
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:187:5: error: implicit declaration of function 'HMAC_Init_ex' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_sha256_init(&ctx, *abstract, 32);
^
src/openssl.h:338:5: note: expanded from macro 'libssh2_hmac_sha256_init'
HMAC_Init_ex(*(ctx), key, (int)keylen, EVP_sha256(), NULL)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:188:5: error: implicit declaration of function 'HMAC_Update' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_update(ctx, seqno_buf, 4);
^
src/openssl.h:348:5: note: expanded from macro 'libssh2_hmac_update'
HMAC_Update(ctx, data, datalen)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:193:5: error: implicit declaration of function 'HMAC_Final' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_final(ctx, buf);
^
src/openssl.h:350:39: note: expanded from macro 'libssh2_hmac_final'
#define libssh2_hmac_final(ctx, data) HMAC_Final(ctx, data, NULL)
^
In file included from ./_a64-mac-sys-bld/src/CMakeFiles/libssh2_static.dir/Unity/unity_0_c.c:37:
src/mac.c:194:5: error: implicit declaration of function 'HMAC_CTX_free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_hmac_cleanup(&ctx);
^
src/openssl.h:351:35: note: expanded from macro 'libssh2_hmac_cleanup'
#define libssh2_hmac_cleanup(ctx) HMAC_CTX_free(*(ctx))
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
/cc @MichaelBuckley
Metadata
Metadata
Assignees
Labels
No labels
Activity
openssl: fix `EC_KEY` reference with OpenSSL 3 no-deprecated build
vszakats commentedon Nov 21, 2023
Attempt to fix the
EC_KEYissue: #1236 [MERGED]openssl: fix `EC_KEY` reference with OpenSSL 3 no-deprecated build
openssl: fix `EC_KEY` reference with OpenSSL 3 `no-deprecated` build
[-]Errors while compiling with OpenSSL 3 `no-deprecated` build[/-][+]openssl: building with v3 `no-deprecated` misses `HMAC_CTX_*()` functions[/+]vszakats commentedon Nov 25, 2023
Reproduced in CI here:
https://github.com/libssh2/libssh2/actions/runs/6985994596/job/19010948043#step:14:39
Squashed commit of the following:
Squashed commit of the following:
openssl: use OpenSSL 3 HMAC API, add `no-deprecated` CI job
openssl: fix `EC_KEY` reference with OpenSSL 3 `no-deprecated` build
openssl: use OpenSSL 3 HMAC API, add `no-deprecated` CI job