Lines Matching refs:dh
605 DH *dh; in dh5_init() local
612 dh = DH_new(); in dh5_init()
613 if (dh == NULL) in dh5_init()
616 dh->g = BN_new(); in dh5_init()
617 if (dh->g == NULL || BN_set_word(dh->g, 2) != 1) in dh5_init()
620 dh->p = get_group5_prime(); in dh5_init()
621 if (dh->p == NULL) in dh5_init()
624 if (DH_generate_key(dh) != 1) in dh5_init()
627 publen = BN_num_bytes(dh->pub_key); in dh5_init()
631 privlen = BN_num_bytes(dh->priv_key); in dh5_init()
636 BN_bn2bin(dh->pub_key, wpabuf_put(pubkey, publen)); in dh5_init()
637 BN_bn2bin(dh->priv_key, wpabuf_put(privkey, privlen)); in dh5_init()
641 return dh; in dh5_init()
646 DH_free(dh); in dh5_init()
653 DH *dh; in dh5_init_fixed() local
655 dh = DH_new(); in dh5_init_fixed()
656 if (dh == NULL) in dh5_init_fixed()
659 dh->g = BN_new(); in dh5_init_fixed()
660 if (dh->g == NULL || BN_set_word(dh->g, 2) != 1) in dh5_init_fixed()
663 dh->p = get_group5_prime(); in dh5_init_fixed()
664 if (dh->p == NULL) in dh5_init_fixed()
667 dh->priv_key = BN_bin2bn(wpabuf_head(priv), wpabuf_len(priv), NULL); in dh5_init_fixed()
668 if (dh->priv_key == NULL) in dh5_init_fixed()
671 dh->pub_key = BN_bin2bn(wpabuf_head(publ), wpabuf_len(publ), NULL); in dh5_init_fixed()
672 if (dh->pub_key == NULL) in dh5_init_fixed()
675 if (DH_generate_key(dh) != 1) in dh5_init_fixed()
678 return dh; in dh5_init_fixed()
681 DH_free(dh); in dh5_init_fixed()
692 DH *dh = ctx; in dh5_derive_shared() local
703 rlen = DH_size(dh); in dh5_derive_shared()
708 keylen = DH_compute_key(wpabuf_mhead(res), pub_key, dh); in dh5_derive_shared()
725 DH *dh; in dh5_free() local
728 dh = ctx; in dh5_free()
729 DH_free(dh); in dh5_free()