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