Lines Matching defs:ecdh
2091 struct crypto_ecdh *ecdh = NULL;
2096 ecdh = os_zalloc(sizeof(*ecdh));
2097 if (!ecdh) {
2102 ecdh->rng = wc_rng_init();
2103 if (!ecdh->rng) {
2108 ecdh->ec = crypto_ec_init(group);
2109 if (!ecdh->ec) {
2115 ret = wc_ecc_set_rng(ecdh->ec->key, ecdh->rng);
2122 return ecdh;
2124 crypto_ecdh_deinit(ecdh);
2183 void crypto_ecdh_deinit(struct crypto_ecdh *ecdh)
2185 if (ecdh) {
2188 if (ecdh->ec && ecdh->ec->key &&
2189 ecdh->ec->key->rng == ecdh->rng)
2190 (void) wc_ecc_set_rng(ecdh->ec->key, NULL);
2192 crypto_ec_deinit(ecdh->ec);
2193 wc_rng_deinit(ecdh->rng);
2194 os_free(ecdh);
2199 struct wpabuf * crypto_ecdh_get_pubkey(struct crypto_ecdh *ecdh, int inc_y)
2203 int len = ecdh->ec->key->dp->size;
2210 ecdh->ec->key->pubkey.x, wpabuf_put(buf, len),
2216 ecdh->ec->key->pubkey.y,
2231 struct wpabuf * crypto_ecdh_set_peerkey(struct crypto_ecdh *ecdh, int inc_y,
2237 word32 key_len = ecdh->ec->key->dp->size;
2260 ecdh->ec->key->idx, point);
2272 ret = wc_ecc_shared_secret_ex(ecdh->ec->key, point,
2290 size_t crypto_ecdh_prime_len(struct crypto_ecdh *ecdh)
2292 return crypto_ec_prime_len(ecdh->ec);