Lines Matching refs:dh
26 #include "crypto/dh.h"
32 int DH_set_method(DH *dh, const DH_METHOD *meth)
39 mtmp = dh->meth;
41 mtmp->finish(dh);
43 ENGINE_finish(dh->engine);
44 dh->engine = NULL;
46 dh->meth = meth;
48 meth->init(dh);
52 const DH_METHOD *ossl_dh_get_method(const DH *dh)
54 return dh->meth;
190 int DH_bits(const DH *dh)
192 if (dh->params.p != NULL)
193 return BN_num_bits(dh->params.p);
197 int DH_size(const DH *dh)
199 if (dh->params.p != NULL)
200 return BN_num_bytes(dh->params.p);
204 int DH_security_bits(const DH *dh)
208 if (dh->params.q != NULL)
209 N = BN_num_bits(dh->params.q);
210 else if (dh->length)
211 N = dh->length;
214 if (dh->params.p != NULL)
215 return BN_security_bits(BN_num_bits(dh->params.p), N);
219 void DH_get0_pqg(const DH *dh,
222 ossl_ffc_params_get0_pqg(&dh->params, p, q, g);
225 int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
228 * If the fields p and g in dh are NULL, the corresponding input
231 if ((dh->params.p == NULL && p == NULL)
232 || (dh->params.g == NULL && g == NULL))
235 ossl_ffc_params_set0_pqg(&dh->params, p, q, g);
236 ossl_dh_cache_named_group(dh);
237 dh->dirty_cnt++;
241 long DH_get_length(const DH *dh)
243 return dh->length;
246 int DH_set_length(DH *dh, long length)
248 dh->length = length;
249 dh->dirty_cnt++;
253 void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
256 *pub_key = dh->pub_key;
258 *priv_key = dh->priv_key;
261 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
264 BN_clear_free(dh->pub_key);
265 dh->pub_key = pub_key;
268 BN_clear_free(dh->priv_key);
269 dh->priv_key = priv_key;
272 dh->dirty_cnt++;
276 const BIGNUM *DH_get0_p(const DH *dh)
278 return dh->params.p;
281 const BIGNUM *DH_get0_q(const DH *dh)
283 return dh->params.q;
286 const BIGNUM *DH_get0_g(const DH *dh)
288 return dh->params.g;
291 const BIGNUM *DH_get0_priv_key(const DH *dh)
293 return dh->priv_key;
296 const BIGNUM *DH_get0_pub_key(const DH *dh)
298 return dh->pub_key;
301 void DH_clear_flags(DH *dh, int flags)
303 dh->flags &= ~flags;
306 int DH_test_flags(const DH *dh, int flags)
308 return dh->flags & flags;
311 void DH_set_flags(DH *dh, int flags)
313 dh->flags |= flags;
317 ENGINE *DH_get0_engine(DH *dh)
319 return dh->engine;
323 FFC_PARAMS *ossl_dh_get0_params(DH *dh)
325 return &dh->params;
327 int ossl_dh_get0_nid(const DH *dh)
329 return dh->params.nid;