Add OPENSSL_VERSION_AT_LEAST
[openssl.git] / doc / man3 / DSA_sign.pod
1 =pod
2
3 =head1 NAME
4
5 DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures
6
7 =head1 SYNOPSIS
8
9  #include <openssl/dsa.h>
10
11  int DSA_sign(int type, const unsigned char *dgst, int len,
12               unsigned char *sigret, unsigned int *siglen, DSA *dsa);
13
14  int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, BIGNUM **rp);
15
16  int DSA_verify(int type, const unsigned char *dgst, int len,
17                 unsigned char *sigbuf, int siglen, DSA *dsa);
18
19 =head1 DESCRIPTION
20
21 DSA_sign() computes a digital signature on the B<len> byte message
22 digest B<dgst> using the private key B<dsa> and places its ASN.1 DER
23 encoding at B<sigret>. The length of the signature is places in
24 *B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory.
25
26 DSA_sign_setup() may be used to precompute part of the signing
27 operation in case signature generation is time-critical. It expects
28 B<dsa> to contain DSA parameters. It places the precomputed values
29 in newly allocated B<BIGNUM>s at *B<kinvp> and *B<rp>, after freeing
30 the old ones unless *B<kinvp> and *B<rp> are NULL. These values may
31 be passed to DSA_sign() in B<dsa-E<gt>kinv> and B<dsa-E<gt>r>.
32 B<ctx> is a pre-allocated B<BN_CTX> or NULL.
33
34 DSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
35 matches a given message digest B<dgst> of size B<len>.
36 B<dsa> is the signer's public key.
37
38 The B<type> parameter is ignored.
39
40 The PRNG must be seeded before DSA_sign() (or DSA_sign_setup())
41 is called.
42
43 =head1 RETURN VALUES
44
45 DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
46 DSA_verify() returns 1 for a valid signature, 0 for an incorrect
47 signature and -1 on error. The error codes can be obtained by
48 L<ERR_get_error(3)>.
49
50 =head1 CONFORMING TO
51
52 US Federal Information Processing Standard FIPS 186 (Digital Signature
53 Standard, DSS), ANSI X9.30
54
55 =head1 SEE ALSO
56
57 L<DSA_new(3)>, L<ERR_get_error(3)>, L<RAND_bytes(3)>,
58 L<DSA_do_sign(3)>
59
60 =head1 COPYRIGHT
61
62 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
63
64 Licensed under the OpenSSL license (the "License").  You may not use
65 this file except in compliance with the License.  You can obtain a copy
66 in the file LICENSE in the source distribution or at
67 L<https://www.openssl.org/source/license.html>.
68
69 =cut