DSA_METH_NEW(3)

NAME
DSA_meth_new, DSA_meth_free, DSA_meth_dup, DSA_meth_get0_name, DSA_meth_set1_name, DSA_meth_set_sign, DSA_meth_set_finish - build up DSA methods

SYNOPSIS
libcrypto
#include <openssl/dsa.h>
DSA_METHOD *
DSA_meth_new(const char *name, int flags);
void
DSA_meth_free(DSA_METHOD *meth);
DSA_METHOD *
DSA_meth_dup(const DSA_METHOD *meth);
const char *
DSA_meth_get0_name(const DSA_METHOD *meth);
int
DSA_meth_set1_name(DSA_METHOD *meth, const char *name);
int
DSA_meth_set_sign(DSA_METHOD *meth, DSA_SIG *(*sign)(const unsigned char *, int, DSA *));
int
DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *));

DESCRIPTION
The DSA_METHOD structure holds function pointers for custom DSA implementations.

DSA_meth_new() creates a new DSA_METHOD structure. A copy of the NUL-terminated name is stored in the new DSA_METHOD object. Any new DSA object constructed from this DSA_METHOD will have the given flags set by default.

DSA_meth_dup() creates a deep copy of meth. This might be useful for creating a new DSA_METHOD based on an existing one, but with some differences.

DSA_meth_free() destroys meth and frees any memory associated with it.

DSA_meth_get0_name() returns an internal pointer to the name of meth. DSA_meth_set1_name() stores a copy of the NUL-terminated name in meth after freeing the previously stored name. Method names are ignored by the default DSA implementation but can be used by alternative implementations and by the application program.

DSA_meth_set_sign() sets the function used for creating a DSA signature. This function will be called from DSA_do_sign(3) and indirectly from DSA_sign(3). The parameters of sign have the same meaning as for DSA_do_sign(3).

DSA_meth_set_finish() sets an optional function for destroying a DSA object. Unless finish is NULL, it will be called from DSA_free(3). It takes the same argument and is intended to do DSA implementation specific cleanup. The memory used by the DSA object itself should not be freed by the finish function.

RETURN VALUES
DSA_meth_new() and DSA_meth_dup() return the newly allocated DSA_METHOD object or NULL on failure.

DSA_meth_get0_name() returns an internal pointer which must not be freed by the caller.

DSA_meth_set1_name() and all DSA_meth_set_*() functions return 1 on success or 0 on failure. In the current implementation, only DSA_meth_set1_name() can actually fail.

SEE ALSO
DSA_do_sign(3), DSA_new(3), DSA_set_method(3), DSA_SIG_new(3), DSA_sign(3)

HISTORY
These functions first appeared in OpenSSL 1.1.0.

DSA_meth_new(), DSA_meth_free(), DSA_meth_dup(), DSA_meth_set_sign(), and DSA_meth_set_finish() have been available since OpenBSD 6.3.

DSA_meth_get0_name() and DSA_meth_set1_name() have been available since OpenBSD 7.2.