1 .\" $OpenBSD: EVP_VerifyInit.3,v 1.4 2016/11/26 20:55:26 schwarze Exp $
2 .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
4 .\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5 .\" Copyright (c) 2000, 2001, 2006, 2016 The OpenSSL Project.
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in
17 .\" the documentation and/or other materials provided with the
20 .\" 3. All advertising materials mentioning features or use of this
21 .\" software must display the following acknowledgment:
22 .\" "This product includes software developed by the OpenSSL Project
23 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\" endorse or promote products derived from this software without
27 .\" prior written permission. For written permission, please contact
28 .\" openssl-core@openssl.org.
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\" nor may "OpenSSL" appear in their names without prior written
32 .\" permission of the OpenSSL Project.
34 .\" 6. Redistributions of any form whatsoever must retain the following
36 .\" "This product includes software developed by the OpenSSL Project
37 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
52 .Dd $Mdocdate: November 26 2016 $
56 .Nm EVP_VerifyInit_ex ,
57 .Nm EVP_VerifyUpdate ,
60 .Nd EVP signature verification functions
66 .Fa "const EVP_MD *type"
73 .Fa "unsigned int cnt"
78 .Fa "unsigned char *sigbuf"
79 .Fa "unsigned int siglen"
85 .Fa "const EVP_MD *type"
88 The EVP signature verification routines are a high level interface to
92 sets up a verification context
100 must be initialized by calling
101 .Xr EVP_MD_CTX_init 3
102 before calling this function.
109 into the verification context
111 This function can be called several times on the same
113 to include additional data.
126 initializes a verification context
128 to use the default implementation of digest
131 The EVP interface to digital signatures should almost always be
132 used in preference to the low level interfaces.
133 This is because the code then becomes transparent to the algorithm used
134 and much more flexible.
136 Due to the link between message digests and public key algorithms, the
137 correct digest algorithm must be used with the correct public key type.
138 A list of algorithms and associated public key algorithms appears in
139 .Xr EVP_DigestInit 3 .
143 internally finalizes a copy of the digest context.
144 This means that calls to
148 can be called later to digest and verify additional data.
150 Since only a copy of the digest context is ever finalized, the context
151 must be cleaned up after use by calling
152 .Xr EVP_MD_CTX_cleanup 3 ,
153 or a memory leak will occur.
155 .Fn EVP_VerifyInit_ex
158 return 1 for success and 0 for failure.
161 returns 1 for a correct signature, 0 for failure, and -1 if some other
164 The error codes can be obtained by
165 .Xr ERR_get_error 3 .
169 .Xr EVP_DigestInit 3 ,
173 .Fn EVP_VerifyUpdate ,
176 are available in all versions of SSLeay and OpenSSL.
178 .Fn EVP_VerifyInit_ex
179 was added in OpenSSL 0.9.7.
181 Older versions of this documentation wrongly stated that calls to
183 could not be made after calling
184 .Fn EVP_VerifyFinal .
186 Since the public key is passed in the call to
187 .Xr EVP_SignFinal 3 ,
188 any error relating to the private key (for example an unsuitable key and
189 digest combination) will not be indicated until after potentially large
190 amounts of data have been passed through
191 .Xr EVP_SignUpdate 3 .
193 It is not possible to change the signing parameters using these
196 The previous two bugs are fixed in the newer functions of the
197 .Xr EVP_DigestVerifyInit 3