Blame doc/man3/DSA_get0_pqg.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
DSA_get0_pqg, DSA_set0_pqg, DSA_get0_key, DSA_set0_key,
Packit c4476c
DSA_get0_p, DSA_get0_q, DSA_get0_g,
Packit c4476c
DSA_get0_pub_key, DSA_get0_priv_key,
Packit c4476c
DSA_clear_flags, DSA_test_flags, DSA_set_flags,
Packit c4476c
DSA_get0_engine - Routines for getting and
Packit c4476c
setting data in a DSA object
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/dsa.h>
Packit c4476c
Packit c4476c
 void DSA_get0_pqg(const DSA *d,
Packit c4476c
                   const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
Packit c4476c
 int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
Packit c4476c
 void DSA_get0_key(const DSA *d,
Packit c4476c
                   const BIGNUM **pub_key, const BIGNUM **priv_key);
Packit c4476c
 int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
Packit c4476c
 const BIGNUM *DSA_get0_p(const DSA *d);
Packit c4476c
 const BIGNUM *DSA_get0_q(const DSA *d);
Packit c4476c
 const BIGNUM *DSA_get0_g(const DSA *d);
Packit c4476c
 const BIGNUM *DSA_get0_pub_key(const DSA *d);
Packit c4476c
 const BIGNUM *DSA_get0_priv_key(const DSA *d);
Packit c4476c
 void DSA_clear_flags(DSA *d, int flags);
Packit c4476c
 int DSA_test_flags(const DSA *d, int flags);
Packit c4476c
 void DSA_set_flags(DSA *d, int flags);
Packit c4476c
 ENGINE *DSA_get0_engine(DSA *d);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
A DSA object contains the parameters B

, B<q> and B<g>. It also contains a

Packit c4476c
public key (B<pub_key>) and (optionally) a private key (B<priv_key>).
Packit c4476c
Packit c4476c
The B

, B<q> and B<g> parameters can be obtained by calling DSA_get0_pqg().

Packit c4476c
If the parameters have not yet been set then B<*p>, B<*q> and B<*g> will be set
Packit c4476c
to NULL. Otherwise they are set to pointers to their respective values. These
Packit c4476c
point directly to the internal representations of the values and therefore
Packit c4476c
should not be freed directly.
Packit c4476c
Packit c4476c
The B

, B<q> and B<g> values can be set by calling DSA_set0_pqg() and passing

Packit c4476c
the new values for B

, B<q> and B<g> as parameters to the function. Calling

Packit c4476c
this function transfers the memory management of the values to the DSA object,
Packit c4476c
and therefore the values that have been passed in should not be freed directly
Packit c4476c
after this function has been called.
Packit c4476c
Packit c4476c
To get the public and private key values use the DSA_get0_key() function. A
Packit c4476c
pointer to the public key will be stored in B<*pub_key>, and a pointer to the
Packit c4476c
private key will be stored in B<*priv_key>. Either may be NULL if they have not
Packit c4476c
been set yet, although if the private key has been set then the public key must
Packit c4476c
be. The values point to the internal representation of the public key and
Packit c4476c
private key values. This memory should not be freed directly.
Packit c4476c
Packit c4476c
The public and private key values can be set using DSA_set0_key(). The public
Packit c4476c
key must be non-NULL the first time this function is called on a given DSA
Packit c4476c
object. The private key may be NULL.  On subsequent calls, either may be NULL,
Packit c4476c
which means the corresponding DSA field is left untouched. As for DSA_set0_pqg()
Packit c4476c
this function transfers the memory management of the key values to the DSA
Packit c4476c
object, and therefore they should not be freed directly after this function has
Packit c4476c
been called.
Packit c4476c
Packit c4476c
Any of the values B

, B<q>, B<g>, B<priv_key>, and B<pub_key> can also be

Packit c4476c
retrieved separately by the corresponding function DSA_get0_p(), DSA_get0_q(),
Packit c4476c
DSA_get0_g(), DSA_get0_priv_key(), and DSA_get0_pub_key(), respectively.
Packit c4476c
Packit c4476c
DSA_set_flags() sets the flags in the B<flags> parameter on the DSA object.
Packit c4476c
Multiple flags can be passed in one go (bitwise ORed together). Any flags that
Packit c4476c
are already set are left set. DSA_test_flags() tests to see whether the flags
Packit c4476c
passed in the B<flags> parameter are currently set in the DSA object. Multiple
Packit c4476c
flags can be tested in one go. All flags that are currently set are returned, or
Packit c4476c
zero if none of the flags are set. DSA_clear_flags() clears the specified flags
Packit c4476c
within the DSA object.
Packit c4476c
Packit c4476c
DSA_get0_engine() returns a handle to the ENGINE that has been set for this DSA
Packit c4476c
object, or NULL if no such ENGINE has been set.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
Values retrieved with DSA_get0_key() are owned by the DSA object used
Packit c4476c
in the call and may therefore I<not> be passed to DSA_set0_key().  If
Packit c4476c
needed, duplicate the received value using BN_dup() and pass the
Packit c4476c
duplicate.  The same applies to DSA_get0_pqg() and DSA_set0_pqg().
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
DSA_set0_pqg() and DSA_set0_key() return 1 on success or 0 on failure.
Packit c4476c
Packit c4476c
DSA_test_flags() returns the current state of the flags in the DSA object.
Packit c4476c
Packit c4476c
DSA_get0_engine() returns the ENGINE set for the DSA object or NULL if no ENGINE
Packit c4476c
has been set.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<DSA_new(3)>, L<DSA_new(3)>, L<DSA_generate_parameters(3)>, L<DSA_generate_key(3)>,
Packit c4476c
L<DSA_dup_DH(3)>, L<DSA_do_sign(3)>, L<DSA_set_method(3)>, L<DSA_SIG_new(3)>,
Packit c4476c
L<DSA_sign(3)>, L<DSA_size(3)>, L<DSA_meth_new(3)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The functions described here were added in OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut