Lines Matching refs:dh

518     ctx->dh = NULL;
535 if (req_cryptoctx->dh != NULL)
536 DH_free(req_cryptoctx->dh);
2347 if (cryptoctx->dh == NULL) {
2348 if ((cryptoctx->dh = DH_new()) == NULL)
2350 if ((cryptoctx->dh->g = BN_new()) == NULL ||
2351 (cryptoctx->dh->q = BN_new()) == NULL)
2357 cryptoctx->dh->p = get_rfc2409_prime_1024(NULL);
2361 cryptoctx->dh->p = BN_bin2bn(pkinit_2048_dhprime,
2366 cryptoctx->dh->p = BN_bin2bn(pkinit_4096_dhprime,
2373 BN_set_word((cryptoctx->dh->g), DH_GENERATOR_2);
2374 BN_rshift1(cryptoctx->dh->q, cryptoctx->dh->p);
2377 DH_generate_key(cryptoctx->dh);
2380 DH_check(cryptoctx->dh, &dh_err);
2394 print_dh(cryptoctx->dh, "client's DH params\n");
2395 print_pubkey(cryptoctx->dh->pub_key, "client's pub_key=");
2398 DH_check_pub_key(cryptoctx->dh, cryptoctx->dh->pub_key, &dh_err);
2408 retval = pkinit_encode_dh_params(cryptoctx->dh->p, cryptoctx->dh->g,
2409 cryptoctx->dh->q, dh_params, dh_params_len);
2419 if ((pub_key = BN_to_ASN1_INTEGER(cryptoctx->dh->pub_key, NULL)) == NULL)
2436 if (cryptoctx->dh != NULL)
2437 DH_free(cryptoctx->dh);
2438 cryptoctx->dh = NULL;
2480 *client_key_len = DH_size(cryptoctx->dh);
2492 DH_compute_key(*client_key, server_pub_key, cryptoctx->dh);
2530 DH *dh = NULL;
2536 dh = DH_new();
2537 dh = pkinit_decode_dh_params(&dh, &tmp, dh_params->length);
2538 if (dh == NULL) {
2544 dh_prime_bits = BN_num_bits(dh->p);
2546 pkiDebug("client sent dh params with %d bits, we require %d\n",
2553 dh->p, dh->g, dh->q) == 0) {
2560 dh->p, dh->g, dh->q) == 0) {
2567 dh->p, dh->g, dh->q) == 0) {
2574 req_cryptoctx->dh = dh;
2576 DH_free(dh);
2581 /* kdc's dh function */
2597 DH *dh = NULL, *dh_server = NULL;
2602 dh = cryptoctx->dh;
2607 dh_server->p = BN_dup(dh->p);
2608 dh_server->g = BN_dup(dh->g);
2609 dh_server->q = BN_dup(dh->q);
2616 dh->pub_key = ASN1_INTEGER_to_BN(pub_key, NULL);
2617 if (dh->pub_key == NULL)
2628 DH_compute_key(*server_key, dh->pub_key, dh_server);
2632 print_pubkey(dh->pub_key, "client's pub_key=");
3201 pkiDebug("dh parameters\n");
3204 DH *dh = NULL;
3213 dh = DH_new();
3214 dh = pkinit_decode_dh_params(&dh, &tmp, algId[i]->parameters.length);
3216 if (dh == NULL)
3218 dh_prime_bits = BN_num_bits(dh->p);
3223 if (pkinit_check_dh_params(cryptoctx->dh_1024->p, dh->p,
3224 dh->g, dh->q) == 0) {
3230 if (pkinit_check_dh_params(cryptoctx->dh_2048->p, dh->p,
3231 dh->g, dh->q) == 0) {
3237 if (pkinit_check_dh_params(cryptoctx->dh_4096->p, dh->p,
3238 dh->g, dh->q) == 0) {
3247 DH_check(dh, &retval);
3258 DH_free(dh);
3260 if (req_cryptoctx->dh != NULL) {
3261 DH_free(req_cryptoctx->dh);
3262 req_cryptoctx->dh = NULL;
3265 req_cryptoctx->dh = dh;
6865 print_dh(DH * dh, char *msg)
6874 if (dh)
6875 DHparams_print(bio_err, dh);
6877 BN_print(bio_err, dh->q);