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