159191Skris=pod
259191Skris
359191Skris=head1 NAME
459191Skris
559191SkrisDSA_sign, DSA_sign_setup, DSA_verify - DSA signatures
659191Skris
759191Skris=head1 SYNOPSIS
859191Skris
959191Skris #include <openssl/dsa.h>
1059191Skris
1159191Skris int	DSA_sign(int type, const unsigned char *dgst, int len,
1259191Skris		unsigned char *sigret, unsigned int *siglen, DSA *dsa);
1359191Skris
1459191Skris int	DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp,
1559191Skris                BIGNUM **rp);
1659191Skris
1759191Skris int	DSA_verify(int type, const unsigned char *dgst, int len,
1859191Skris		unsigned char *sigbuf, int siglen, DSA *dsa);
1959191Skris
2059191Skris=head1 DESCRIPTION
2159191Skris
2259191SkrisDSA_sign() computes a digital signature on the B<len> byte message
2359191Skrisdigest B<dgst> using the private key B<dsa> and places its ASN.1 DER
2459191Skrisencoding at B<sigret>. The length of the signature is places in
2559191Skris*B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory.
2659191Skris
2759191SkrisDSA_sign_setup() may be used to precompute part of the signing
2859191Skrisoperation in case signature generation is time-critical. It expects
2959191SkrisB<dsa> to contain DSA parameters. It places the precomputed values
3059191Skrisin newly allocated B<BIGNUM>s at *B<kinvp> and *B<rp>, after freeing
3159191Skristhe old ones unless *B<kinvp> and *B<rp> are NULL. These values may
3259191Skrisbe passed to DSA_sign() in B<dsa-E<gt>kinv> and B<dsa-E<gt>r>.
3359191SkrisB<ctx> is a pre-allocated B<BN_CTX> or NULL.
3459191Skris
3559191SkrisDSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
3659191Skrismatches a given message digest B<dgst> of size B<len>.
3759191SkrisB<dsa> is the signer's public key.
3859191Skris
3959191SkrisThe B<type> parameter is ignored.
4059191Skris
4159191SkrisThe PRNG must be seeded before DSA_sign() (or DSA_sign_setup())
4259191Skrisis called.
4359191Skris
4459191Skris=head1 RETURN VALUES
4559191Skris
4659191SkrisDSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
4759191SkrisDSA_verify() returns 1 for a valid signature, 0 for an incorrect
4859191Skrissignature and -1 on error. The error codes can be obtained by
4959191SkrisL<ERR_get_error(3)|ERR_get_error(3)>.
5059191Skris
5159191Skris=head1 CONFORMING TO
5259191Skris
5359191SkrisUS Federal Information Processing Standard FIPS 186 (Digital Signature
5459191SkrisStandard, DSS), ANSI X9.30
5559191Skris
5659191Skris=head1 SEE ALSO
5759191Skris
58109998SmarkmL<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>,
5959191SkrisL<DSA_do_sign(3)|DSA_do_sign(3)>
6059191Skris
6159191Skris=head1 HISTORY
6259191Skris
6359191SkrisDSA_sign() and DSA_verify() are available in all versions of SSLeay.
6459191SkrisDSA_sign_setup() was added in SSLeay 0.8.
6559191Skris
6659191Skris=cut
67