Lines Matching refs:dh

89 #include <openssl/dh.h>
172 static int pk11_DH_init(DH *dh);
173 static int pk11_DH_finish(DH *dh);
174 static int pk11_DH_generate_key(DH *dh);
176 const BIGNUM *pub_key, DH *dh);
178 static CK_OBJECT_HANDLE pk11_get_dh_key(DH* dh, DH **key_ptr,
181 static int check_new_dh_key(PK11_SESSION *sp, DH *dh);
2563 static int pk11_DH_init(DH *dh)
2569 static int pk11_DH_finish(DH *dh)
2577 * Warning: Unlike OpenSSL's DH_generate_key(3) we ignore dh->priv_key
2578 * and override it even if it is set. OpenSSL does not touch dh->priv_key
2579 * if set and just computes dh->pub_key. It looks like PKCS#11 standard
2583 static int pk11_DH_generate_key(DH *dh)
2623 pub_key_template[1].ulValueLen = BN_num_bytes(dh->p);
2640 i = BN_bn2bin(dh->p, pub_key_template[1].pValue);
2645 pub_key_template[2].ulValueLen = BN_num_bytes(dh->g);
2657 i = BN_bn2bin(dh->g, pub_key_template[2].pValue);
2735 if (dh->pub_key == NULL)
2736 if ((dh->pub_key = BN_new()) == NULL)
2742 dh->pub_key = BN_bin2bn(pub_key_result[0].pValue,
2743 pub_key_result[0].ulValueLen, dh->pub_key);
2744 if (dh->pub_key == NULL)
2767 if (dh->priv_key == NULL)
2768 if ((dh->priv_key = BN_new()) == NULL)
2774 dh->priv_key = BN_bin2bn(priv_key_result[0].pValue,
2775 priv_key_result[0].ulValueLen, dh->priv_key);
2776 if (dh->priv_key == NULL)
2821 DH *dh)
2847 if (dh->priv_key == NULL)
2865 (void) check_new_dh_key(sp, dh);
2870 pk11_get_dh_key((DH*) dh, &sp->opdata_dh,
2978 static CK_OBJECT_HANDLE pk11_get_dh_key(DH* dh,
3004 key_template[4].ulValueLen = BN_num_bytes(dh->p);
3013 BN_bn2bin(dh->p, key_template[4].pValue);
3015 key_template[5].ulValueLen = BN_num_bytes(dh->g);
3024 BN_bn2bin(dh->g, key_template[5].pValue);
3026 key_template[6].ulValueLen = BN_num_bytes(dh->priv_key);
3035 BN_bn2bin(dh->priv_key, key_template[6].pValue);
3078 if ((*dh_priv_num = BN_dup(dh->priv_key)) == NULL)
3088 *key_ptr = dh;
3124 static int check_new_dh_key(PK11_SESSION *sp, DH *dh)
3132 if ((sp->opdata_dh != dh) ||
3133 (BN_cmp(sp->opdata_dh_priv_num, dh->priv_key) != 0))