2 * Licensed under the OpenSSL licenses, (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
5 * https://www.openssl.org/source/license.html
6 * or in the file LICENSE in the source distribution.
12 DSA_METHOD *DSA_meth_new(const char *name, int flags)
14 DSA_METHOD *dsam = OPENSSL_zalloc(sizeof(DSA_METHOD));
17 dsam->name = OPENSSL_strdup(name);
24 void DSA_meth_free(DSA_METHOD *dsam)
27 if (dsam->name != NULL)
28 OPENSSL_free(dsam->name);
33 DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam)
37 ret = OPENSSL_malloc(sizeof(DSA_METHOD));
40 memcpy(ret, dsam, sizeof(*dsam));
41 ret->name = OPENSSL_strdup(dsam->name);
47 const char *DSA_meth_get0_name(const DSA_METHOD *dsam)
52 int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name)
54 OPENSSL_free(dsam->name);
55 dsam->name = OPENSSL_strdup(name);
57 return dsam->name != NULL;
60 int DSA_meth_get_flags(DSA_METHOD *dsam)
65 int DSA_meth_set_flags(DSA_METHOD *dsam, int flags)
71 void *DSA_meth_get_app_data(const DSA_METHOD *dsam)
73 return dsam->app_data;
76 int DSA_meth_set_app_data(DSA_METHOD *dsam, void *app_data)
78 dsam->app_data = app_data;
82 DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))
83 (const unsigned char *, int, DSA *)
85 return dsam->dsa_do_sign;
88 int DSA_meth_set_sign(DSA_METHOD *dsam,
89 DSA_SIG *(*sign) (const unsigned char *, int, DSA *))
91 dsam->dsa_do_sign = sign;
95 int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))
96 (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)
98 return dsam->dsa_sign_setup;
101 int DSA_meth_set_sign_setup(DSA_METHOD *dsam,
102 int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **))
104 dsam->dsa_sign_setup = sign_setup;
108 int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
109 (const unsigned char *, int , DSA_SIG *, DSA *)
111 return dsam->dsa_do_verify;
114 int DSA_meth_set_verify(DSA_METHOD *dsam,
115 int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *))
117 dsam->dsa_do_verify = verify;
121 int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))
122 (DSA *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *,
123 BN_CTX *, BN_MONT_CTX *)
125 return dsam->dsa_mod_exp;
128 int DSA_meth_set_mod_exp(DSA_METHOD *dsam,
129 int (*mod_exp) (DSA *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *,
130 BIGNUM *, BN_CTX *, BN_MONT_CTX *))
132 dsam->dsa_mod_exp = mod_exp;
136 int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))
137 (DSA *, BIGNUM *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,
140 return dsam->bn_mod_exp;
143 int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,
144 int (*bn_mod_exp) (DSA *, BIGNUM *, BIGNUM *, const BIGNUM *,
145 const BIGNUM *, BN_CTX *, BN_MONT_CTX *))
147 dsam->bn_mod_exp = bn_mod_exp;
151 int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *)
156 int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *))
162 int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *)
167 int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *))
169 dsam->finish = finish;
173 int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))
174 (DSA *, int, const unsigned char *, int, int *, unsigned long *,
177 return dsam->dsa_paramgen;
180 int DSA_meth_set_paramgen(DSA_METHOD *dsam,
181 int (*paramgen) (DSA *, int, const unsigned char *, int, int *,
182 unsigned long *, BN_GENCB *))
184 dsam->dsa_paramgen = paramgen;
188 int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *)
190 return dsam->dsa_keygen;
193 int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *))
195 dsam->dsa_keygen = keygen;