/linux-6.12.1/crypto/ |
D | ecc.c | 72 u64 *out, unsigned int ndigits) in ecc_digits_from_bytes() argument 74 int diff = ndigits - DIV_ROUND_UP(nbytes, sizeof(u64)); in ecc_digits_from_bytes() 80 ndigits -= diff; in ecc_digits_from_bytes() 81 memset(&out[ndigits], 0, diff * sizeof(u64)); in ecc_digits_from_bytes() 86 out[--ndigits] = be64_to_cpu(msd); in ecc_digits_from_bytes() 89 ecc_swap_digits(in, out, ndigits); in ecc_digits_from_bytes() 93 static u64 *ecc_alloc_digits_space(unsigned int ndigits) in ecc_alloc_digits_space() argument 95 size_t len = ndigits * sizeof(u64); in ecc_alloc_digits_space() 108 struct ecc_point *ecc_alloc_point(unsigned int ndigits) in ecc_alloc_point() argument 115 p->x = ecc_alloc_digits_space(ndigits); in ecc_alloc_point() [all …]
|
D | ecrdsa.c | 77 unsigned int ndigits = req->dst_len / sizeof(u64); in ecrdsa_verify() local 85 struct ecc_point cc = ECC_POINT_INIT(s, e, ndigits); /* reuse s, e */ in ecrdsa_verify() 97 req->dst_len != ctx->curve->g.ndigits * sizeof(u64) || in ecrdsa_verify() 98 ctx->pub_key.ndigits != ctx->curve->g.ndigits || in ecrdsa_verify() 111 vli_from_be64(s, sig, ndigits); in ecrdsa_verify() 112 vli_from_be64(r, sig + ndigits * sizeof(u64), ndigits); in ecrdsa_verify() 115 if (vli_is_zero(r, ndigits) || in ecrdsa_verify() 116 vli_cmp(r, ctx->curve->n, ndigits) >= 0 || in ecrdsa_verify() 117 vli_is_zero(s, ndigits) || in ecrdsa_verify() 118 vli_cmp(s, ctx->curve->n, ndigits) >= 0) in ecrdsa_verify() [all …]
|
D | ecdsa.c | 36 const void *value, size_t vlen, unsigned int ndigits) in ecdsa_get_signature_rs() argument 38 size_t bufsize = ndigits * sizeof(u64); in ecdsa_get_signature_rs() 63 ecc_digits_from_bytes(d, vlen, dest, ndigits); in ecdsa_get_signature_rs() 74 sig->curve->g.ndigits); in ecdsa_get_signature_r() 83 sig->curve->g.ndigits); in ecdsa_get_signature_s() 89 unsigned int ndigits = curve->g.ndigits; in _ecdsa_verify() local 95 struct ecc_point res = ECC_POINT_INIT(x1, y1, ndigits); in _ecdsa_verify() 98 if (vli_is_zero(r, ndigits) || vli_cmp(r, curve->n, ndigits) >= 0 || in _ecdsa_verify() 99 vli_is_zero(s, ndigits) || vli_cmp(s, curve->n, ndigits) >= 0) in _ecdsa_verify() 104 hash[ndigits - 1], hash[ndigits - 2], hash[0]); in _ecdsa_verify() [all …]
|
D | ecdh.c | 17 unsigned int ndigits; member 34 params.key_size > sizeof(u64) * ctx->ndigits) in ecdh_set_secret() 40 return ecc_gen_privkey(ctx->curve_id, ctx->ndigits, in ecdh_set_secret() 44 ctx->private_key, ctx->ndigits); in ecdh_set_secret() 46 if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, in ecdh_set_secret() 65 nbytes = ctx->ndigits << ECC_DIGITS_TO_BYTES_SHIFT; in ecdh_compute_value() 92 ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits, in ecdh_compute_value() 98 ret = ecc_make_pub_key(ctx->curve_id, ctx->ndigits, in ecdh_compute_value() 128 return ctx->ndigits << (ECC_DIGITS_TO_BYTES_SHIFT + 1); in ecdh_max_size() 136 ctx->ndigits = ECC_CURVE_NIST_P192_DIGITS; in ecdh_nist_p192_init_tfm() [all …]
|
D | ecc_curve_defs.h | 24 .ndigits = 3, 51 .ndigits = 4, 84 .ndigits = 6, 129 .ndigits = 9, 149 .ndigits = 4,
|
D | ecrdsa_defs.h | 54 .ndigits = 256 / 64, 88 .ndigits = 256 / 64, 126 .ndigits = 256 / 64, 176 .ndigits = 512 / 64, 222 .ndigits = 512 / 64,
|
/linux-6.12.1/include/crypto/internal/ |
D | ecc.h | 43 #define ECC_POINT_INIT(x, y, ndigits) (struct ecc_point) { x, y, ndigits } argument 51 static inline void ecc_swap_digits(const void *in, u64 *out, unsigned int ndigits) in ecc_swap_digits() argument 56 for (i = 0; i < ndigits; i++) in ecc_swap_digits() 57 out[i] = get_unaligned_be64(&src[ndigits - 1 - i]); in ecc_swap_digits() 71 u64 *out, unsigned int ndigits); 83 int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits, 98 int ecc_gen_privkey(unsigned int curve_id, unsigned int ndigits, 112 int ecc_make_pub_key(const unsigned int curve_id, unsigned int ndigits, 130 int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, 171 bool vli_is_zero(const u64 *vli, unsigned int ndigits); [all …]
|
/linux-6.12.1/drivers/crypto/intel/keembay/ |
D | keembay-ocs-ecc.c | 227 u32 op_size = (curve->g.ndigits > ECC_CURVE_NIST_P256_DIGITS) ? in kmb_ecc_point_mult() 229 size_t nbytes = digits_to_bytes(curve->g.ndigits); in kmb_ecc_point_mult() 308 unsigned int ndigits, const u32 inst) in kmb_ecc_do_scalar_op() argument 310 u32 op_size = (ndigits > ECC_CURVE_NIST_P256_DIGITS) ? in kmb_ecc_do_scalar_op() 312 size_t nbytes = digits_to_bytes(ndigits); in kmb_ecc_do_scalar_op() 342 if (vli_is_zero(scalar_out, ndigits)) in kmb_ecc_do_scalar_op() 358 if (WARN_ON(pk->ndigits != curve->g.ndigits)) in kmb_ocs_ecc_is_pubkey_valid_partial() 366 if (vli_cmp(curve->p, pk->x, pk->ndigits) != 1) in kmb_ocs_ecc_is_pubkey_valid_partial() 369 if (vli_cmp(curve->p, pk->y, pk->ndigits) != 1) in kmb_ocs_ecc_is_pubkey_valid_partial() 376 rc = kmb_ecc_do_scalar_op(ecc_dev, yy, pk->y, pk->y, curve, pk->ndigits, in kmb_ocs_ecc_is_pubkey_valid_partial() [all …]
|
/linux-6.12.1/net/bluetooth/ |
D | ecdh_helper.c | 28 static inline void swap_digits(u64 *in, u64 *out, unsigned int ndigits) in swap_digits() argument 32 for (i = 0; i < ndigits; i++) in swap_digits() 33 out[i] = __swab64(in[ndigits - 1 - i]); in swap_digits()
|
/linux-6.12.1/scripts/mod/ |
D | file2alias.c | 280 int ndigits; in do_usb_entry_multi() local 297 for (ndigits = 0 ; ndigits < sizeof(bcdDevice_lo) * 2 ; ndigits++) { in do_usb_entry_multi() 298 clo = (devlo >> (ndigits << 2)) & 0xf; in do_usb_entry_multi() 299 chi = ((devhi > 0x9999 ? 0x9999 : devhi) >> (ndigits << 2)) & 0xf; in do_usb_entry_multi() 314 for (ndigits = sizeof(bcdDevice_lo) * 2 - 1; devlo <= devhi; ndigits--) { in do_usb_entry_multi() 322 if (devlo == devhi || !ndigits) { in do_usb_entry_multi() 323 do_usb_entry(symval, devlo, ndigits, clo, chi, max, mod); in do_usb_entry_multi() 331 ndigits, clo, max, max, mod); in do_usb_entry_multi() 337 ndigits, 0x0, chi, max, mod); in do_usb_entry_multi()
|
/linux-6.12.1/include/crypto/ |
D | ecc_curve.h | 19 u8 ndigits; member
|
/linux-6.12.1/drivers/crypto/hisilicon/hpre/ |
D | hpre_crypto.c | 1261 static void fill_curve_param(void *addr, u64 *param, unsigned int cur_sz, u8 ndigits) in fill_curve_param() argument 1263 unsigned int sz = cur_sz - (ndigits - 1) * sizeof(u64); in fill_curve_param() 1266 while (i < ndigits - 1) { in fill_curve_param() 1271 memcpy(addr + sizeof(u64) * i, ¶m[ndigits - 1], sz); in fill_curve_param() 1295 fill_curve_param(p, curve->p, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1296 fill_curve_param(a, curve->a, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1297 fill_curve_param(b, curve->b, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1298 fill_curve_param(x, curve->g.x, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1299 fill_curve_param(y, curve->g.y, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1300 fill_curve_param(n, curve->n, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() [all …]
|