]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/EVP_VerifyInit.pod
Remove an unnecessary call to BN_CTX_free.
[thirdparty/openssl.git] / doc / man3 / EVP_VerifyInit.pod
CommitLineData
f7173262
DSH
1=pod
2
3=head1 NAME
4
c952780c
RS
5EVP_VerifyInit_ex,
6EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal
7- EVP signature verification functions
f7173262
DSH
8
9=head1 SYNOPSIS
10
11 #include <openssl/evp.h>
12
3811eed8
DSH
13 int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
14 int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
e9b77246
BB
15 int EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, unsigned int siglen,
16 EVP_PKEY *pkey);
f7173262 17
3811eed8
DSH
18 int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type);
19
f7173262
DSH
20=head1 DESCRIPTION
21
22The EVP signature verification routines are a high level interface to digital
23signatures.
24
3811eed8 25EVP_VerifyInit_ex() sets up verification context B<ctx> to use digest
25191fff
RL
26B<type> from ENGINE B<impl>. B<ctx> must be created by calling
27EVP_MD_CTX_new() before calling this function.
f7173262
DSH
28
29EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the
c8973693 30verification context B<ctx>. This function can be called several times on the
f7173262
DSH
31same B<ctx> to include additional data.
32
33EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey>
3811eed8
DSH
34and against the B<siglen> bytes at B<sigbuf>.
35
36EVP_VerifyInit() initializes verification context B<ctx> to use the default
37implementation of digest B<type>.
f7173262
DSH
38
39=head1 RETURN VALUES
40
3811eed8
DSH
41EVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0 for
42failure.
f7173262
DSH
43
44EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some
45other error occurred.
46
9b86974e 47The error codes can be obtained by L<ERR_get_error(3)>.
f7173262
DSH
48
49=head1 NOTES
50
51The B<EVP> interface to digital signatures should almost always be used in
52preference to the low level interfaces. This is because the code then becomes
53transparent to the algorithm used and much more flexible.
54
3811eed8
DSH
55The call to EVP_VerifyFinal() internally finalizes a copy of the digest context.
56This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called
57later to digest and verify additional data.
58
59Since only a copy of the digest context is ever finalized the context must
c12a2d27 60be cleaned up after use by calling EVP_MD_CTX_free() or a memory leak
3811eed8
DSH
61will occur.
62
f7173262
DSH
63=head1 BUGS
64
1bc74519 65Older versions of this documentation wrongly stated that calls to
3811eed8 66EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal().
f7173262 67
29cf84c6
DSH
68Since the public key is passed in the call to EVP_SignFinal() any error
69relating to the private key (for example an unsuitable key and digest
70combination) will not be indicated until after potentially large amounts of
71data have been passed through EVP_SignUpdate().
72
73It is not possible to change the signing parameters using these function.
74
3c9a8d4a 75The previous two bugs are fixed in the newer EVP_DigestVerify*() function.
29cf84c6 76
f7173262
DSH
77=head1 SEE ALSO
78
b97fdb57 79L<evp(7)>,
9b86974e 80L<EVP_SignInit(3)>,
73fb82b7 81L<EVP_DigestInit(3)>,
b97fdb57
RL
82L<evp(7)>, L<HMAC(3)>, L<MD2(3)>,
83L<MD5(3)>, L<MDC2(3)>, L<RIPEMD160(3)>,
1903a9b7 84L<SHA1(3)>, L<openssl-dgst(1)>
f7173262 85
e2f92610
RS
86=head1 COPYRIGHT
87
c4d3c19b 88Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 89
4746f25a 90Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
91this file except in compliance with the License. You can obtain a copy
92in the file LICENSE in the source distribution or at
93L<https://www.openssl.org/source/license.html>.
94
95=cut