Lines Matching defs: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);
2415 pk11_DH_init(DH *dh)
2422 pk11_DH_finish(DH *dh)
2430 * Warning: Unlike OpenSSL's DH_generate_key(3) we ignore dh->priv_key
2431 * and override it even if it is set. OpenSSL does not touch dh->priv_key
2432 * if set and just computes dh->pub_key. It looks like PKCS#11 standard
2437 pk11_DH_generate_key(DH *dh)
2473 pub_key_template[1].ulValueLen = BN_num_bytes(dh->p);
2488 i = BN_bn2bin(dh->p, pub_key_template[1].pValue);
2493 pub_key_template[2].ulValueLen = BN_num_bytes(dh->g);
2503 i = BN_bn2bin(dh->g, pub_key_template[2].pValue);
2573 if (dh->pub_key == NULL) {
2574 if ((dh->pub_key = BN_new()) == NULL) {
2580 dh->pub_key = BN_bin2bn(pub_key_result[0].pValue,
2581 pub_key_result[0].ulValueLen, dh->pub_key);
2582 if (dh->pub_key == NULL) {
2601 if (dh->priv_key == NULL) {
2602 if ((dh->priv_key = BN_new()) == NULL) {
2608 dh->priv_key = BN_bin2bn(priv_key_result[0].pValue,
2609 priv_key_result[0].ulValueLen, dh->priv_key);
2610 if (dh->priv_key == NULL) {
2648 pk11_DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
2672 if (dh->priv_key == NULL) {
2691 (void) check_new_dh_key(sp, dh);
2696 pk11_get_dh_key((DH*) dh, &sp->opdata_dh,
2792 pk11_get_dh_key(DH* dh,
2818 key_template[4].ulValueLen = BN_num_bytes(dh->p);
2826 BN_bn2bin(dh->p, key_template[4].pValue);
2828 key_template[5].ulValueLen = BN_num_bytes(dh->g);
2836 BN_bn2bin(dh->g, key_template[5].pValue);
2838 key_template[6].ulValueLen = BN_num_bytes(dh->priv_key);
2846 BN_bn2bin(dh->priv_key, key_template[6].pValue);
2881 if ((*dh_priv_num = BN_dup(dh->priv_key)) == NULL) {
2891 *key_ptr = dh;
2927 check_new_dh_key(PK11_SESSION *sp, DH *dh)
2935 if ((sp->opdata_dh != dh) ||
2936 (BN_cmp(sp->opdata_dh_priv_num, dh->priv_key) != 0)) {