summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EVP_DigestSignInit.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/EVP_DigestSignInit.3')
-rw-r--r--src/lib/libcrypto/man/EVP_DigestSignInit.3152
1 files changed, 152 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/EVP_DigestSignInit.3 b/src/lib/libcrypto/man/EVP_DigestSignInit.3
new file mode 100644
index 0000000000..89a2d7afbd
--- /dev/null
+++ b/src/lib/libcrypto/man/EVP_DigestSignInit.3
@@ -0,0 +1,152 @@
1.Dd $Mdocdate: November 3 2016 $
2.Dt EVP_DIGESTSIGNINIT 3
3.Os
4.Sh NAME
5.Nm EVP_DigestSignInit ,
6.Nm EVP_DigestSignUpdate ,
7.Nm EVP_DigestSignFinal
8.Nd EVP signing functions
9.Sh SYNOPSIS
10.In openssl/evp.h
11.Ft int
12.Fo EVP_DigestSignInit
13.Fa "EVP_MD_CTX *ctx"
14.Fa "EVP_PKEY_CTX **pctx"
15.Fa "const EVP_MD *type"
16.Fa "ENGINE *e"
17.Fa "EVP_PKEY *pkey"
18.Fc
19.Ft int
20.Fo EVP_DigestSignUpdate
21.Fa "EVP_MD_CTX *ctx"
22.Fa "const void *d"
23.Fa "unsigned int cnt"
24.Fc
25.Ft int
26.Fo EVP_DigestSignFinal
27.Fa "EVP_MD_CTX *ctx"
28.Fa "unsigned char *sig"
29.Fa "size_t *siglen"
30.Fc
31.Sh DESCRIPTION
32The EVP signature routines are a high level interface to digital
33signatures.
34.Pp
35.Fn EVP_DigestSignInit
36sets up the signing context
37.Fa ctx
38to use the digest
39.Fa type
40from
41.Vt ENGINE
42.Fa e
43and private key
44.Fa pkey .
45.Fa ctx
46must be initialized with
47.Xr EVP_MD_CTX_init 3
48before calling this function.
49If
50.Fa pctx
51is not
52.Dv NULL ,
53the
54.Vt EVP_PKEY_CTX
55of the signing operation will be written to
56.Pf * Fa pctx :
57this can be used to set alternative signing options.
58.Pp
59.Fn EVP_DigestSignUpdate
60hashes
61.Fa cnt
62bytes of data at
63.Fa d
64into the signature context
65.Fa ctx .
66This function can be called several times on the same
67.Fa ctx
68to include additional data.
69This function is currently implemented using a macro.
70.Pp
71.Fn EVP_DigestSignFinal
72signs the data in
73.Fa ctx
74and places the signature in
75.Fa sig .
76If
77.Fa sig
78is
79.Dv NULL ,
80then the maximum size of the output buffer is written to
81.Pf * Fa siglen .
82If
83.Fa sig
84is not
85.Dv NULL ,
86then before the call
87.Fa siglen
88should contain the length of the
89.Fa sig
90buffer.
91If the call is successful, the signature is written to
92.Fa sig
93and the amount of data written to
94.Fa siglen .
95.Pp
96The EVP interface to digital signatures should almost always be
97used in preference to the low level interfaces.
98This is because the code then becomes transparent to the algorithm used
99and much more flexible.
100.Pp
101In previous versions of OpenSSL, there was a link between message digest
102types and public key algorithms.
103This meant that "clone" digests such as
104.Xr EVP_dss1 3
105needed to be used to sign using SHA1 and DSA.
106This is no longer necessary and the use of clone digest is now
107discouraged.
108.Pp
109The call to
110.Fn EVP_DigestSignFinal
111internally finalizes a copy of the digest context.
112This means that
113.Fn EVP_DigestSignUpdate
114and
115.Fn EVP_DigestSignFinal
116can be called later to digest and sign additional data.
117.Pp
118Since only a copy of the digest context is ever finalized, the context
119must be cleaned up after use by calling
120.Xr EVP_MD_CTX_cleanup 3 ,
121or a memory leak will occur.
122.Pp
123The use of
124.Xr EVP_PKEY_size 3
125with these functions is discouraged because some signature operations
126may have a signature length which depends on the parameters set.
127As a result,
128.Xr EVP_PKEY_size 3
129would have to return a value which indicates the maximum possible
130signature for any set of parameters.
131.Sh RETURN VALUES
132.Fn EVP_DigestSignInit ,
133.Fn EVP_DigestSignUpdate ,
134and
135.Fn EVP_DigestSignFinal
136return 1 for success and 0 or a negative value for failure.
137In particular, a return value of -2 indicates the operation is not
138supported by the public key algorithm.
139.Pp
140The error codes can be obtained from
141.Xr ERR_get_error 3 .
142.Sh SEE ALSO
143.Xr ERR 3 ,
144.Xr evp 3 ,
145.Xr EVP_DigestInit 3 ,
146.Xr EVP_DigestVerifyInit 3
147.Sh HISTORY
148.Fn EVP_DigestSignInit ,
149.Fn EVP_DigestSignUpdate ,
150and
151.Fn EVP_DigestSignFinal
152were first added to OpenSSL 1.0.0.