Lines Matching refs:pk
1561 struct ecc_point *pk; in ecc_make_pub_key() local
1569 pk = ecc_alloc_point(ndigits); in ecc_make_pub_key()
1570 if (!pk) { in ecc_make_pub_key()
1575 ecc_point_mult(pk, &curve->g, private_key, NULL, curve, ndigits); in ecc_make_pub_key()
1578 if (ecc_is_pubkey_valid_full(curve, pk)) { in ecc_make_pub_key()
1583 ecc_swap_digits(pk->x, public_key, ndigits); in ecc_make_pub_key()
1584 ecc_swap_digits(pk->y, &public_key[ndigits], ndigits); in ecc_make_pub_key()
1587 ecc_free_point(pk); in ecc_make_pub_key()
1595 struct ecc_point *pk) in ecc_is_pubkey_valid_partial() argument
1599 if (WARN_ON(pk->ndigits != curve->g.ndigits)) in ecc_is_pubkey_valid_partial()
1603 if (ecc_point_is_zero(pk)) in ecc_is_pubkey_valid_partial()
1607 if (vli_cmp(curve->p, pk->x, pk->ndigits) != 1) in ecc_is_pubkey_valid_partial()
1609 if (vli_cmp(curve->p, pk->y, pk->ndigits) != 1) in ecc_is_pubkey_valid_partial()
1613 vli_mod_square_fast(yy, pk->y, curve); /* y^2 */ in ecc_is_pubkey_valid_partial()
1614 vli_mod_square_fast(xxx, pk->x, curve); /* x^2 */ in ecc_is_pubkey_valid_partial()
1615 vli_mod_mult_fast(xxx, xxx, pk->x, curve); /* x^3 */ in ecc_is_pubkey_valid_partial()
1616 vli_mod_mult_fast(w, curve->a, pk->x, curve); /* a·x */ in ecc_is_pubkey_valid_partial()
1617 vli_mod_add(w, w, curve->b, curve->p, pk->ndigits); /* a·x + b */ in ecc_is_pubkey_valid_partial()
1618 vli_mod_add(w, w, xxx, curve->p, pk->ndigits); /* x^3 + a·x + b */ in ecc_is_pubkey_valid_partial()
1619 if (vli_cmp(yy, w, pk->ndigits) != 0) /* Equation */ in ecc_is_pubkey_valid_partial()
1628 struct ecc_point *pk) in ecc_is_pubkey_valid_full() argument
1633 int ret = ecc_is_pubkey_valid_partial(curve, pk); in ecc_is_pubkey_valid_full()
1639 nQ = ecc_alloc_point(pk->ndigits); in ecc_is_pubkey_valid_full()
1643 ecc_point_mult(nQ, pk, curve->n, NULL, curve, pk->ndigits); in ecc_is_pubkey_valid_full()
1658 struct ecc_point *product, *pk; in crypto_ecdh_shared_secret() local
1672 pk = ecc_alloc_point(ndigits); in crypto_ecdh_shared_secret()
1673 if (!pk) { in crypto_ecdh_shared_secret()
1678 ecc_swap_digits(public_key, pk->x, ndigits); in crypto_ecdh_shared_secret()
1679 ecc_swap_digits(&public_key[ndigits], pk->y, ndigits); in crypto_ecdh_shared_secret()
1680 ret = ecc_is_pubkey_valid_partial(curve, pk); in crypto_ecdh_shared_secret()
1690 ecc_point_mult(product, pk, private_key, rand_z, curve, ndigits); in crypto_ecdh_shared_secret()
1703 ecc_free_point(pk); in crypto_ecdh_shared_secret()