xref: /freebsd/crypto/openssl/doc/man3/DSA_sign.pod (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1=pod
2
3=head1 NAME
4
5DSA_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
21DSA_sign() computes a digital signature on the B<len> byte message
22digest B<dgst> using the private key B<dsa> and places its ASN.1 DER
23encoding 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
26DSA_sign_setup() is defined only for backward binary compatibility and
27should not be used.
28Since OpenSSL 1.1.0 the DSA type is opaque and the output of
29DSA_sign_setup() cannot be used anyway: calling this function will only
30cause overhead, and does not affect the actual signature
31(pre-)computation.
32
33DSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
34matches a given message digest B<dgst> of size B<len>.
35B<dsa> is the signer's public key.
36
37The B<type> parameter is ignored.
38
39The random generator must be seeded when DSA_sign() (or DSA_sign_setup())
40is called.
41If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to
42external circumstances (see L<RAND(7)>), the operation will fail.
43
44=head1 RETURN VALUES
45
46DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
47DSA_verify() returns 1 for a valid signature, 0 for an incorrect
48signature and -1 on error. The error codes can be obtained by
49L<ERR_get_error(3)>.
50
51=head1 CONFORMING TO
52
53US Federal Information Processing Standard FIPS 186 (Digital Signature
54Standard, DSS), ANSI X9.30
55
56=head1 SEE ALSO
57
58L<DSA_new(3)>, L<ERR_get_error(3)>, L<RAND_bytes(3)>,
59L<DSA_do_sign(3)>,
60L<RAND(7)>
61
62=head1 COPYRIGHT
63
64Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
65
66Licensed under the OpenSSL license (the "License").  You may not use
67this file except in compliance with the License.  You can obtain a copy
68in the file LICENSE in the source distribution or at
69L<https://www.openssl.org/source/license.html>.
70
71=cut
72