Lines Matching refs:pk

1512 	struct ecc_point *pk;  in ecc_make_pub_key()  local
1523 pk = ecc_alloc_point(ndigits); in ecc_make_pub_key()
1524 if (!pk) { in ecc_make_pub_key()
1529 ecc_point_mult(pk, &curve->g, priv, NULL, curve, ndigits); in ecc_make_pub_key()
1532 if (ecc_is_pubkey_valid_full(curve, pk)) { in ecc_make_pub_key()
1537 ecc_swap_digits(pk->x, public_key, ndigits); in ecc_make_pub_key()
1538 ecc_swap_digits(pk->y, &public_key[ndigits], ndigits); in ecc_make_pub_key()
1541 ecc_free_point(pk); in ecc_make_pub_key()
1549 struct ecc_point *pk) in ecc_is_pubkey_valid_partial() argument
1553 if (WARN_ON(pk->ndigits != curve->g.ndigits)) in ecc_is_pubkey_valid_partial()
1557 if (ecc_point_is_zero(pk)) in ecc_is_pubkey_valid_partial()
1561 if (vli_cmp(curve->p, pk->x, pk->ndigits) != 1) in ecc_is_pubkey_valid_partial()
1563 if (vli_cmp(curve->p, pk->y, pk->ndigits) != 1) in ecc_is_pubkey_valid_partial()
1567 vli_mod_square_fast(yy, pk->y, curve); /* y^2 */ in ecc_is_pubkey_valid_partial()
1568 vli_mod_square_fast(xxx, pk->x, curve); /* x^2 */ in ecc_is_pubkey_valid_partial()
1569 vli_mod_mult_fast(xxx, xxx, pk->x, curve); /* x^3 */ in ecc_is_pubkey_valid_partial()
1570 vli_mod_mult_fast(w, curve->a, pk->x, curve); /* a·x */ in ecc_is_pubkey_valid_partial()
1571 vli_mod_add(w, w, curve->b, curve->p, pk->ndigits); /* a·x + b */ in ecc_is_pubkey_valid_partial()
1572 vli_mod_add(w, w, xxx, curve->p, pk->ndigits); /* x^3 + a·x + b */ in ecc_is_pubkey_valid_partial()
1573 if (vli_cmp(yy, w, pk->ndigits) != 0) /* Equation */ in ecc_is_pubkey_valid_partial()
1582 struct ecc_point *pk) in ecc_is_pubkey_valid_full() argument
1587 int ret = ecc_is_pubkey_valid_partial(curve, pk); in ecc_is_pubkey_valid_full()
1593 nQ = ecc_alloc_point(pk->ndigits); in ecc_is_pubkey_valid_full()
1597 ecc_point_mult(nQ, pk, curve->n, NULL, curve, pk->ndigits); in ecc_is_pubkey_valid_full()
1612 struct ecc_point *product, *pk; in crypto_ecdh_shared_secret() local
1628 pk = ecc_alloc_point(ndigits); in crypto_ecdh_shared_secret()
1629 if (!pk) { in crypto_ecdh_shared_secret()
1634 ecc_swap_digits(public_key, pk->x, ndigits); in crypto_ecdh_shared_secret()
1635 ecc_swap_digits(&public_key[ndigits], pk->y, ndigits); in crypto_ecdh_shared_secret()
1636 ret = ecc_is_pubkey_valid_partial(curve, pk); in crypto_ecdh_shared_secret()
1648 ecc_point_mult(product, pk, priv, rand_z, curve, ndigits); in crypto_ecdh_shared_secret()
1662 ecc_free_point(pk); in crypto_ecdh_shared_secret()