1DSA_set_method(3)                   OpenSSL                  DSA_set_method(3)
2
3
4

NAME

6       DSA_set_default_method, DSA_get_default_method, DSA_set_method,
7       DSA_new_method, DSA_OpenSSL - select DSA method
8

SYNOPSIS

10        #include <openssl/dsa.h>
11        #include <openssl/engine.h>
12
13        void DSA_set_default_method(const DSA_METHOD *meth);
14
15        const DSA_METHOD *DSA_get_default_method(void);
16
17        int DSA_set_method(DSA *dsa, const DSA_METHOD *meth);
18
19        DSA *DSA_new_method(ENGINE *engine);
20
21        DSA_METHOD *DSA_OpenSSL(void);
22

DESCRIPTION

24       A DSA_METHOD specifies the functions that OpenSSL uses for DSA
25       operations. By modifying the method, alternative implementations such
26       as hardware accelerators may be used. IMPORTANT: See the NOTES section
27       for important information about how these DSA API functions are
28       affected by the use of ENGINE API calls.
29
30       Initially, the default DSA_METHOD is the OpenSSL internal
31       implementation, as returned by DSA_OpenSSL().
32
33       DSA_set_default_method() makes meth the default method for all DSA
34       structures created later. NB: This is true only whilst no ENGINE has
35       been set as a default for DSA, so this function is no longer
36       recommended.
37
38       DSA_get_default_method() returns a pointer to the current default
39       DSA_METHOD. However, the meaningfulness of this result is dependent on
40       whether the ENGINE API is being used, so this function is no longer
41       recommended.
42
43       DSA_set_method() selects meth to perform all operations using the key
44       rsa. This will replace the DSA_METHOD used by the DSA key and if the
45       previous method was supplied by an ENGINE, the handle to that ENGINE
46       will be released during the change. It is possible to have DSA keys
47       that only work with certain DSA_METHOD implementations (eg. from an
48       ENGINE module that supports embedded hardware-protected keys), and in
49       such cases attempting to change the DSA_METHOD for the key can have
50       unexpected results.
51
52       DSA_new_method() allocates and initializes a DSA structure so that
53       engine will be used for the DSA operations. If engine is NULL, the
54       default engine for DSA operations is used, and if no default ENGINE is
55       set, the DSA_METHOD controlled by DSA_set_default_method() is used.
56

THE DSA_METHOD STRUCTURE

58       struct
59        {
60            /* name of the implementation */
61               const char *name;
62
63            /* sign */
64               DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen,
65                                        DSA *dsa);
66
67            /* pre-compute k^-1 and r */
68               int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
69                                        BIGNUM **rp);
70
71            /* verify */
72               int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
73                                        DSA_SIG *sig, DSA *dsa);
74
75            /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some
76                                                 implementations) */
77               int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
78                                        BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
79                                        BN_CTX *ctx, BN_MONT_CTX *in_mont);
80
81            /* compute r = a ^ p mod m (May be NULL for some implementations) */
82               int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a,
83                                        const BIGNUM *p, const BIGNUM *m,
84                                        BN_CTX *ctx, BN_MONT_CTX *m_ctx);
85
86            /* called at DSA_new */
87               int (*init)(DSA *DSA);
88
89            /* called at DSA_free */
90               int (*finish)(DSA *DSA);
91
92               int flags;
93
94               char *app_data; /* ?? */
95
96        } DSA_METHOD;
97

RETURN VALUES

99       DSA_OpenSSL() and DSA_get_default_method() return pointers to the
100       respective DSA_METHODs.
101
102       DSA_set_default_method() returns no value.
103
104       DSA_set_method() returns non-zero if the provided meth was successfully
105       set as the method for dsa (including unloading the ENGINE handle if the
106       previous method was supplied by an ENGINE).
107
108       DSA_new_method() returns NULL and sets an error code that can be
109       obtained by ERR_get_error(3) if the allocation fails. Otherwise it
110       returns a pointer to the newly allocated structure.
111

NOTES

113       As of version 0.9.7, DSA_METHOD implementations are grouped together
114       with other algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in ENGINE
115       modules. If a default ENGINE is specified for DSA functionality using
116       an ENGINE API function, that will override any DSA defaults set using
117       the DSA API (ie.  DSA_set_default_method()). For this reason, the
118       ENGINE API is the recommended way to control default implementations
119       for use in DSA and other cryptographic algorithms.
120

SEE ALSO

122       dsa(3), DSA_new(3)
123

HISTORY

125       DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(),
126       DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4.
127
128       DSA_set_default_openssl_method() and DSA_get_default_openssl_method()
129       replaced DSA_set_default_method() and DSA_get_default_method()
130       respectively, and DSA_set_method() and DSA_new_method() were altered to
131       use ENGINEs rather than DSA_METHODs during development of the engine
132       version of OpenSSL 0.9.6. For 0.9.7, the handling of defaults in the
133       ENGINE API was restructured so that this change was reversed, and
134       behaviour of the other functions resembled more closely the previous
135       behaviour. The behaviour of defaults in the ENGINE API now
136       transparently overrides the behaviour of defaults in the DSA API
137       without requiring changing these function prototypes.
138
139
140
1411.0.1e                            2013-02-11                 DSA_set_method(3)
Impressum