1DSA_METH_NEW(3) OpenSSL DSA_METH_NEW(3)
2
3
4
6 DSA_meth_new, DSA_meth_free, DSA_meth_dup, DSA_meth_get0_name,
7 DSA_meth_set1_name, DSA_meth_get_flags, DSA_meth_set_flags,
8 DSA_meth_get0_app_data, DSA_meth_set0_app_data, DSA_meth_get_sign,
9 DSA_meth_set_sign, DSA_meth_get_sign_setup, DSA_meth_set_sign_setup,
10 DSA_meth_get_verify, DSA_meth_set_verify, DSA_meth_get_mod_exp,
11 DSA_meth_set_mod_exp, DSA_meth_get_bn_mod_exp, DSA_meth_set_bn_mod_exp,
12 DSA_meth_get_init, DSA_meth_set_init, DSA_meth_get_finish,
13 DSA_meth_set_finish, DSA_meth_get_paramgen, DSA_meth_set_paramgen,
14 DSA_meth_get_keygen, DSA_meth_set_keygen - Routines to build up DSA
15 methods
16
18 #include <openssl/dsa.h>
19
20 DSA_METHOD *DSA_meth_new(const char *name, int flags);
21
22 void DSA_meth_free(DSA_METHOD *dsam);
23
24 DSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth);
25
26 const char *DSA_meth_get0_name(const DSA_METHOD *dsam);
27 int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name);
28
29 int DSA_meth_get_flags(const DSA_METHOD *dsam);
30 int DSA_meth_set_flags(DSA_METHOD *dsam, int flags);
31
32 void *DSA_meth_get0_app_data(const DSA_METHOD *dsam);
33 int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data);
34
35 DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))(const unsigned char *,
36 int, DSA *);
37 int DSA_meth_set_sign(DSA_METHOD *dsam, DSA_SIG *(*sign)(const unsigned char *,
38 int, DSA *));
39
40 int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))(DSA *, BN_CTX *,$
41 BIGNUM **, BIGNUM **);
42 int DSA_meth_set_sign_setup(DSA_METHOD *dsam, int (*sign_setup)(DSA *, BN_CTX *,
43 BIGNUM **, BIGNUM **));
44
45 int (*DSA_meth_get_verify(const DSA_METHOD *dsam))(const unsigned char *,
46 int, DSA_SIG *, DSA *);
47 int DSA_meth_set_verify(DSA_METHOD *dsam, int (*verify)(const unsigned char *,
48 int, DSA_SIG *, DSA *));
49
50 int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
51 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2,
52 BIGNUM *m, BN_CTX *ctx,
53 BN_MONT_CTX *in_mont);
54 int DSA_meth_set_mod_exp(DSA_METHOD *dsam, int (*mod_exp)(DSA *dsa, BIGNUM *rr,
55 BIGNUM *a1, BIGNUM *p1,
56 BIGNUM *a2, BIGNUM *p2,
57 BIGNUM *m, BN_CTX *ctx,
58 BN_MONT_CTX *mont));
59
60 int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *r, BIGNUM *a,
61 const BIGNUM *p, const BIGNUM *m,
62 BN_CTX *ctx, BN_MONT_CTX *mont);
63 int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, int (*bn_mod_exp)(DSA *dsa,
64 BIGNUM *r,
65 BIGNUM *a,
66 const BIGNUM *p,
67 const BIGNUM *m,
68 BN_CTX *ctx,
69 BN_MONT_CTX *mont));
70
71 int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);
72 int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));
73
74 int (*DSA_meth_get_finish(const DSA_METHOD *dsam))(DSA *);
75 int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish)(DSA *));
76
77 int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))(DSA *, int,
78 const unsigned char *,
79 int, int *, unsigned long *,
80 BN_GENCB *);
81 int DSA_meth_set_paramgen(DSA_METHOD *dsam,
82 int (*paramgen)(DSA *, int, const unsigned char *,
83 int, int *, unsigned long *, BN_GENCB *));
84
85 int (*DSA_meth_get_keygen(const DSA_METHOD *dsam))(DSA *);
86 int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen)(DSA *));
87
89 The DSA_METHOD type is a structure used for the provision of custom DSA
90 implementations. It provides a set of functions used by OpenSSL for the
91 implementation of the various DSA capabilities. See the dsa page for
92 more information.
93
94 DSA_meth_new() creates a new DSA_METHOD structure. It should be given a
95 unique name and a set of flags. The name should be a NULL terminated
96 string, which will be duplicated and stored in the DSA_METHOD object.
97 It is the callers responsibility to free the original string. The flags
98 will be used during the construction of a new DSA object based on this
99 DSA_METHOD. Any new DSA object will have those flags set by default.
100
101 DSA_meth_dup() creates a duplicate copy of the DSA_METHOD object passed
102 as a parameter. This might be useful for creating a new DSA_METHOD
103 based on an existing one, but with some differences.
104
105 DSA_meth_free() destroys a DSA_METHOD structure and frees up any memory
106 associated with it.
107
108 DSA_meth_get0_name() will return a pointer to the name of this
109 DSA_METHOD. This is a pointer to the internal name string and so should
110 not be freed by the caller. DSA_meth_set1_name() sets the name of the
111 DSA_METHOD to name. The string is duplicated and the copy is stored in
112 the DSA_METHOD structure, so the caller remains responsible for freeing
113 the memory associated with the name.
114
115 DSA_meth_get_flags() returns the current value of the flags associated
116 with this DSA_METHOD. DSA_meth_set_flags() provides the ability to set
117 these flags.
118
119 The functions DSA_meth_get0_app_data() and DSA_meth_set0_app_data()
120 provide the ability to associate implementation specific data with the
121 DSA_METHOD. It is the application's responsibility to free this data
122 before the DSA_METHOD is freed via a call to DSA_meth_free().
123
124 DSA_meth_get_sign() and DSA_meth_set_sign() get and set the function
125 used for creating a DSA signature respectively. This function will be
126 called in response to the application calling DSA_do_sign() (or
127 DSA_sign()). The parameters for the function have the same meaning as
128 for DSA_do_sign().
129
130 DSA_meth_get_sign_setup() and DSA_meth_set_sign_setup() get and set the
131 function used for precalculating the DSA signature values k^-1 and r.
132 This function will be called in response to the application calling
133 DSA_sign_setup(). The parameters for the function have the same meaning
134 as for DSA_sign_setup().
135
136 DSA_meth_get_verify() and DSA_meth_set_verify() get and set the
137 function used for verifying a DSA signature respectively. This function
138 will be called in response to the application calling DSA_do_verify()
139 (or DSA_verify()). The parameters for the function have the same
140 meaning as for DSA_do_verify().
141
142 DSA_meth_get_mod_exp() and DSA_meth_set_mod_exp() get and set the
143 function used for computing the following value:
144
145 rr = a1^p1 * a2^p2 mod m
146
147 This function will be called by the default OpenSSL method during
148 verification of a DSA signature. The result is stored in the rr
149 parameter. This function may be NULL.
150
151 DSA_meth_get_bn_mod_exp() and DSA_meth_set_bn_mod_exp() get and set the
152 function used for computing the following value:
153
154 r = a ^ p mod m
155
156 This function will be called by the default OpenSSL function for
157 DSA_sign_setup(). The result is stored in the r parameter. This
158 function may be NULL.
159
160 DSA_meth_get_init() and DSA_meth_set_init() get and set the function
161 used for creating a new DSA instance respectively. This function will
162 be called in response to the application calling DSA_new() (if the
163 current default DSA_METHOD is this one) or DSA_new_method(). The
164 DSA_new() and DSA_new_method() functions will allocate the memory for
165 the new DSA object, and a pointer to this newly allocated structure
166 will be passed as a parameter to the function. This function may be
167 NULL.
168
169 DSA_meth_get_finish() and DSA_meth_set_finish() get and set the
170 function used for destroying an instance of a DSA object respectively.
171 This function will be called in response to the application calling
172 DSA_free(). A pointer to the DSA to be destroyed is passed as a
173 parameter. The destroy function should be used for DSA implementation
174 specific clean up. The memory for the DSA itself should not be freed by
175 this function. This function may be NULL.
176
177 DSA_meth_get_paramgen() and DSA_meth_set_paramgen() get and set the
178 function used for generating DSA parameters respectively. This function
179 will be called in response to the application calling
180 DSA_generate_parameters_ex() (or DSA_generate_parameters()). The
181 parameters for the function have the same meaning as for
182 DSA_generate_parameters_ex().
183
184 DSA_meth_get_keygen() and DSA_meth_set_keygen() get and set the
185 function used for generating a new DSA key pair respectively. This
186 function will be called in response to the application calling
187 DSA_generate_key(). The parameter for the function has the same meaning
188 as for DSA_generate_key().
189
191 DSA_meth_new() and DSA_meth_dup() return the newly allocated DSA_METHOD
192 object or NULL on failure.
193
194 DSA_meth_get0_name() and DSA_meth_get_flags() return the name and flags
195 associated with the DSA_METHOD respectively.
196
197 All other DSA_meth_get_*() functions return the appropriate function
198 pointer that has been set in the DSA_METHOD, or NULL if no such pointer
199 has yet been set.
200
201 DSA_meth_set1_name() and all DSA_meth_set_*() functions return 1 on
202 success or 0 on failure.
203
205 DSA_new(3), DSA_new(3), DSA_generate_parameters(3),
206 DSA_generate_key(3), DSA_dup_DH(3), DSA_do_sign(3), DSA_set_method(3),
207 DSA_SIG_new(3), DSA_sign(3), DSA_size(3), DSA_get0_pqg(3)
208
210 The functions described here were added in OpenSSL 1.1.0.
211
213 Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
214
215 Licensed under the OpenSSL license (the "License"). You may not use
216 this file except in compliance with the License. You can obtain a copy
217 in the file LICENSE in the source distribution or at
218 <https://www.openssl.org/source/license.html>.
219
220
221
2221.1.1i 2021-07-22 DSA_METH_NEW(3)