summaryrefslogtreecommitdiff
path: root/crypto/engine/eng_dyn.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2022-03-15 22:18:15 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2022-03-15 22:18:15 +0000
commitd6d3d400982465ee2c394caa850ba51c537b5a09 (patch)
treeb585b42a59bad0b1d2f9161d22da3b590692ea52 /crypto/engine/eng_dyn.c
parent56eae1b760adf10835560a9ee595549a1f10410f (diff)
Import OpenSSL 1.1.1nvendor/openssl/1.1.1n
Diffstat (limited to 'crypto/engine/eng_dyn.c')
-rw-r--r--crypto/engine/eng_dyn.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c
index 87c762edb8a0..6a0ddc162d00 100644
--- a/crypto/engine/eng_dyn.c
+++ b/crypto/engine/eng_dyn.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -443,8 +443,17 @@ static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
* We fail if the version checker veto'd the load *or* if it is
* deferring to us (by returning its version) and we think it is too
* old.
+ * Unfortunately the version checker does not distinguish between
+ * engines built for openssl 1.1.x and openssl 3.x, but loading
+ * an engine that is built for openssl 3.x will cause a fatal
+ * error. Detect such engines, since EVP_PKEY_get_base_id is exported
+ * as a function in openssl 3.x, while it is named EVP_PKEY_base_id
+ * in openssl 1.1.x. Therefore we take the presence of that symbol
+ * as an indication that the engine will be incompatible.
*/
- if (vcheck_res < OSSL_DYNAMIC_OLDEST) {
+ if (vcheck_res < OSSL_DYNAMIC_OLDEST
+ || DSO_bind_func(ctx->dynamic_dso,
+ "EVP_PKEY_get_base_id") != NULL) {
/* Fail */
ctx->bind_engine = NULL;
ctx->v_check = NULL;