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.cute-signatures
parent
4403e7ec32
commit
aeeb119fd8
|
@ -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();
|
dctx->mdctx = EVP_MD_CTX_new();
|
||||||
if (!dctx->mdctx) return -ENOMEM;
|
if (!dctx->mdctx) return -ENOMEM;
|
||||||
dctx->alg = alg;
|
dctx->alg = alg;
|
||||||
|
#ifdef EVP_MD_CTX_FLAG_FINALISE
|
||||||
EVP_MD_CTX_set_flags(dctx->mdctx, 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);
|
EVP_DigestInit_ex(dctx->mdctx, apk_digest_alg_to_evp(alg), 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue