EVP_VERIFYINIT(3SSL)
π NAME π
okay so bestie, this whole page is about the EVP signature verification squad β¨ β the girlies that check whether a signature is legit. We got:
EVP_VerifyInit_exEVP_VerifyInitEVP_VerifyUpdateEVP_VerifyFinal_exEVP_VerifyFinal
they're the EVP signature verification functions, and yes they all live in the OpenSSL 3SSL manual, part of the OpenSSL fam π«Ά
β¨ SYNOPSIS β¨
like, here's the receipts, copy-paste exactly:
#include <openssl/evp.h>
int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
unsigned int siglen, EVP_PKEY *pkey,
OSSL_LIB_CTX *libctx, const char *propq);
int EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, unsigned int siglen,
EVP_PKEY *pkey);
int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type);
πΈ DESCRIPTION πΈ
The EVP signature verification routines are literally a high-level interface to digital signatures. no cap, it's giving "let the library handle the algorithm drama, you just verify the vibe" π
- EVP_VerifyInit_ex() sets up the verification context
ctxto use digesttype. And bestie listen βctxmust be created by callingEVP_MD_CTX_new()before you call this function, no exceptions. Alsoimplmust beNULL. periodt. - EVP_VerifyUpdate() hashes
cntbytes of data atdinto the verification contextctx. You can call this several times on the samectxto pile on more data πβ¨ - EVP_VerifyFinal_ex() verifies the data in
ctxusing the public keypkeyandsiglenbytes insigbuf. The library contextlibctxand property querypropqare used when creating a context to use with the keypkey. iykyk π₯ - EVP_VerifyFinal() is similar to
EVP_VerifyFinal_ex()but uses default values ofNULLfor the library contextlibctxand the property querypropq. it's the chill, no-extra-args version π - EVP_VerifyInit() initializes the verification context
ctxto use the default implementation of digesttype.
π RETURN VALUES π
okay so here's the scoreboard:
EVP_VerifyInit_ex()andEVP_VerifyUpdate()return1for success and0for failure. simple as πEVP_VerifyFinal_ex()andEVP_VerifyFinal()return1for a correct signature π,0for failure, and a negative value if some other error occurred π- The error codes can be obtained by
ERR_get_error(3).
π¦ NOTES π¦
ngl, the EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. Why? because the code then becomes transparent to the algorithm used and much more flexible. main character energy fr fr π
The call to EVP_VerifyFinal() internally finalizes a copy of the digest context. Which means calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called later to digest and verify additional data. Applications may disable this behavior by setting the EVP_MD_CTX_FLAG_FINALISE context flag via EVP_MD_CTX_set_flags(3).
π¨ bestie this is the important one: since only a copy of the digest context is ever finalized, the context must be cleaned up after use by calling EVP_MD_CTX_free() β or a memory leak will occur. don't leave her hanging, free her π
Note that not all providers support continuation. In case the selected provider does not allow to duplicate contexts, EVP_VerifyFinal() will finalize the digest context and attempting to process additional data via EVP_VerifyUpdate() will result in an error. so watch out π
π BUGS π
- Older versions of this documentation wrongly stated that calls to
EVP_VerifyUpdate()could not be made after callingEVP_VerifyFinal(). yeah that was a lie, and it's been corrected π - Since the public key is passed in the call to
EVP_SignFinal()any error relating to the private key (for example an unsuitable key and digest combination) will not be indicated until after potentially large amounts of data have been passed throughEVP_SignUpdate(). it's giving "we told you too late" π - It is not possible to change the signing parameters using these function.
- The previous two bugs are fixed in the newer
EVP_DigestVerify*()function. slay β¨
π SEE ALSO π
evp(7)EVP_SignInit(3)EVP_DigestInit(3)evp(7)HMAC(3)MD2(3)MD5(3)MDC2(3)RIPEMD160(3)SHA1(3)openssl-dgst(1)
(yes, evp(7) is listed twice in the original β iconic of her honestly π)
β HISTORY β
The function EVP_VerifyFinal_ex() was added in OpenSSL 3.0. new girl on the block π
π COPYRIGHT π
Copyright 2000-2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page bestie, go verify some signatures, you're gonna eat πβ¨
signing off from theEVP_VERIFYINIT(3SSL)page β OpenSSL3SSL, version4.0.3, dated2026-09-29π«Άπ·
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms