EVP_VERIFYINIT(3)
π EVP_VERIFYINIT(3) π
okay so this is the libcrypto manual page β yes, the crypto library one, from the Library Functions Manual squad β and it's all about the EVP signature verification girlies. buckle up bestie, we're checking signatures π₯
β¨ NAME β¨
EVP_VerifyInit_ex, EVP_VerifyUpdate, EVP_VerifyFinal, EVP_VerifyInit β the EVP signature verification functions. literally the whole friend group π«Ά
πΈ SYNOPSIS πΈ
library βlibcryptoβ #include <openssl/evp.h>
int
EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *engine);
int
EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
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 a high-level interface to digital signatures. high-level!! we love not touching the low-level machinery directly π
EVP_VerifyInit_ex()β sets up the verification contextctxto use the digesttype. Before you call this, you gotta obtainctxfromEVP_MD_CTX_new(3)or callEVP_MD_CTX_reset(3)on it. and theengineargument? it's always ignored, so passingNULLis what's recommended. that param is giving background character energy ngl πEVP_VerifyUpdate()β hashescntbytes of data atdinto the verification contextctx. you can call this several times on the samectxto include additional data β yes, multiple times, go off, feed it more πEVP_VerifyFinal()β verifies the data inctxusing the public keypkey, and against thesiglenbytes atsigbuf. the final boss check πEVP_VerifyInit()β initializes a verification contextctxto use the default implementation of digesttype.
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. it's giving 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. copy, not the original β that's the whole trick, iykyk π
β οΈ 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(3), or a memory leak will occur. not a leak bestie, a whole situation π clean up after yourself!!
also important: EVP_VerifyInit_ex(), EVP_VerifyUpdate(), and EVP_VerifyInit() are implemented as macros. so don't be weird about taking their address or whatever π
π RETURN VALUES π
EVP_VerifyInit_ex()andEVP_VerifyUpdate()β return1for success and0for failure. simple girlie pop logic πEVP_VerifyFinal()β returns1for a correct signature,0for failure, and-1if some other error occurred. three whole moods π
The error codes can be obtained by ERR_get_error(3). go read them, they'll tell you what's up β
π§ SEE ALSO π§
evp(3), EVP_DigestInit(3), EVP_SignInit(3) β the rest of the friend group, go say hi π«Ά
π HISTORY π
EVP_VerifyInit(), EVP_VerifyUpdate(), and EVP_VerifyFinal() first appeared in SSLeay 0.5.1 and have been available since OpenBSD 2.4. ancient icons, genuinely ποΈ
EVP_VerifyInit_ex() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2. the newer sibling, still lowkey vintage πΈ
π BUGS π
Older versions of this documentation wrongly stated that calls to EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal(). wrong!! the docs were lying to you, and this page is the correction π©Ή
Since the public key is passed in the call to EVP_SignFinal(3), 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 through EVP_SignUpdate(3). so like... you do all this work and then it tells you the key was bad. brutal π
It is not possible to change the signing parameters using these functions. nope, no take-backs, no edits π
The previous two bugs are fixed in the newer functions of the EVP_DigestVerifyInit(3) family. so if you want the fixed-up glow-up versions, that's where they're at π₯
and that's the page bestie!! π
β¨ this one shipped in the Debian edition, dated June 8, 2025 β so go verify some signatures responsibly, and remember: free your context when you're done with it. mwah ππ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2000, 2001, 2006, 2016 The OpenSSL Project
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms