From aeeb119fd8652c044cd5ceebce572b5c716914e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Sat, 12 Jun 2021 08:40:53 +0300 Subject: [PATCH] crypto: make EVP_MD_CTX_FLAG_FINALISE optional Improves compatibility with libressl, wolfssl and older openssl libraries not having the flag. Usage of this is optional as it's purely performance optimization related flag. --- src/apk_crypto.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/apk_crypto.h b/src/apk_crypto.h index 4697901..6f6e801 100644 --- a/src/apk_crypto.h +++ b/src/apk_crypto.h @@ -85,7 +85,9 @@ static inline int apk_digest_ctx_init(struct apk_digest_ctx *dctx, uint8_t alg) dctx->mdctx = EVP_MD_CTX_new(); if (!dctx->mdctx) return -ENOMEM; dctx->alg = alg; +#ifdef EVP_MD_CTX_FLAG_FINALISE EVP_MD_CTX_set_flags(dctx->mdctx, EVP_MD_CTX_FLAG_FINALISE); +#endif EVP_DigestInit_ex(dctx->mdctx, apk_digest_alg_to_evp(alg), 0); return 0; }