xref: /freebsd/crypto/openssl/doc/man3/DSA_sign.pod (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
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
11The following functions have been deprecated since OpenSSL 3.0, and can be
12hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
13see L<openssl_user_macros(7)>:
14
15 int DSA_sign(int type, const unsigned char *dgst, int len,
16              unsigned char *sigret, unsigned int *siglen, DSA *dsa);
17
18 int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, BIGNUM **rp);
19
20 int DSA_verify(int type, const unsigned char *dgst, int len,
21                unsigned char *sigbuf, int siglen, DSA *dsa);
22
23=head1 DESCRIPTION
24
25All of the functions described on this page are deprecated.
26Applications should instead use L<EVP_PKEY_sign_init(3)>, L<EVP_PKEY_sign(3)>,
27L<EVP_PKEY_verify_init(3)> and L<EVP_PKEY_verify(3)>.
28
29DSA_sign() computes a digital signature on the B<len> byte message
30digest B<dgst> using the private key B<dsa> and places its ASN.1 DER
31encoding at B<sigret>. The length of the signature is places in
32*B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory.
33
34DSA_sign_setup() is defined only for backward binary compatibility and
35should not be used.
36Since OpenSSL 1.1.0 the DSA type is opaque and the output of
37DSA_sign_setup() cannot be used anyway: calling this function will only
38cause overhead, and does not affect the actual signature
39(pre-)computation.
40
41DSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
42matches a given message digest B<dgst> of size B<len>.
43B<dsa> is the signer's public key.
44
45The B<type> parameter is ignored.
46
47The random generator must be seeded when DSA_sign() (or DSA_sign_setup())
48is called.
49If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to
50external circumstances (see L<RAND(7)>), the operation will fail.
51
52=head1 RETURN VALUES
53
54DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
55DSA_verify() returns 1 for a valid signature, 0 for an incorrect
56signature and -1 on error. The error codes can be obtained by
57L<ERR_get_error(3)>.
58
59=head1 CONFORMING TO
60
61US Federal Information Processing Standard FIPS186-4 (Digital Signature
62Standard, DSS), ANSI X9.30
63
64=head1 SEE ALSO
65
66L<DSA_new(3)>, L<ERR_get_error(3)>, L<RAND_bytes(3)>,
67L<DSA_do_sign(3)>,
68L<RAND(7)>
69
70=head1 HISTORY
71
72All of these functions were deprecated in OpenSSL 3.0.
73
74=head1 COPYRIGHT
75
76Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
77
78Licensed under the Apache License 2.0 (the "License").  You may not use
79this file except in compliance with the License.  You can obtain a copy
80in the file LICENSE in the source distribution or at
81L<https://www.openssl.org/source/license.html>.
82
83=cut
84