DSA_SET_METHOD(3)
π DSA_SET_METHOD(3) π
okay so this is the DSA_SET_METHOD(3) page from the Library Functions Manual, and we are about to select a DSA method. bestie, it's giving crypto internals and honestly? kinda iconic. π
β¨ NAME β¨
DSA_set_default_method, DSA_get_default_method, DSA_set_method, DSA_new_method, DSA_OpenSSL β select DSA method. that's the whole name situation, periodt.
πΈ SYNOPSIS πΈ
library βlibcryptoβ #include <openssl/dsa.h>
void
DSA_set_default_method(const DSA_METHOD *meth);
const DSA_METHOD *
DSA_get_default_method(void);
int
DSA_set_method(DSA *dsa, const DSA_METHOD *meth);
DSA *
DSA_new_method(ENGINE *engine);
DSA_METHOD *
DSA_OpenSSL(void);
π¦ DESCRIPTION π¦
A DSA_METHOD object contains pointers to the functions used for DSA operations. By default, the internal implementation returned by DSA_OpenSSL() is used. By selecting another method, alternative implementations such as hardware accelerators may be used. so yes, you can swap the whole method vibe. π«
DSA_set_default_method()β selectsmethas the default method for allDSAstructures created later. future DSA structures get this method, no cap. β¨DSA_get_default_method()β returns a pointer to the current default method. that's it, that's the tea. π΅DSA_set_method()β selectsmethto perform all operations using the keydsa. This replaces theDSA_METHODused by the DSA key. It is possible to have DSA keys that only work with certainDSA_METHODimplementations, and in such cases attempting to change theDSA_METHODfor the key can have unexpected results. β οΈ bestie, this caveat is real β do not ignore it.DSA_new_method()β allocates and initializes aDSAstructure. Theengineargument is ignored and the default method controlled byDSA_set_default_method()is used. soengineis just sitting there, ignored, living its truth. π
The DSA_METHOD structure is defined as follows:
struct {
/* name of the implementation */
const char *name;
/* sign */
DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen,
DSA *dsa);
/* pre-compute k^-1 and r */
int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
BIGNUM **rp);
/* verify */
int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
DSA_SIG *sig, DSA *dsa);
/* called at DSA_new */
int (*init)(DSA *DSA);
/* called at DSA_free */
int (*finish)(DSA *DSA);
int flags;
} DSA_METHOD;
π RETURN VALUES π
DSA_OpenSSL()andDSA_get_default_method()return pointers to the respectiveDSA_METHOD. pointers to the method, exactly like it says. π«ΆDSA_set_method()returns1on success or0on failure. Currently, it cannot fail. so that failure path is lowkey just sitting there rn. πDSA_new_method()returnsNULLand sets an error code that can be obtained byERR_get_error(3)if the allocation fails. Otherwise it returns a pointer to the newly allocated structure. bestie, if it'sNULL, go check that error. π¨
π₯ SEE ALSO π₯
go read these next, bestie. iykyk. π
π HISTORY π
DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(), DSA_new_method(), and DSA_OpenSSL() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7. literally vintage. π
mwah π β this page was brought to you by Debian, dated June 8, 2025. stay slaying, and remember: the vibe changes, the facts do not. π
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2000, 2002, 2007 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms