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

Prevent segfault after ctx_finish(). #511

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/eng_front.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ static int engine_finish(ENGINE *engine)
* engine_finish() is also executed from ENGINE_finish() without
* acquired CRYPTO_LOCK_ENGINE, and there is no way with to check
* whether a lock is already acquired with OpenSSL < 1.1.0 API. */
#if OPENSSL_VERSION_NUMBER >= 0x10100005L && !defined(LIBRESSL_VERSION_NUMBER)

/* When using openssl 1.1.1n or 3.0.9, calling ctx_finish()
* was found to cause a segmentation fault
* (tests/search-all-matching-tokens.softhsm). It is much
* better not to call ctx_finish() and cause a memory leak
* than a segfault. */
#if 0
rv &= ctx_finish(ctx);
#endif

Expand Down
2 changes: 1 addition & 1 deletion tests/search-all-matching-tokens.softhsm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ echo "secret" > "${outdir}/in.txt"
openssl pkeyutl -engine pkcs11 -keyform engine \
-inkey "${PRIVATE_KEY_WITHOUT_TOKEN}" \
-sign -out "${outdir}/signature.bin" -in "${outdir}/in.txt"
if test $? = 0;then
if test $? != 1;then
echo "Did not fail when the PKCS#11 URI matched multiple tokens"
exit 1;
fi
Expand Down
Loading