Fix many doc L<> errors
[openssl.git] / doc / man3 / EVP_SignInit.pod
1 =pod
2
3 =head1 NAME
4
5 EVP_PKEY_size,
6 EVP_SignInit, EVP_SignInit_ex, EVP_SignUpdate, EVP_SignFinal - EVP signing
7 functions
8
9 =head1 SYNOPSIS
10
11  #include <openssl/evp.h>
12
13  int EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
14  int EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
15  int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sig, unsigned int *s, EVP_PKEY *pkey);
16
17  void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type);
18
19  int EVP_PKEY_size(EVP_PKEY *pkey);
20
21 =head1 DESCRIPTION
22
23 The EVP signature routines are a high level interface to digital
24 signatures.
25
26 EVP_SignInit_ex() sets up signing context B<ctx> to use digest
27 B<type> from ENGINE B<impl>. B<ctx> must be created with
28 EVP_MD_CTX_new() before calling this function.
29
30 EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the
31 signature context B<ctx>. This function can be called several times on the
32 same B<ctx> to include additional data.
33
34 EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> and
35 places the signature in B<sig>. B<sig> must be at least EVP_PKEY_size(pkey)
36 bytes in size. B<s> is an OUT parameter, and not used as an IN parameter.
37 The number of bytes of data written (i.e. the length of the signature)
38 will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes
39 will be written.
40
41 EVP_SignInit() initializes a signing context B<ctx> to use the default
42 implementation of digest B<type>.
43
44 EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual
45 signature returned by EVP_SignFinal() may be smaller.
46
47 =head1 RETURN VALUES
48
49 EVP_SignInit_ex(), EVP_SignUpdate() and EVP_SignFinal() return 1
50 for success and 0 for failure.
51
52 EVP_PKEY_size() returns the maximum size of a signature in bytes.
53
54 The error codes can be obtained by L<ERR_get_error(3)>.
55
56 =head1 NOTES
57
58 The B<EVP> interface to digital signatures should almost always be used in
59 preference to the low level interfaces. This is because the code then becomes
60 transparent to the algorithm used and much more flexible.
61
62 Due to the link between message digests and public key algorithms the correct
63 digest algorithm must be used with the correct public key type. A list of
64 algorithms and associated public key algorithms appears in
65 L<EVP_DigestInit(3)>.
66
67 When signing with DSA private keys the random number generator must be seeded
68 or the operation will fail. The random number generator does not need to be
69 seeded for RSA signatures.
70
71 The call to EVP_SignFinal() internally finalizes a copy of the digest context.
72 This means that calls to EVP_SignUpdate() and EVP_SignFinal() can be called
73 later to digest and sign additional data.
74
75 Since only a copy of the digest context is ever finalized the context must
76 be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak
77 will occur.
78
79 =head1 BUGS
80
81 Older versions of this documentation wrongly stated that calls to
82 EVP_SignUpdate() could not be made after calling EVP_SignFinal().
83
84 Since the private key is passed in the call to EVP_SignFinal() any error
85 relating to the private key (for example an unsuitable key and digest
86 combination) will not be indicated until after potentially large amounts of
87 data have been passed through EVP_SignUpdate().
88
89 It is not possible to change the signing parameters using these function.
90
91 The previous two bugs are fixed in the newer EVP_SignDigest*() function.
92
93 =head1 SEE ALSO
94
95 L<EVP_VerifyInit(3)>,
96 L<EVP_DigestInit(3)>,
97 L<evp(7)>, L<HMAC(3)>, L<MD2(3)>,
98 L<MD5(3)>, L<MDC2(3)>, L<RIPEMD160(3)>,
99 L<SHA1(3)>, L<dgst(1)>
100
101 =head1 COPYRIGHT
102
103 Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
104
105 Licensed under the OpenSSL license (the "License").  You may not use
106 this file except in compliance with the License.  You can obtain a copy
107 in the file LICENSE in the source distribution or at
108 L<https://www.openssl.org/source/license.html>.
109
110 =cut