/crypto/ |
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 static 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() 120 static void vli_clear(u64 *vli, unsigned int ndigits) in vli_clear() argument 124 for (i = 0; i < ndigits; i++) in vli_clear() 129 bool vli_is_zero(const u64 *vli, unsigned int ndigits) in vli_is_zero() argument 133 for (i = 0; i < ndigits; i++) { in vli_is_zero() [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 | ecc.h | 42 #define ECC_POINT_INIT(x, y, ndigits) (struct ecc_point) { x, y, ndigits } argument 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() 69 int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits, 84 int ecc_gen_privkey(unsigned int curve_id, unsigned int ndigits, u64 *privkey); 97 int ecc_make_pub_key(const unsigned int curve_id, unsigned int ndigits, 115 int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits, 156 bool vli_is_zero(const u64 *vli, unsigned int ndigits); 168 int vli_cmp(const u64 *left, const u64 *right, unsigned int ndigits); [all …]
|
D | ecdsa.c | 36 const void *value, size_t vlen, unsigned int ndigits) in ecdsa_get_signature_rs() argument 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) >= 0 || in _ecdsa_verify() 107 vli_is_zero(s, ndigits) || vli_cmp(s, curve->n, ndigits) >= 0) in _ecdsa_verify() 112 hash[ndigits - 1], hash[ndigits - 2], hash[0]); in _ecdsa_verify() [all …]
|
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 = ECC_CURVE_NIST_P256_DIGITS; in ecdh_nist_p256_init_tfm() [all …]
|
D | ecrdsa_defs.h | 53 .ndigits = 256 / 64, 86 .ndigits = 256 / 64, 123 .ndigits = 256 / 64, 172 .ndigits = 512 / 64, 217 .ndigits = 512 / 64,
|
D | ecc_curve_defs.h | 23 .ndigits = 3, 49 .ndigits = 4, 81 .ndigits = 6, 100 .ndigits = 4,
|