/kernel/linux/linux-5.10/crypto/ |
H A D | ecc.c | 61 static u64 *ecc_alloc_digits_space(unsigned int ndigits) in ecc_alloc_digits_space() argument 63 size_t len = ndigits * sizeof(u64); in ecc_alloc_digits_space() 76 static struct ecc_point *ecc_alloc_point(unsigned int ndigits) in ecc_alloc_point() argument 83 p->x = ecc_alloc_digits_space(ndigits); in ecc_alloc_point() 87 p->y = ecc_alloc_digits_space(ndigits); in ecc_alloc_point() 91 p->ndigits = ndigits; in ecc_alloc_point() 112 static void vli_clear(u64 *vli, unsigned int ndigits) in vli_clear() argument 116 for (i = 0; i < ndigits; i++) in vli_clear() 121 bool vli_is_zero(const u64 *vli, unsigned int ndigits) in vli_is_zero() argument 140 vli_is_negative(const u64 *vli, unsigned int ndigits) vli_is_negative() argument 146 vli_num_digits(const u64 *vli, unsigned int ndigits) vli_num_digits() argument 160 vli_num_bits(const u64 *vli, unsigned int ndigits) vli_num_bits() argument 177 vli_from_be64(u64 *dest, const void *src, unsigned int ndigits) vli_from_be64() argument 187 vli_from_le64(u64 *dest, const void *src, unsigned int ndigits) vli_from_le64() argument 198 vli_set(u64 *dest, const u64 *src, unsigned int ndigits) vli_set() argument 207 vli_cmp(const u64 *left, const u64 *right, unsigned int ndigits) vli_cmp() argument 225 vli_lshift(u64 *result, const u64 *in, unsigned int shift, unsigned int ndigits) vli_lshift() argument 242 vli_rshift1(u64 *vli, unsigned int ndigits) vli_rshift1() argument 257 vli_add(u64 *result, const u64 *left, const u64 *right, unsigned int ndigits) vli_add() argument 277 vli_uadd(u64 *result, const u64 *left, u64 right, unsigned int ndigits) vli_uadd() argument 299 vli_sub(u64 *result, const u64 *left, const u64 *right, unsigned int ndigits) vli_sub() argument 320 vli_usub(u64 *result, const u64 *left, u64 right, unsigned int ndigits) vli_usub() argument 380 vli_mult(u64 *result, const u64 *left, const u64 *right, unsigned int ndigits) vli_mult() argument 417 vli_umult(u64 *result, const u64 *left, u32 right, unsigned int ndigits) vli_umult() argument 438 vli_square(u64 *result, const u64 *left, unsigned int ndigits) vli_square() argument 480 vli_mod_add(u64 *result, const u64 *left, const u64 *right, const u64 *mod, unsigned int ndigits) vli_mod_add() argument 497 vli_mod_sub(u64 *result, const u64 *left, const u64 *right, const u64 *mod, unsigned int ndigits) vli_mod_sub() argument 519 vli_mmod_special(u64 *result, const u64 *product, const u64 *mod, unsigned int ndigits) vli_mmod_special() argument 553 vli_mmod_special2(u64 *result, const u64 *product, const u64 *mod, unsigned int ndigits) vli_mmod_special2() argument 602 vli_mmod_slow(u64 *result, u64 *product, const u64 *mod, unsigned int ndigits) vli_mmod_slow() argument 652 vli_mmod_barrett(u64 *result, u64 *product, const u64 *mod, unsigned int ndigits) vli_mmod_barrett() argument 681 const unsigned int ndigits = 3; vli_mmod_fast_192() local 709 const unsigned int ndigits = 4; vli_mmod_fast_256() local 792 const unsigned int ndigits = 6; vli_mmod_fast_384() local 904 const unsigned int ndigits = curve->g.ndigits; vli_mmod_fast() local 944 vli_mod_mult_slow(u64 *result, const u64 *left, const u64 *right, const u64 *mod, unsigned int ndigits) vli_mod_mult_slow() argument 979 vli_mod_inv(u64 *result, const u64 *input, const u64 *mod, unsigned int ndigits) vli_mod_inv() argument 1075 const unsigned int ndigits = curve->g.ndigits; ecc_point_double_jacobian() local 1148 const unsigned int ndigits = curve->g.ndigits; xycz_initial_double() local 1176 const unsigned int ndigits = curve->g.ndigits; xycz_add() local 1221 const unsigned int ndigits = curve->g.ndigits; xycz_add_c() local 1268 ecc_point_mult(struct ecc_point *result, const struct ecc_point *point, const u64 *scalar, u64 *initial_z, const struct ecc_curve *curve, unsigned int ndigits) ecc_point_mult() argument 1335 unsigned int ndigits = curve->g.ndigits; ecc_point_add() local 1359 unsigned int ndigits = curve->g.ndigits; ecc_point_mult_shamir() local 1405 __ecc_is_key_valid(const struct ecc_curve *curve, const u64 *private_key, unsigned int ndigits) __ecc_is_key_valid() argument 1428 ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits, const u64 *private_key, unsigned int private_key_len) ecc_is_key_valid() argument 1455 ecc_gen_privkey(unsigned int curve_id, unsigned int ndigits, u64 *privkey) ecc_gen_privkey() argument 1496 ecc_make_pub_key(unsigned int curve_id, unsigned int ndigits, const u64 *private_key, u64 *public_key) ecc_make_pub_key() argument 1595 crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, const u64 *private_key, const u64 *public_key, u64 *secret) crypto_ecdh_shared_secret() argument [all...] |
H A D | ecc.h | 44 * @ndigits: Length of vlis in u64 qwords. 49 u8 ndigits; member 52 #define ECC_POINT_INIT(x, y, ndigits) (struct ecc_point) { x, y, ndigits } 60 * pre-calculated value 'mu' is appended to the @p after ndigits. 77 * ecc_swap_digits() - Copy ndigits from big endian array to native array 80 * @ndigits: Number of digits to copy 82 static inline void ecc_swap_digits(const u64 *in, u64 *out, unsigned int ndigits) in ecc_swap_digits() argument 87 for (i = 0; i < ndigits; i++) in ecc_swap_digits() 88 out[i] = be64_to_cpu(src[ndigits in ecc_swap_digits() [all...] |
H A 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) > in ecrdsa_verify() 195 unsigned int ndigits; ecrdsa_set_pub_key() local [all...] |
H A D | ecdsa.c | 36 const void *value, size_t vlen, unsigned int ndigits) in ecdsa_get_signature_rs() 38 size_t keylen = ndigits * sizeof(u64); in ecdsa_get_signature_rs() 71 ecc_swap_digits((u64 *)rs, dest, ndigits); in ecdsa_get_signature_rs() 82 sig->curve->g.ndigits); in ecdsa_get_signature_r() 91 sig->curve->g.ndigits); in ecdsa_get_signature_s() 97 unsigned int ndigits = curve->g.ndigits; in _ecdsa_verify() local 103 struct ecc_point res = ECC_POINT_INIT(x1, y1, ndigits); in _ecdsa_verify() 106 if (vli_is_zero(r, ndigits) || vli_cmp(r, curve->n, ndigits) > in _ecdsa_verify() 35 ecdsa_get_signature_rs(u64 *dest, size_t hdrlen, unsigned char tag, const void *value, size_t vlen, unsigned int ndigits) ecdsa_get_signature_rs() argument 227 unsigned int ndigits; ecdsa_set_pub_key() local [all...] |
H A D | ecdh.c | 17 unsigned int ndigits; member 40 unsigned int ndigits; in ecdh_set_secret() local 46 ndigits = ecdh_supported_curve(params.curve_id); in ecdh_set_secret() 47 if (!ndigits) in ecdh_set_secret() 51 ctx->ndigits = ndigits; in ecdh_set_secret() 54 return ecc_gen_privkey(ctx->curve_id, ctx->ndigits, in ecdh_set_secret() 59 if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, in ecdh_set_secret() 77 nbytes = ctx->ndigits << ECC_DIGITS_TO_BYTES_SHIFT; in ecdh_compute_value() 104 ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits, in ecdh_compute_value() [all...] |
H A D | ecrdsa_defs.h | 53 .ndigits = 256 / 64, 86 .ndigits = 256 / 64, 123 .ndigits = 256 / 64, 172 .ndigits = 512 / 64, 217 .ndigits = 512 / 64,
|
H A D | ecc_curve_defs.h | 23 .ndigits = 3, 49 .ndigits = 4, 81 .ndigits = 6,
|
/kernel/linux/linux-6.6/crypto/ |
H A D | ecc.c | 69 static u64 *ecc_alloc_digits_space(unsigned int ndigits) in ecc_alloc_digits_space() argument 71 size_t len = ndigits * sizeof(u64); in ecc_alloc_digits_space() 84 struct ecc_point *ecc_alloc_point(unsigned int ndigits) in ecc_alloc_point() argument 91 p->x = ecc_alloc_digits_space(ndigits); in ecc_alloc_point() 95 p->y = ecc_alloc_digits_space(ndigits); in ecc_alloc_point() 99 p->ndigits = ndigits; in ecc_alloc_point() 122 static void vli_clear(u64 *vli, unsigned int ndigits) in vli_clear() argument 126 for (i = 0; i < ndigits; i++) in vli_clear() 131 bool vli_is_zero(const u64 *vli, unsigned int ndigits) in vli_is_zero() argument 150 vli_is_negative(const u64 *vli, unsigned int ndigits) vli_is_negative() argument 156 vli_num_digits(const u64 *vli, unsigned int ndigits) vli_num_digits() argument 170 vli_num_bits(const u64 *vli, unsigned int ndigits) vli_num_bits() argument 188 vli_from_be64(u64 *dest, const void *src, unsigned int ndigits) vli_from_be64() argument 198 vli_from_le64(u64 *dest, const void *src, unsigned int ndigits) vli_from_le64() argument 209 vli_set(u64 *dest, const u64 *src, unsigned int ndigits) vli_set() argument 218 vli_cmp(const u64 *left, const u64 *right, unsigned int ndigits) vli_cmp() argument 236 vli_lshift(u64 *result, const u64 *in, unsigned int shift, unsigned int ndigits) vli_lshift() argument 253 vli_rshift1(u64 *vli, unsigned int ndigits) vli_rshift1() argument 268 vli_add(u64 *result, const u64 *left, const u64 *right, unsigned int ndigits) vli_add() argument 288 vli_uadd(u64 *result, const u64 *left, u64 right, unsigned int ndigits) vli_uadd() argument 310 vli_sub(u64 *result, const u64 *left, const u64 *right, unsigned int ndigits) vli_sub() argument 331 vli_usub(u64 *result, const u64 *left, u64 right, unsigned int ndigits) vli_usub() argument 391 vli_mult(u64 *result, const u64 *left, const u64 *right, unsigned int ndigits) vli_mult() argument 428 vli_umult(u64 *result, const u64 *left, u32 right, unsigned int ndigits) vli_umult() argument 449 vli_square(u64 *result, const u64 *left, unsigned int ndigits) vli_square() argument 491 vli_mod_add(u64 *result, const u64 *left, const u64 *right, const u64 *mod, unsigned int ndigits) vli_mod_add() argument 508 vli_mod_sub(u64 *result, const u64 *left, const u64 *right, const u64 *mod, unsigned int ndigits) vli_mod_sub() argument 530 vli_mmod_special(u64 *result, const u64 *product, const u64 *mod, unsigned int ndigits) vli_mmod_special() argument 564 vli_mmod_special2(u64 *result, const u64 *product, const u64 *mod, unsigned int ndigits) vli_mmod_special2() argument 613 vli_mmod_slow(u64 *result, u64 *product, const u64 *mod, unsigned int ndigits) vli_mmod_slow() argument 663 vli_mmod_barrett(u64 *result, u64 *product, const u64 *mod, unsigned int ndigits) vli_mmod_barrett() argument 692 const unsigned int ndigits = 3; vli_mmod_fast_192() local 720 const unsigned int ndigits = 4; vli_mmod_fast_256() local 803 const unsigned int ndigits = 6; vli_mmod_fast_384() local 915 const unsigned int ndigits = curve->g.ndigits; vli_mmod_fast() local 955 vli_mod_mult_slow(u64 *result, const u64 *left, const u64 *right, const u64 *mod, unsigned int ndigits) vli_mod_mult_slow() argument 990 vli_mod_inv(u64 *result, const u64 *input, const u64 *mod, unsigned int ndigits) vli_mod_inv() argument 1087 const unsigned int ndigits = curve->g.ndigits; ecc_point_double_jacobian() local 1160 const unsigned int ndigits = curve->g.ndigits; xycz_initial_double() local 1188 const unsigned int ndigits = curve->g.ndigits; xycz_add() local 1233 const unsigned int ndigits = curve->g.ndigits; xycz_add_c() local 1280 ecc_point_mult(struct ecc_point *result, const struct ecc_point *point, const u64 *scalar, u64 *initial_z, const struct ecc_curve *curve, unsigned int ndigits) ecc_point_mult() argument 1347 unsigned int ndigits = curve->g.ndigits; ecc_point_add() local 1371 unsigned int ndigits = curve->g.ndigits; ecc_point_mult_shamir() local 1419 __ecc_is_key_valid(const struct ecc_curve *curve, const u64 *private_key, unsigned int ndigits) __ecc_is_key_valid() argument 1442 ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits, const u64 *private_key, unsigned int private_key_len) ecc_is_key_valid() argument 1469 ecc_gen_privkey(unsigned int curve_id, unsigned int ndigits, u64 *privkey) ecc_gen_privkey() argument 1510 ecc_make_pub_key(unsigned int curve_id, unsigned int ndigits, const u64 *private_key, u64 *public_key) ecc_make_pub_key() argument 1609 crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, const u64 *private_key, const u64 *public_key, u64 *secret) crypto_ecdh_shared_secret() argument [all...] |
H A 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) > in ecrdsa_verify() 195 unsigned int ndigits; ecrdsa_set_pub_key() local [all...] |
H A D | ecdsa.c | 36 const void *value, size_t vlen, unsigned int ndigits) in ecdsa_get_signature_rs() 38 size_t keylen = ndigits * sizeof(u64); in ecdsa_get_signature_rs() 71 ecc_swap_digits((u64 *)rs, dest, ndigits); in ecdsa_get_signature_rs() 82 sig->curve->g.ndigits); in ecdsa_get_signature_r() 91 sig->curve->g.ndigits); in ecdsa_get_signature_s() 97 unsigned int ndigits = curve->g.ndigits; in _ecdsa_verify() local 103 struct ecc_point res = ECC_POINT_INIT(x1, y1, ndigits); in _ecdsa_verify() 106 if (vli_is_zero(r, ndigits) || vli_cmp(r, curve->n, ndigits) > in _ecdsa_verify() 35 ecdsa_get_signature_rs(u64 *dest, size_t hdrlen, unsigned char tag, const void *value, size_t vlen, unsigned int ndigits) ecdsa_get_signature_rs() argument 227 unsigned int ndigits; ecdsa_set_pub_key() local [all...] |
H A D | ecdh.c | 17 unsigned int ndigits; member 33 params.key_size > sizeof(u64) * ctx->ndigits) in ecdh_set_secret() 37 return ecc_gen_privkey(ctx->curve_id, ctx->ndigits, in ecdh_set_secret() 42 if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, in ecdh_set_secret() 60 nbytes = ctx->ndigits << ECC_DIGITS_TO_BYTES_SHIFT; in ecdh_compute_value() 87 ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits, in ecdh_compute_value() 93 ret = ecc_make_pub_key(ctx->curve_id, ctx->ndigits, in ecdh_compute_value() 123 return ctx->ndigits << (ECC_DIGITS_TO_BYTES_SHIFT + 1); in ecdh_max_size() 131 ctx->ndigits = ECC_CURVE_NIST_P192_DIGITS; in ecdh_nist_p192_init_tfm() 156 ctx->ndigits in ecdh_nist_p256_init_tfm() [all...] |
H A D | ecrdsa_defs.h | 53 .ndigits = 256 / 64, 86 .ndigits = 256 / 64, 123 .ndigits = 256 / 64, 172 .ndigits = 512 / 64, 217 .ndigits = 512 / 64,
|
H A D | ecc_curve_defs.h | 23 .ndigits = 3, 49 .ndigits = 4, 81 .ndigits = 6, 100 .ndigits = 4,
|
/kernel/linux/linux-6.6/include/crypto/internal/ |
H A D | ecc.h | 42 #define ECC_POINT_INIT(x, y, ndigits) (struct ecc_point) { x, y, ndigits } 45 * ecc_swap_digits() - Copy ndigits from big endian array to native array 48 * @ndigits: Number of digits to copy 50 static inline void ecc_swap_digits(const void *in, u64 *out, unsigned int ndigits) in ecc_swap_digits() argument 55 for (i = 0; i < ndigits; i++) in ecc_swap_digits() 56 out[i] = get_unaligned_be64(&src[ndigits - 1 - i]); in ecc_swap_digits() 63 * @ndigits: curve's number of digits 69 int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits, 78 * @ndigits [all...] |
/kernel/linux/linux-6.6/drivers/crypto/intel/keembay/ |
H A 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() 300 * @ndigits: The size of the operands (in digits). 308 unsigned int ndigits, const u32 inst) in kmb_ecc_do_scalar_op() 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) ! in kmb_ocs_ecc_is_pubkey_valid_partial() 305 kmb_ecc_do_scalar_op(struct ocs_ecc_dev *ecc_dev, u64 *scalar_out, const u64 *scalar_a, const u64 *scalar_b, const struct ecc_curve *curve, unsigned int ndigits, const u32 inst) kmb_ecc_do_scalar_op() argument 457 size_t ndigits = curve->g.ndigits; kmb_ecc_is_key_valid() local [all...] |
/kernel/linux/linux-6.6/net/bluetooth/ |
H A 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()
|
/kernel/linux/linux-5.10/net/bluetooth/ |
H A D | ecdh_helper.c | 44 static inline void swap_digits(u64 *in, u64 *out, unsigned int ndigits) in swap_digits() argument 48 for (i = 0; i < ndigits; i++) in swap_digits() 49 out[i] = __swab64(in[ndigits - 1 - i]); in swap_digits()
|
/kernel/linux/linux-6.6/include/crypto/ |
H A D | ecc_curve.h | 14 * @ndigits: Length of vlis in u64 qwords. 19 u8 ndigits; member 28 * pre-calculated value 'mu' is appended to the @p after ndigits.
|
/kernel/linux/linux-5.10/scripts/mod/ |
H A D | file2alias.c | 268 int ndigits; in do_usb_entry_multi() local 285 for (ndigits = 0 ; ndigits < sizeof(bcdDevice_lo) * 2 ; ndigits++) { in do_usb_entry_multi() 286 clo = (devlo >> (ndigits << 2)) & 0xf; in do_usb_entry_multi() 287 chi = ((devhi > 0x9999 ? 0x9999 : devhi) >> (ndigits << 2)) & 0xf; in do_usb_entry_multi() 302 for (ndigits = sizeof(bcdDevice_lo) * 2 - 1; devlo <= devhi; ndigits--) { in do_usb_entry_multi() 310 if (devlo == devhi || !ndigits) { in do_usb_entry_multi() 311 do_usb_entry(symval, devlo, ndigits, cl in do_usb_entry_multi() [all...] |
/kernel/linux/linux-6.6/scripts/mod/ |
H A 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, cl in do_usb_entry_multi() [all...] |
/kernel/linux/linux-6.6/drivers/crypto/hisilicon/hpre/ |
H A D | hpre_crypto.c | 1256 static void fill_curve_param(void *addr, u64 *param, unsigned int cur_sz, u8 ndigits) in fill_curve_param() argument 1258 unsigned int sz = cur_sz - (ndigits - 1) * sizeof(u64); in fill_curve_param() 1261 while (i < ndigits - 1) { in fill_curve_param() 1266 memcpy(addr + sizeof(u64) * i, ¶m[ndigits - 1], sz); in fill_curve_param() 1290 fill_curve_param(p, curve->p, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1291 fill_curve_param(a, curve->a, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1292 fill_curve_param(b, curve->b, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1293 fill_curve_param(x, curve->g.x, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1294 fill_curve_param(y, curve->g.y, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() 1295 fill_curve_param(n, curve->n, cur_sz, curve->g.ndigits); in hpre_ecdh_fill_curve() [all...] |