From 53a5ba5c8476097fb5145cee4bed61b82d0cc225 Mon Sep 17 00:00:00 2001 From: Juergen Repp Date: Mon, 7 Jun 2021 09:47:30 +0200 Subject: [PATCH 02/23] FAPI: Remove useless code get_engine. The function did always return NULL. So the default engine was used. Fixes #2085 Signed-off-by: Juergen Repp --- src/tss2-fapi/fapi_crypto.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/tss2-fapi/fapi_crypto.c b/src/tss2-fapi/fapi_crypto.c index c50b5f0a..9c7e566c 100644 --- a/src/tss2-fapi/fapi_crypto.c +++ b/src/tss2-fapi/fapi_crypto.c @@ -56,9 +56,6 @@ typedef struct _IFAPI_CRYPTO_CONTEXT { size_t hashSize; } IFAPI_CRYPTO_CONTEXT; -/** A singleton crypto engine for hash operations */ -static ENGINE *engine = NULL; - /** * Returns the signature scheme that is currently used in the FAPI context. * @@ -228,23 +225,6 @@ ifapi_bn2binpad(const BIGNUM *bn, unsigned char *bin, int binSize) return 1; } -/** - * Returns the singleton hash engine for the use in ifapi_hash operations. If - * it does not yet exist, this function creates it. - * - * @retval A singleton hash engine - */ -static ENGINE * -get_engine() -{ - /* If an engine is present, it is returned */ - if (engine) - return engine; - /* Otherwise, engine is created and returned */ - engine = ENGINE_by_id(NULL); - return engine; -} - /** * Returns a suitable openSSL hash algorithm identifier for a given TSS hash * algorithm identifier. @@ -1558,7 +1538,7 @@ ifapi_crypto_hash_start(IFAPI_CRYPTO_CONTEXT_BLOB **context, } if (1 != EVP_DigestInit_ex(mycontext->osslContext, - mycontext->osslHashAlgorithm, get_engine())) { + mycontext->osslHashAlgorithm, NULL)) { goto_error(r, TSS2_FAPI_RC_GENERAL_FAILURE, "Error EVP_DigestInit_ex", cleanup); } -- 2.34.3