-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
s2n links static version libcrypto #2735
Comments
We have make some cmake changes from v1.9 to v1.11 so that might be what is causing this error that you are seeing. Looking into this, but you can follow the tracking issue here: #1888 |
Thanks for looking into this! BTW:
|
We removed finding libcryto all together in a recent release, can you please confirm if this is still a problem? I tried building off of main using the implicit cmake build commands:
looking at the installed binary i see it linking against a shared libcrypto:
so interested if you are still seeing this |
Thanks for looking into this! Unfortunately the project i ran into this issue with, is no longer active and so i can not check with a recent release! |
Closing this for now because it should be fixed. Please make sure you are using the latest version of this sdk and open a new issue if you're still running into this error |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
After updating aws-sdk-cpp from version 1.9.212 to 1.11.189 we experienced very strange failures during initialization of an TLS capable HTTP server (httplib::SSLServer, https://github.com/yhirose/cpp-httplib).
What we found it that:
SSL_CTX_use_certificate_chain_file()
)err_thread_local
used as "key" to get the thread local instance of the struct OpenSSL uses to store errors)PEM_read_bio_X509()
fromuse_certificate_chain_file()
in ssl_rsa.c:634. The functionget_name()
in pem_lib.c:745 sets aPEM_R_NO_START_LINE
error to signal "end-of-file", but whenuse_certificate_chain_file()
in ssl_rsa.c:653 checks for it, no error code is set and a "real error" is assumed (see ssl_rsa.c:658).This all is within one thread and in a single OpenSSL function!
=>
use_certificate_chain_file()
returns with error.Workaround we currently use is to rename/delete libcrypto.a (and libssl.a) after we built OpenSSL and before building aws-sdk-cpp.
IMHO there is no (documented) build option in OpenSSL to not build the static libs ...
Callstack where PEM_R_NO_START_LINE error is set:
Callstack with check for PEM_R_NO_START_LINE:
Expected Behavior
When building aws-sdk-cpp resp. S3 and OpenSSL is used, s2n should always link libcrypto.so (if present).
Current Behavior
When building aws-sdk-cpp (resp. S3) and OpenSSL is used, s2n always links libcrypto.a (static link library) even if libcrypto.so is available on the same path and was found by FindCrypto!
Reproduction Steps
Build openssl 1.1.1w:
Build libcurl 8.4:
Build S3 part of aws-sdk-cpp:
We include the aws-sdk-cpp in our cmake projekt using this:
So our binaries (shared libs and executables) link "awssdk_libs".
When inspecting the compiler/linker command lines both libcrypto.a and libcrypto.so are linked!
Possible Solution
Always link shared OpenSSL libraries if found and not explicitely configured to link static versions.
Additional Information/Context
openssl 1.1.1w
libcurl 8.4
aws-sdk-cpp 1.11.189
cpp-httplib 0.14.1
boost 1.80
fmt 9.1.0
nlohmann json 3.11.2
range-v3 0.12.0
spdlog 1.11.0
and some more libs
cmake 3.24.3
So libcrypto is at least used in our software via:
We also have code that uses functions from libcrypto directly.
We build all our code with visibility=hidden, "position independent code" on, C++20
AWS CPP SDK version used
1.11.189
Compiler and Version used
gcc 12.2.1 (Red Hat 12.2.1-7)
Operating System and version
RHEL 8.8
The text was updated successfully, but these errors were encountered: