Lines Matching refs:ndigits
232 u32 op_size = (curve->g.ndigits > ECC_CURVE_NIST_P256_DIGITS) ? in kmb_ecc_point_mult()
234 size_t nbytes = digits_to_bytes(curve->g.ndigits); in kmb_ecc_point_mult()
313 unsigned int ndigits, const u32 inst) in kmb_ecc_do_scalar_op() argument
315 u32 op_size = (ndigits > ECC_CURVE_NIST_P256_DIGITS) ? in kmb_ecc_do_scalar_op()
317 size_t nbytes = digits_to_bytes(ndigits); in kmb_ecc_do_scalar_op()
347 if (vli_is_zero(scalar_out, ndigits)) in kmb_ecc_do_scalar_op()
363 if (WARN_ON(pk->ndigits != curve->g.ndigits)) in kmb_ocs_ecc_is_pubkey_valid_partial()
371 if (vli_cmp(curve->p, pk->x, pk->ndigits) != 1) in kmb_ocs_ecc_is_pubkey_valid_partial()
374 if (vli_cmp(curve->p, pk->y, pk->ndigits) != 1) in kmb_ocs_ecc_is_pubkey_valid_partial()
381 rc = kmb_ecc_do_scalar_op(ecc_dev, yy, pk->y, pk->y, curve, pk->ndigits, in kmb_ocs_ecc_is_pubkey_valid_partial()
390 rc = kmb_ecc_do_scalar_op(ecc_dev, xxx, pk->x, w, curve, pk->ndigits, in kmb_ocs_ecc_is_pubkey_valid_partial()
397 pk->ndigits, in kmb_ocs_ecc_is_pubkey_valid_partial()
404 pk->ndigits, in kmb_ocs_ecc_is_pubkey_valid_partial()
410 rc = kmb_ecc_do_scalar_op(ecc_dev, w, xxx, w, curve, pk->ndigits, in kmb_ocs_ecc_is_pubkey_valid_partial()
416 rc = vli_cmp(yy, w, pk->ndigits); in kmb_ocs_ecc_is_pubkey_valid_partial()
442 nQ = ecc_alloc_point(pk->ndigits); in kmb_ocs_ecc_is_pubkey_valid_full()
462 size_t ndigits = curve->g.ndigits; in kmb_ecc_is_key_valid() local
466 if (private_key_len != digits_to_bytes(ndigits)) in kmb_ecc_is_key_valid()
473 if (vli_cmp(one, private_key, ndigits) != -1) in kmb_ecc_is_key_valid()
476 vli_sub(res, curve->n, one, ndigits); in kmb_ecc_is_key_valid()
477 vli_sub(res, res, one, ndigits); in kmb_ecc_is_key_valid()
478 if (vli_cmp(res, private_key, ndigits) != 1) in kmb_ecc_is_key_valid()
498 size_t nbytes = digits_to_bytes(curve->g.ndigits); in kmb_ecc_gen_privkey()
503 nbits = vli_num_bits(curve->n, curve->g.ndigits); in kmb_ecc_gen_privkey()
506 if (nbits < 160 || curve->g.ndigits > ARRAY_SIZE(priv)) in kmb_ecc_gen_privkey()
532 ecc_swap_digits(priv, privkey, curve->g.ndigits); in kmb_ecc_gen_privkey()
552 if (params.key_size > digits_to_bytes(tctx->curve->g.ndigits)) { in kmb_ocs_ecdh_set_secret()
569 tctx->curve->g.ndigits); in kmb_ocs_ecdh_set_secret()
591 nbytes = digits_to_bytes(curve->g.ndigits); in kmb_ecc_do_shared_secret()
604 pk = ecc_alloc_point(curve->g.ndigits); in kmb_ecc_do_shared_secret()
608 ecc_swap_digits(pubk_buf, pk->x, curve->g.ndigits); in kmb_ecc_do_shared_secret()
609 ecc_swap_digits(&pubk_buf[curve->g.ndigits], pk->y, curve->g.ndigits); in kmb_ecc_do_shared_secret()
622 result = ecc_alloc_point(pk->ndigits); in kmb_ecc_do_shared_secret()
639 ecc_swap_digits(result->x, shared_secret, result->ndigits); in kmb_ecc_do_shared_secret()
674 pubk_len = 2 * digits_to_bytes(curve->g.ndigits); in kmb_ecc_do_public_key()
676 pk = ecc_alloc_point(curve->g.ndigits); in kmb_ecc_do_public_key()
693 ecc_swap_digits(pk->x, pubk_buf, pk->ndigits); in kmb_ecc_do_public_key()
694 ecc_swap_digits(pk->y, &pubk_buf[pk->ndigits], pk->ndigits); in kmb_ecc_do_public_key()
742 if (req->dst_len < (2 * digits_to_bytes(curve->g.ndigits))) in kmb_ocs_ecdh_generate_public_key()
774 if (req->src_len != 2 * digits_to_bytes(curve->g.ndigits)) in kmb_ocs_ecdh_compute_shared_secret()
830 return digits_to_bytes(tctx->curve->g.ndigits) * 2; in kmb_ocs_ecdh_max_size()