summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/doc/EVP_SignInit.pod
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/doc/EVP_SignInit.pod')
-rw-r--r--src/lib/libcrypto/doc/EVP_SignInit.pod39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod
index d5ce245ecd..b1ac129430 100644
--- a/src/lib/libcrypto/doc/EVP_SignInit.pod
+++ b/src/lib/libcrypto/doc/EVP_SignInit.pod
@@ -8,10 +8,12 @@ EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions
8 8
9 #include <openssl/evp.h> 9 #include <openssl/evp.h>
10 10
11 void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type); 11 int EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
12 void EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); 12 int EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
13 int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey); 13 int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey);
14 14
15 void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type);
16
15 int EVP_PKEY_size(EVP_PKEY *pkey); 17 int EVP_PKEY_size(EVP_PKEY *pkey);
16 18
17=head1 DESCRIPTION 19=head1 DESCRIPTION
@@ -19,9 +21,9 @@ EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions
19The EVP signature routines are a high level interface to digital 21The EVP signature routines are a high level interface to digital
20signatures. 22signatures.
21 23
22EVP_SignInit() initializes a signing context B<ctx> to using digest 24EVP_SignInit_ex() sets up signing context B<ctx> to use digest
23B<type>: this will typically be supplied by a function such as 25B<type> from ENGINE B<impl>. B<ctx> must be initialized with
24EVP_sha1(). 26EVP_MD_CTX_init() before calling this function.
25 27
26EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the 28EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the
27signature context B<ctx>. This function can be called several times on the 29signature context B<ctx>. This function can be called several times on the
@@ -31,18 +33,18 @@ EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey>
31and places the signature in B<sig>. If the B<s> parameter is not NULL 33and places the signature in B<sig>. If the B<s> parameter is not NULL
32then the number of bytes of data written (i.e. the length of the signature) 34then the number of bytes of data written (i.e. the length of the signature)
33will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes 35will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes
34will be written. After calling EVP_SignFinal() no additional calls to 36will be written.
35EVP_SignUpdate() can be made, but EVP_SignInit() can be called to initialize 37
36a new signature operation. 38EVP_SignInit() initializes a signing context B<ctx> to use the default
39implementation of digest B<type>.
37 40
38EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual 41EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual
39signature returned by EVP_SignFinal() may be smaller. 42signature returned by EVP_SignFinal() may be smaller.
40 43
41=head1 RETURN VALUES 44=head1 RETURN VALUES
42 45
43EVP_SignInit() and EVP_SignUpdate() do not return values. 46EVP_SignInit_ex(), EVP_SignUpdate() and EVP_SignFinal() return 1
44 47for success and 0 for failure.
45EVP_SignFinal() returns 1 for success and 0 for failure.
46 48
47EVP_PKEY_size() returns the maximum size of a signature in bytes. 49EVP_PKEY_size() returns the maximum size of a signature in bytes.
48 50
@@ -63,11 +65,18 @@ When signing with DSA private keys the random number generator must be seeded
63or the operation will fail. The random number generator does not need to be 65or the operation will fail. The random number generator does not need to be
64seeded for RSA signatures. 66seeded for RSA signatures.
65 67
68The call to EVP_SignFinal() internally finalizes a copy of the digest context.
69This means that calls to EVP_SignUpdate() and EVP_SignFinal() can be called
70later to digest and sign additional data.
71
72Since only a copy of the digest context is ever finalized the context must
73be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak
74will occur.
75
66=head1 BUGS 76=head1 BUGS
67 77
68Several of the functions do not return values: maybe they should. Although the 78Older versions of this documentation wrongly stated that calls to
69internal digest operations will never fail some future hardware based operations 79EVP_SignUpdate() could not be made after calling EVP_SignFinal().
70might.
71 80
72=head1 SEE ALSO 81=head1 SEE ALSO
73 82
@@ -82,4 +91,6 @@ L<SHA1(3)|SHA1(3)>, L<digest(1)|digest(1)>
82EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are 91EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are
83available in all versions of SSLeay and OpenSSL. 92available in all versions of SSLeay and OpenSSL.
84 93
94EVP_SignInit_ex() was added in OpenSSL 0.9.7
95
85=cut 96=cut