summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EVP_VerifyInit.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/EVP_VerifyInit.3')
-rw-r--r--src/lib/libcrypto/man/EVP_VerifyInit.3146
1 files changed, 146 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/EVP_VerifyInit.3 b/src/lib/libcrypto/man/EVP_VerifyInit.3
new file mode 100644
index 0000000000..b1635d4cac
--- /dev/null
+++ b/src/lib/libcrypto/man/EVP_VerifyInit.3
@@ -0,0 +1,146 @@
1.Dd $Mdocdate: November 3 2016 $
2.Dt EVP_VERIFYINIT 3
3.Os
4.Sh NAME
5.Nm EVP_VerifyInit ,
6.Nm EVP_VerifyUpdate ,
7.Nm EVP_VerifyFinal
8.Nd EVP signature verification functions
9.Sh SYNOPSIS
10.In openssl/evp.h
11.Ft int
12.Fo EVP_VerifyInit_ex
13.Fa "EVP_MD_CTX *ctx"
14.Fa "const EVP_MD *type"
15.Fa "ENGINE *impl"
16.Fc
17.Ft int
18.Fo EVP_VerifyUpdate
19.Fa "EVP_MD_CTX *ctx"
20.Fa "const void *d"
21.Fa "unsigned int cnt"
22.Fc
23.Ft int
24.Fo EVP_VerifyFinal
25.Fa "EVP_MD_CTX *ctx"
26.Fa "unsigned char *sigbuf"
27.Fa "unsigned int siglen"
28.Fa "EVP_PKEY *pkey"
29.Fc
30.Ft int
31.Fo EVP_VerifyInit
32.Fa "EVP_MD_CTX *ctx"
33.Fa "const EVP_MD *type"
34.Fc
35.Sh DESCRIPTION
36The EVP signature verification routines are a high level interface to
37digital signatures.
38.Pp
39.Fn EVP_VerifyInit_ex
40sets up a verification context
41.Fa ctx
42to use the digest
43.Fa type
44from
45.Vt ENGINE
46.Fa impl .
47.Fa ctx
48must be initialized by calling
49.Xr EVP_MD_CTX_init 3
50before calling this function.
51.Pp
52.Fn EVP_VerifyUpdate
53hashes
54.Fa cnt
55bytes of data at
56.Fa d
57into the verification context
58.Fa ctx .
59This function can be called several times on the same
60.Fa ctx
61to include additional data.
62.Pp
63.Fn EVP_VerifyFinal
64verifies the data in
65.Fa ctx
66using the public key
67.Fa pkey
68and against the
69.Fa siglen
70bytes at
71.Fa sigbuf .
72.Pp
73.Fn EVP_VerifyInit
74initializes a verification context
75.Fa ctx
76to use the default implementation of digest
77.Fa type .
78.Pp
79The EVP interface to digital signatures should almost always be
80used in preference to the low level interfaces.
81This is because the code then becomes transparent to the algorithm used
82and much more flexible.
83.Pp
84Due to the link between message digests and public key algorithms, the
85correct digest algorithm must be used with the correct public key type.
86A list of algorithms and associated public key algorithms appears in
87.Xr EVP_DigestInit 3 .
88.Pp
89The call to
90.Fn EVP_VerifyFinal
91internally finalizes a copy of the digest context.
92This means that calls to
93.Fn EVP_VerifyUpdate
94and
95.Fn EVP_VerifyFinal
96can be called later to digest and verify additional data.
97.Pp
98Since only a copy of the digest context is ever finalized, the context
99must be cleaned up after use by calling
100.Xr EVP_MD_CTX_cleanup 3 ,
101or a memory leak will occur.
102.Sh RETURN VALUES
103.Fn EVP_VerifyInit_ex
104and
105.Fn EVP_VerifyUpdate
106return 1 for success and 0 for failure.
107.Pp
108.Fn EVP_VerifyFinal
109returns 1 for a correct signature, 0 for failure, and -1 if some other
110error occurred.
111.Pp
112The error codes can be obtained by
113.Xr ERR_get_error 3 .
114.Sh SEE ALSO
115.Xr ERR 3 ,
116.Xr evp 3 ,
117.Xr EVP_DigestInit 3 ,
118.Xr EVP_SignInit 3
119.Sh HISTORY
120.Fn EVP_VerifyInit ,
121.Fn EVP_VerifyUpdate ,
122and
123.Fn EVP_VerifyFinal
124are available in all versions of SSLeay and OpenSSL.
125.Pp
126.Fn EVP_VerifyInit_ex
127was added in OpenSSL 0.9.7.
128.Sh BUGS
129Older versions of this documentation wrongly stated that calls to
130.Fn EVP_VerifyUpdate
131could not be made after calling
132.Fn EVP_VerifyFinal .
133.Pp
134Since the public key is passed in the call to
135.Xr EVP_SignFinal 3 ,
136any error relating to the private key (for example an unsuitable key and
137digest combination) will not be indicated until after potentially large
138amounts of data have been passed through
139.Xr EVP_SignUpdate 3 .
140.Pp
141It is not possible to change the signing parameters using these
142functions.
143.Pp
144The previous two bugs are fixed in the newer functions of the
145.Xr EVP_DigestVerifyInit 3
146family.