Document functions added as a result of DSA opacity changes
[openssl.git] / doc / crypto / DSA_meth_new.pod
1 =pod
2
3 =head1 NAME
4
5 DSA_meth_new, DSA_meth_free, DSA_meth_dup, DSA_meth_get_name, DSA_meth_set_name,
6 DSA_meth_get_flags, DSA_meth_set_flags, DSA_meth_get_app_data,
7 DSA_meth_set_app_data, DSA_meth_get_sign, DSA_meth_set_sign,
8 DSA_meth_get_sign_setup, DSA_meth_set_sign_setup, DSA_meth_get_verify,
9 DSA_meth_set_verify, DSA_meth_get_mod_exp, DSA_meth_set_mod_exp,
10 DSA_meth_get_bn_mod_exp, DSA_meth_set_bn_mod_exp, DSA_meth_get_init,
11 DSA_meth_set_init, DSA_meth_get_finish, DSA_meth_set_finish,
12 DSA_meth_get_paramgen, DSA_meth_set_paramgen, DSA_meth_get_keygen,
13 DSA_meth_set_keygen  - Routines to build up DSA methods
14
15 =head1 SYNOPSIS
16
17  #include <openssl/bio.h>
18
19  DSA_METHOD *DSA_meth_new(const char *name, int flags);
20  void DSA_meth_free(DSA_METHOD *dsam);
21  DSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth);
22  const char *DSA_meth_get_name(const DSA_METHOD *dsam);
23  int DSA_meth_set_name(DSA_METHOD *dsam, const char *name);
24  int DSA_meth_get_flags(DSA_METHOD *dsam);
25  int DSA_meth_set_flags(DSA_METHOD *dsam, int flags);
26  void *DSA_meth_get_app_data(const DSA_METHOD *dsam);
27  int DSA_meth_set_app_data(DSA_METHOD *dsam, void *app_data);
28  DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))
29          (const unsigned char *, int, DSA *);
30  int DSA_meth_set_sign(DSA_METHOD *dsam,
31                        DSA_SIG *(*sign) (const unsigned char *, int, DSA *));
32  int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))
33          (DSA *, BN_CTX *, BIGNUM **, BIGNUM **);
34  int DSA_meth_set_sign_setup(DSA_METHOD *dsam,
35          int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **));
36  int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
37          (const unsigned char *, int , DSA_SIG *, DSA *);
38  int DSA_meth_set_verify(DSA_METHOD *dsam,
39      int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *));
40  int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))
41         (DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, BIGNUM *a2, BIGNUM *p2,
42          BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
43  int DSA_meth_set_mod_exp(DSA_METHOD *dsam,
44      int (*mod_exp) (DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, BIGNUM *a2,
45                      BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *mont));
46  int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))
47      (DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
48       BN_CTX *ctx, BN_MONT_CTX *mont);
49  int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,
50      int (*bn_mod_exp) (DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
51                         const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *mont));
52  int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);
53  int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));
54  int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *);
55  int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *));
56  int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))
57          (DSA *, int, const unsigned char *, int, int *, unsigned long *,
58           BN_GENCB *);
59  int DSA_meth_set_paramgen(DSA_METHOD *dsam,
60          int (*paramgen) (DSA *, int, const unsigned char *, int, int *,
61                           unsigned long *, BN_GENCB *));
62  int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *);
63  int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *));
64
65 =head1 DESCRIPTION
66
67 The B<DSA_METHOD> type is a structure used for the provision of custom DSA
68 implementations. It provides a set of of functions used by OpenSSL for the
69 implementation of the various DSA capabilities. See the L<dsa> page for more
70 information.
71
72 DSA_meth_new() creates a new B<DSA_METHOD> structure. It should be given a
73 unique B<name> and a set of B<flags>. The B<name> should be a NULL terminated
74 string, which will be duplicated and stored in the B<DSA_METHOD> object. It is
75 the callers responsibility to free the original string. The flags will be used
76 during the construction of a new B<DSA> object based on this B<DSA_METHOD>. Any
77 new B<DSA> object will have those flags set by default.
78
79 DSA_meth_dup() creates a duplicate copy of the B<DSA_METHOD> object passed as a
80 parameter. This might be useful for creating a new B<DSA_METHOD> based on an
81 existing one, but with some differences.
82
83 DSA_meth_free() destroys a B<DSA_METHOD> structure and frees up any memory
84 associated with it.
85
86 DSA_meth_get_flags() returns the current value of the flags associated with this
87 DSA_METHOD. DSA_meth_set_flags() provides the ability to set these flags.
88
89 The functions DSA_meth_get_app_data() and DSA_meth_set_app_data() provide the
90 ability to associate implementation specific data with the DSA_METHOD. It is
91 the application's responsibility to free this data before the DSA_METHOD is
92 freed via a call to DSA_meth_free().
93
94 DSA_meth_get_sign() and DSA_meth_set_sign() get and set the function used for
95 creating a DSA signature respectively. This function will be
96 called in response to the application calling DSA_do_sign() (or DSA_sign()). The
97 parameters for the function have the same meaning as for DSA_do_sign().
98
99 DSA_meth_get_sign_setup() and DSA_meth_set_sign_setup() get and set the function
100 used for precalculating the DSA signature values B<k^-1> and B<r>. This function
101 will be called in response to the application calling DSA_sign_setup(). The
102 parameters for the function have the same meaning as for DSA_sign_setup().
103
104 DSA_meth_get_verify() and DSA_meth_set_verify() get and set the function used
105 for verifying a DSA signature respectively. This function will be called in
106 response to the application calling DSA_do_verify() (or DSA_verify()). The
107 parameters for the function have the same meaning as for DSA_do_verify().
108
109 DSA_meth_get_mod_exp() and DSA_meth_set_mod_exp() get and set the function used
110 for computing the following value:
111
112  rr = a1^p1 * a2^p2 mod m
113
114 This function will be called by the default OpenSSL method during verification
115 of a DSA signature. The result is stored in the B<rr> parameter. This function
116 may be NULL.
117
118 DSA_meth_get_bn_mod_exp() and DSA_meth_set_bn_mod_exp() get and set the function
119 used for computing the following value:
120
121  r = a ^ p mod m
122
123 This function will be called by the default OpenSSL function for
124 DSA_sign_setup(). The result is stored in the B<r> parameter. This function
125 may be NULL.
126
127 DSA_meth_get_init() and DSA_meth_set_init() get and set the function used
128 for creating a new DSA instance respectively. This function will be
129 called in response to the application calling DSA_new() (if the current default
130 DSA_METHOD is this one) or DSA_new_method(). The DSA_new() and DSA_new_method()
131 functions will allocate the memory for the new DSA object, and a pointer to this
132 newly allocated structure will be passed as a parameter to the function. This
133 function may be NULL.
134
135 DSA_meth_get_finish() and DSA_meth_set_finish() get and set the function used
136 for destroying an instance of a DSA object respectively. This function will be
137 called in response to the application calling DSA_free(). A pointer to the DSA
138 to be destroyed is passed as a parameter. The destroy function should be used
139 for DSA implementation specific clean up. The memory for the DSA itself should
140 not be freed by this function. This function may be NULL.
141
142 DSA_meth_get_paramgen() and DSA_meth_set_paramgen() get and set the function
143 used for generating DSA parameters respectively. This function will be called in
144 response to the application calling DSA_generate_parameters_ex() (or
145 DSA_generate_parameters()). The parameters for the function have the same
146 meaning as for DSA_generate_parameters_ex().
147
148 DSA_meth_get_keygen() and DSA_meth_set_keygen() get and set the function
149 used for generating a new DSA key pair respectively. This function will be
150 called in response to the application calling DSA_generate_key(). The parameter
151 for the function has the same meaning as for DSA_generate_key().
152
153 =head1 RETURN VALUES
154
155 DSA_meth_new() and DSA_meth_dup() return the newly allocated DSA_METHOD object
156 or NULL on failure.
157
158 DSA_meth_get_name() and DSA_meth_get_flags() return the name and flags
159 associated with the DSA_METHOD respectively.
160
161 All other DSA_meth_get_*() functions return the appropriate function pointer
162 that has been set in the DSA_METHOD, or NULL if no such pointer has yet been
163 set.
164
165 All DSA_meth_set_*() functions return 1 on success or 0 on failure.
166
167 =head1 SEE ALSO
168
169 L<dsa>, L<DSA_new>, L<DSA_generate_parameters>, L<DSA_generate_key>,
170 L<DSA_dup_DH>, L<DSA_do_sign>, L<DSA_set_method>, L<DSA_SIG_new>, L<DSA_sign>,
171 L<DSA_size>, L<DSA_get0_p>
172
173 =head1 HISTORY
174
175 The functions described here were added in OpenSSL version 1.1.0.
176
177 =cut