DSA_GET0_PQG(3)

NAME
DSA_get0_pqg, DSA_get0_p, DSA_get0_q, DSA_get0_g, DSA_set0_pqg, DSA_get0_key, DSA_get0_pub_key, DSA_get0_priv_key, DSA_set0_key, DSA_clear_flags, DSA_test_flags, DSA_set_flags, DSA_get0_engine - get data from and set data in a DSA object

SYNOPSIS
#include <openssl/dsa.h>
void
DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
const BIGNUM *
DSA_get0_p(const DSA *d);
const BIGNUM *
DSA_get0_q(const DSA *d);
const BIGNUM *
DSA_get0_g(const DSA *d);
int
DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
void
DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key);
const BIGNUM *
DSA_get0_pub_key(const DSA *d);
const BIGNUM *
DSA_get0_priv_key(const DSA *d);
int
DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
void
DSA_clear_flags(DSA *d, int flags);
int
DSA_test_flags(const DSA *d, int flags);
void
DSA_set_flags(DSA *d, int flags);
ENGINE *
DSA_get0_engine(DSA *d);

DESCRIPTION
A DSA object contains the parameters p, q, and g. It also contains a public key pub_key and an optional private key priv_key.

The p, q, and g parameters can be obtained by calling DSA_get0_pqg(). If the parameters have not yet been set, then *p, *q, and *g are set to NULL. Otherwise, they are set to pointers to the internal representations of the values that should not be freed by the application.

The p, q, and g values can be set by calling DSA_set0_pqg(). Calling this function transfers the memory management of the values to d, and therefore they should not be freed by the caller.

The DSA_get0_key() function stores pointers to the internal representations of the public key in *pub_key and to the private key in *priv_key. Either may be NULL if it has not yet been set. If the private key has been set, then the public key must be.

The public and private key values can be set using DSA_set0_key(). The public key must be non-NULL the first time this function is called on a given DSA object. The private key may be NULL. On subsequent calls, either may be NULL, which means the corresponding DSA field is left untouched. DSA_set0_key() transfers the memory management of the key values to d, and therefore they should not be freed by the caller.

Values retrieved with DSA_get0_pqg() and DSA_get0_key() are owned by the DSA object and may therefore not be passed to DSA_set0_pqg() or DSA_set0_key(). If needed, duplicate the received values using BN_dup(3) and pass the duplicates.

Any of the values p, q, g, pub_key, and priv_key can also be retrieved separately by the corresponding functions DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_pub_key(), and DSA_get0_priv_key(), respectively. The pointers are owned by the DSA object.

DSA_clear_flags() clears the specified flags in d. DSA_test_flags() tests the flags in d. DSA_set_flags() sets the flags in d; any flags already set remain set. For all three functions, multiple flags can be passed in one call, OR'ed together bitwise.

RETURN VALUES
DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_pub_key(), and DSA_get0_priv_key() return a pointer owned by the DSA object if the corresponding value has been set, otherwise they return NULL. DSA_set0_pqg() and DSA_set0_key() return 1 on success or 0 on failure.

DSA_test_flags() returns those of the given flags currently set in d or 0 if none of the given flags are set.

DSA_get0_engine() returns a pointer to the ENGINE used by the DSA object Fa d , or NULL if no engine was set for this object.

SEE ALSO
DSA_do_sign(3), DSA_dup_DH(3), DSA_generate_key(3), DSA_generate_parameters(3), DSA_new(3), DSA_print(3), DSA_security_bits(3), DSA_sign(3), DSA_size(3)

HISTORY
DSA_get0_pqg(), DSA_set0_pqg(), DSA_get0_key(), DSA_set0_key(), DSA_clear_flags(), DSA_test_flags(), DSA_set_flags(), and DSA_get0_engine() first appeared in OpenSSL 1.1.0 and have been available since OpenBSD 6.3.

DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_pub_key(), and DSA_get0_priv_key() first appeared in OpenSSL 1.1.1 and have been available since OpenBSD 7.1.