1*e71b7053SJung-uk Kim=pod 2*e71b7053SJung-uk Kim 3*e71b7053SJung-uk Kim=head1 NAME 4*e71b7053SJung-uk Kim 5*e71b7053SJung-uk KimEVP_VerifyInit_ex, 6*e71b7053SJung-uk KimEVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal 7*e71b7053SJung-uk Kim- EVP signature verification functions 8*e71b7053SJung-uk Kim 9*e71b7053SJung-uk Kim=head1 SYNOPSIS 10*e71b7053SJung-uk Kim 11*e71b7053SJung-uk Kim #include <openssl/evp.h> 12*e71b7053SJung-uk Kim 13*e71b7053SJung-uk Kim int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); 14*e71b7053SJung-uk Kim int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); 15*e71b7053SJung-uk Kim int EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, unsigned int siglen, 16*e71b7053SJung-uk Kim EVP_PKEY *pkey); 17*e71b7053SJung-uk Kim 18*e71b7053SJung-uk Kim int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type); 19*e71b7053SJung-uk Kim 20*e71b7053SJung-uk Kim=head1 DESCRIPTION 21*e71b7053SJung-uk Kim 22*e71b7053SJung-uk KimThe EVP signature verification routines are a high level interface to digital 23*e71b7053SJung-uk Kimsignatures. 24*e71b7053SJung-uk Kim 25*e71b7053SJung-uk KimEVP_VerifyInit_ex() sets up verification context B<ctx> to use digest 26*e71b7053SJung-uk KimB<type> from ENGINE B<impl>. B<ctx> must be created by calling 27*e71b7053SJung-uk KimEVP_MD_CTX_new() before calling this function. 28*e71b7053SJung-uk Kim 29*e71b7053SJung-uk KimEVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the 30*e71b7053SJung-uk Kimverification context B<ctx>. This function can be called several times on the 31*e71b7053SJung-uk Kimsame B<ctx> to include additional data. 32*e71b7053SJung-uk Kim 33*e71b7053SJung-uk KimEVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey> 34*e71b7053SJung-uk Kimand against the B<siglen> bytes at B<sigbuf>. 35*e71b7053SJung-uk Kim 36*e71b7053SJung-uk KimEVP_VerifyInit() initializes verification context B<ctx> to use the default 37*e71b7053SJung-uk Kimimplementation of digest B<type>. 38*e71b7053SJung-uk Kim 39*e71b7053SJung-uk Kim=head1 RETURN VALUES 40*e71b7053SJung-uk Kim 41*e71b7053SJung-uk KimEVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0 for 42*e71b7053SJung-uk Kimfailure. 43*e71b7053SJung-uk Kim 44*e71b7053SJung-uk KimEVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some 45*e71b7053SJung-uk Kimother error occurred. 46*e71b7053SJung-uk Kim 47*e71b7053SJung-uk KimThe error codes can be obtained by L<ERR_get_error(3)>. 48*e71b7053SJung-uk Kim 49*e71b7053SJung-uk Kim=head1 NOTES 50*e71b7053SJung-uk Kim 51*e71b7053SJung-uk KimThe B<EVP> interface to digital signatures should almost always be used in 52*e71b7053SJung-uk Kimpreference to the low level interfaces. This is because the code then becomes 53*e71b7053SJung-uk Kimtransparent to the algorithm used and much more flexible. 54*e71b7053SJung-uk Kim 55*e71b7053SJung-uk KimThe call to EVP_VerifyFinal() internally finalizes a copy of the digest context. 56*e71b7053SJung-uk KimThis means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called 57*e71b7053SJung-uk Kimlater to digest and verify additional data. 58*e71b7053SJung-uk Kim 59*e71b7053SJung-uk KimSince only a copy of the digest context is ever finalized the context must 60*e71b7053SJung-uk Kimbe cleaned up after use by calling EVP_MD_CTX_free() or a memory leak 61*e71b7053SJung-uk Kimwill occur. 62*e71b7053SJung-uk Kim 63*e71b7053SJung-uk Kim=head1 BUGS 64*e71b7053SJung-uk Kim 65*e71b7053SJung-uk KimOlder versions of this documentation wrongly stated that calls to 66*e71b7053SJung-uk KimEVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal(). 67*e71b7053SJung-uk Kim 68*e71b7053SJung-uk KimSince the public key is passed in the call to EVP_SignFinal() any error 69*e71b7053SJung-uk Kimrelating to the private key (for example an unsuitable key and digest 70*e71b7053SJung-uk Kimcombination) will not be indicated until after potentially large amounts of 71*e71b7053SJung-uk Kimdata have been passed through EVP_SignUpdate(). 72*e71b7053SJung-uk Kim 73*e71b7053SJung-uk KimIt is not possible to change the signing parameters using these function. 74*e71b7053SJung-uk Kim 75*e71b7053SJung-uk KimThe previous two bugs are fixed in the newer EVP_VerifyDigest*() function. 76*e71b7053SJung-uk Kim 77*e71b7053SJung-uk Kim=head1 SEE ALSO 78*e71b7053SJung-uk Kim 79*e71b7053SJung-uk KimL<evp(7)>, 80*e71b7053SJung-uk KimL<EVP_SignInit(3)>, 81*e71b7053SJung-uk KimL<EVP_DigestInit(3)>, 82*e71b7053SJung-uk KimL<evp(7)>, L<HMAC(3)>, L<MD2(3)>, 83*e71b7053SJung-uk KimL<MD5(3)>, L<MDC2(3)>, L<RIPEMD160(3)>, 84*e71b7053SJung-uk KimL<SHA1(3)>, L<dgst(1)> 85*e71b7053SJung-uk Kim 86*e71b7053SJung-uk Kim=head1 COPYRIGHT 87*e71b7053SJung-uk Kim 88*e71b7053SJung-uk KimCopyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. 89*e71b7053SJung-uk Kim 90*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License"). You may not use 91*e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 92*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 93*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 94*e71b7053SJung-uk Kim 95*e71b7053SJung-uk Kim=cut 96