Home
last modified time | relevance | path

Searched refs:BN_ULONG (Results 1 – 25 of 38) sorted by relevance

12

/external/boringssl/src/crypto/fipsmodule/bn/
Dinternal.h161 #define TOBN(hi, lo) ((BN_ULONG)(hi) << 32 | (lo)) in OPENSSL_MSVC_PRAGMA()
201 (((320u * 3u) + (32u * 9u * 16u)) / sizeof(BN_ULONG)) in OPENSSL_MSVC_PRAGMA()
205 (BN_ULONG *)(x), sizeof(x) / sizeof(BN_ULONG), \ in OPENSSL_MSVC_PRAGMA()
206 sizeof(x) / sizeof(BN_ULONG), 0, BN_FLG_STATIC_DATA \ in OPENSSL_MSVC_PRAGMA()
210 #define Lw(t) ((BN_ULONG)(t)) in OPENSSL_MSVC_PRAGMA()
211 #define Hw(t) ((BN_ULONG)((t) >> BN_BITS2)) in OPENSSL_MSVC_PRAGMA()
237 void bn_select_words(BN_ULONG *r, BN_ULONG mask, const BN_ULONG *a, in OPENSSL_MSVC_PRAGMA()
238 const BN_ULONG *b, size_t num); in OPENSSL_MSVC_PRAGMA()
242 int bn_set_words(BIGNUM *bn, const BN_ULONG *words, size_t num); in OPENSSL_MSVC_PRAGMA()
250 int bn_copy_words(BN_ULONG *out, size_t num, const BIGNUM *bn); in OPENSSL_MSVC_PRAGMA()
[all …]
Drsaz_exp.h37 void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16], const BN_ULONG base_norm[16],
38 const BN_ULONG exponent[16],
39 const BN_ULONG m_norm[16], const BN_ULONG RR[16],
40 BN_ULONG k0,
41 BN_ULONG storage_words[MOD_EXP_CTIME_STORAGE_LEN]);
68 void rsaz_1024_norm2red_avx2(BN_ULONG red[40], const BN_ULONG norm[16]);
73 void rsaz_1024_mul_avx2(BN_ULONG ret[40], const BN_ULONG a[40],
74 const BN_ULONG b[40], const BN_ULONG n[40], BN_ULONG k);
79 void rsaz_1024_sqr_avx2(BN_ULONG ret[40], const BN_ULONG a[40],
80 const BN_ULONG n[40], BN_ULONG k, int count);
[all …]
Dmul.c75 static void bn_abs_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, in bn_abs_sub_words()
76 size_t num, BN_ULONG *tmp) { in bn_abs_sub_words()
77 BN_ULONG borrow = bn_sub_words(tmp, a, b, num); in bn_abs_sub_words()
82 static void bn_mul_normal(BN_ULONG *r, const BN_ULONG *a, size_t na, in bn_mul_normal()
83 const BN_ULONG *b, size_t nb) { in bn_mul_normal()
88 const BN_ULONG *ltmp = a; in bn_mul_normal()
92 BN_ULONG *rr = &(r[na]); in bn_mul_normal()
94 OPENSSL_memset(r, 0, na * sizeof(BN_ULONG)); in bn_mul_normal()
133 static BN_ULONG bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, in bn_sub_part_words()
134 const BN_ULONG *b, int cl, int dl) { in bn_sub_part_words()
[all …]
Dgeneric.c99 BN_ULONG high, low, ret, tmp = (a); \
112 BN_ULONG high, low, ret, ta = (a); \
122 BN_ULONG tmp = (a); \
128 BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, in bn_mul_add_words()
129 BN_ULONG w) { in bn_mul_add_words()
130 BN_ULONG c1 = 0; in bn_mul_add_words()
156 BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, in bn_mul_words()
157 BN_ULONG w) { in bn_mul_words()
158 BN_ULONG c1 = 0; in bn_mul_words()
182 void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, size_t n) { in bn_sqr_words()
[all …]
Ddiv.c70 static BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) { in bn_div_words()
71 BN_ULONG dh, dl, q, ret = 0, th, tl, t; in bn_div_words()
79 assert((i == BN_BITS2) || (h <= (BN_ULONG)1 << i)); in bn_div_words()
140 static inline void bn_div_rem_words(BN_ULONG *quotient_out, BN_ULONG *rem_out, in bn_div_rem_words()
141 BN_ULONG n0, BN_ULONG n1, BN_ULONG d0) { in bn_div_rem_words()
171 *quotient_out = (BN_ULONG)(n / d0); in bn_div_rem_words()
199 BN_ULONG *resp, *wnump; in BN_div()
200 BN_ULONG d0, d1; in BN_div()
311 BN_ULONG q, l0; in BN_div()
314 BN_ULONG n0, n1, rm = 0; in BN_div()
[all …]
Drandom.c151 const BN_ULONG kOne = 1; in BN_rand()
152 const BN_ULONG kThree = 3; in BN_rand()
153 BN_ULONG mask = bit < BN_BITS2 - 1 ? (kOne << (bit + 1)) - 1 : BN_MASK2; in BN_rand()
158 RAND_bytes((uint8_t *)rnd->d, words * sizeof(BN_ULONG)); in BN_rand()
188 static crypto_word_t bn_less_than_word_mask(const BN_ULONG *a, size_t len, in bn_less_than_word_mask()
189 BN_ULONG b) { in bn_less_than_word_mask()
198 OPENSSL_STATIC_ASSERT(sizeof(BN_ULONG) <= sizeof(crypto_word_t), in bn_less_than_word_mask()
210 int bn_in_range_words(const BN_ULONG *a, BN_ULONG min_inclusive, in bn_in_range_words()
211 const BN_ULONG *max_exclusive, size_t len) { in bn_in_range_words()
216 static int bn_range_to_mask(size_t *out_words, BN_ULONG *out_mask, in bn_range_to_mask()
[all …]
Dgcd_extra.c24 static BN_ULONG word_is_odd_mask(BN_ULONG a) { return (BN_ULONG)0 - (a & 1); } in word_is_odd_mask()
26 static void maybe_rshift1_words(BN_ULONG *a, BN_ULONG mask, BN_ULONG *tmp, in maybe_rshift1_words()
32 static void maybe_rshift1_words_carry(BN_ULONG *a, BN_ULONG carry, in maybe_rshift1_words_carry()
33 BN_ULONG mask, BN_ULONG *tmp, in maybe_rshift1_words_carry()
42 static BN_ULONG maybe_add_words(BN_ULONG *a, BN_ULONG mask, const BN_ULONG *b, in maybe_add_words()
43 BN_ULONG *tmp, size_t num) { in maybe_add_words()
44 BN_ULONG carry = bn_add_words(tmp, a, b, num); in maybe_add_words()
84 BN_ULONG both_odd = word_is_odd_mask(u->d[0]) & word_is_odd_mask(v->d[0]); in bn_gcd_consttime()
87 BN_ULONG u_less_than_v = in bn_gcd_consttime()
88 (BN_ULONG)0 - bn_sub_words(tmp->d, u->d, v->d, width); in bn_gcd_consttime()
[all …]
Dbn.c172 static const BN_ULONG kOneLimbs[1] = { 1 }; in DEFINE_METHOD_FUNCTION()
173 out->d = (BN_ULONG*) kOneLimbs; in DEFINE_METHOD_FUNCTION()
182 unsigned BN_num_bits_word(BN_ULONG l) { in BN_num_bits_word()
186 BN_ULONG x, mask; in BN_num_bits_word()
256 int BN_set_word(BIGNUM *bn, BN_ULONG value) { in BN_set_word()
277 return BN_set_word(bn, (BN_ULONG)value); in BN_set_u64()
285 bn->d[0] = (BN_ULONG)value; in BN_set_u64()
286 bn->d[1] = (BN_ULONG)(value >> 32); in BN_set_u64()
294 int bn_set_words(BIGNUM *bn, const BN_ULONG *words, size_t num) { in bn_set_words()
298 OPENSSL_memmove(bn->d, words, num * sizeof(BN_ULONG)); in bn_set_words()
[all …]
Dmontgomery.c196 sizeof(BN_ULONG) * BN_MONT_CTX_N0_LIMBS == sizeof(uint64_t), in bn_mont_ctx_set_N_and_n0()
199 mont->n0[0] = (BN_ULONG)n0; in bn_mont_ctx_set_N_and_n0()
201 mont->n0[1] = (BN_ULONG)(n0 >> BN_BITS2); in bn_mont_ctx_set_N_and_n0()
288 static int bn_from_montgomery_in_place(BN_ULONG *r, size_t num_r, BN_ULONG *a, in bn_from_montgomery_in_place()
290 const BN_ULONG *n = mont->N.d; in bn_from_montgomery_in_place()
300 BN_ULONG n0 = mont->n0[0]; in bn_from_montgomery_in_place()
301 BN_ULONG carry = 0; in bn_from_montgomery_in_place()
303 BN_ULONG v = bn_mul_add_words(a + i, n, num_n, a[i] * n0); in bn_from_montgomery_in_place()
453 void bn_to_montgomery_small(BN_ULONG *r, const BN_ULONG *a, size_t num, in bn_to_montgomery_small()
458 void bn_from_montgomery_small(BN_ULONG *r, const BN_ULONG *a, size_t num, in bn_from_montgomery_small()
[all …]
Dshift.c69 BN_ULONG *t, *f; in BN_lshift()
70 BN_ULONG l; in BN_lshift()
106 BN_ULONG *ap, *rp, t, c; in BN_lshift1()
136 void bn_rshift_words(BN_ULONG *r, const BN_ULONG *a, unsigned shift, in bn_rshift_words()
141 OPENSSL_memset(r, 0, num * sizeof(BN_ULONG)); in bn_rshift_words()
145 OPENSSL_memmove(r, a + shift_words, (num - shift_words) * sizeof(BN_ULONG)); in bn_rshift_words()
153 OPENSSL_memset(r + num - shift_words, 0, shift_words * sizeof(BN_ULONG)); in bn_rshift_words()
186 BN_ULONG mask = (n >> i) & 1; in bn_rshift_secret_shift()
200 void bn_rshift1_words(BN_ULONG *r, const BN_ULONG *a, size_t num) { in bn_rshift1_words()
238 a->d[i] |= (((BN_ULONG)1) << j); in BN_set_bit()
[all …]
Dcmp.c66 static int bn_cmp_words_consttime(const BN_ULONG *a, size_t a_len, in bn_cmp_words_consttime()
67 const BN_ULONG *b, size_t b_len) { in bn_cmp_words_consttime()
68 OPENSSL_STATIC_ASSERT(sizeof(BN_ULONG) <= sizeof(crypto_word_t), in bn_cmp_words_consttime()
126 int bn_less_than_words(const BN_ULONG *a, const BN_ULONG *b, size_t len) { in bn_less_than_words()
130 int BN_abs_is_word(const BIGNUM *bn, BN_ULONG w) { in BN_abs_is_word()
134 BN_ULONG mask = bn->d[0] ^ w; in BN_abs_is_word()
141 int BN_cmp_word(const BIGNUM *a, BN_ULONG b) { in BN_cmp_word()
160 int BN_is_word(const BIGNUM *bn, BN_ULONG w) { in BN_is_word()
184 BN_ULONG mask = 0; in BN_equal_consttime()
Drsaz_exp.c26 alignas(64) static const BN_ULONG one[40] = {
31 alignas(64) static const BN_ULONG two80[40] = {
35 void RSAZ_1024_mod_exp_avx2(BN_ULONG result_norm[16], in RSAZ_1024_mod_exp_avx2()
36 const BN_ULONG base_norm[16], in RSAZ_1024_mod_exp_avx2()
37 const BN_ULONG exponent[16], in RSAZ_1024_mod_exp_avx2()
38 const BN_ULONG m_norm[16], const BN_ULONG RR[16], in RSAZ_1024_mod_exp_avx2()
39 BN_ULONG k0, in RSAZ_1024_mod_exp_avx2()
40 BN_ULONG storage[MOD_EXP_CTIME_STORAGE_LEN]) { in RSAZ_1024_mod_exp_avx2()
45 BN_ULONG *a_inv, *m, *result, *table_s = storage + 40 * 3, *R2 = table_s; in RSAZ_1024_mod_exp_avx2()
223 OPENSSL_cleanse(storage, MOD_EXP_CTIME_STORAGE_LEN * sizeof(BN_ULONG)); in RSAZ_1024_mod_exp_avx2()
Dadd.c118 BN_ULONG carry = bn_add_words(r->d, a->d, b->d, min); in bn_uadd_consttime()
121 BN_ULONG tmp = carry + a->d[i]; in bn_uadd_consttime()
138 int BN_add_word(BIGNUM *a, BN_ULONG w) { in BN_add_word()
139 BN_ULONG l; in BN_add_word()
242 BN_ULONG borrow = bn_sub_words(r->d, a->d, b->d, b_width); in bn_usub_consttime()
245 BN_ULONG tmp = a->d[i]; in bn_usub_consttime()
268 int BN_sub_word(BIGNUM *a, BN_ULONG w) { in BN_sub_word()
Dexponentiation.c722 void bn_mod_exp_mont_small(BN_ULONG *r, const BN_ULONG *a, size_t num, in bn_mod_exp_mont_small()
723 const BN_ULONG *p, size_t num_p, in bn_mod_exp_mont_small()
749 BN_ULONG val[TABLE_SIZE_SMALL][BN_SMALL_MAX_WORDS]; in bn_mod_exp_mont_small()
750 OPENSSL_memcpy(val[0], a, num * sizeof(BN_ULONG)); in bn_mod_exp_mont_small()
752 BN_ULONG d[BN_SMALL_MAX_WORDS]; in bn_mod_exp_mont_small()
796 OPENSSL_memcpy(r, val[wvalue >> 1], num * sizeof(BN_ULONG)); in bn_mod_exp_mont_small()
812 void bn_mod_inverse_prime_mont_small(BN_ULONG *r, const BN_ULONG *a, size_t num, in bn_mod_inverse_prime_mont_small()
819 BN_ULONG p_minus_two[BN_SMALL_MAX_WORDS]; in bn_mod_inverse_prime_mont_small()
820 const BN_ULONG *p = mont->N.d; in bn_mod_inverse_prime_mont_small()
821 OPENSSL_memcpy(p_minus_two, p, num * sizeof(BN_ULONG)); in bn_mod_inverse_prime_mont_small()
[all …]
Dbn_test.cc123 BN_ULONG word = BN_get_word(ret.get()); in GetInt()
283 BN_ULONG b_word = BN_get_word(b.get()); in TestSum()
284 if (!BN_is_negative(b.get()) && b_word != (BN_ULONG)-1) { in TestSum()
458 std::unique_ptr<BN_ULONG[]> a_words(new BN_ULONG[num_a]), in TestSquare()
459 r_words(new BN_ULONG[num_r]); in TestSquare()
467 OPENSSL_memset(r_words.get(), 'A', num_r * sizeof(BN_ULONG)); in TestSquare()
525 std::unique_ptr<BN_ULONG[]> a_words(new BN_ULONG[num_a]), in TestProduct()
526 b_words(new BN_ULONG[num_b]), r_words(new BN_ULONG[num_r]); in TestProduct()
584 BN_ULONG b_word = BN_get_word(b.get()); in TestQuotient()
585 if (b_word != (BN_ULONG)-1) { in TestQuotient()
[all …]
Dbytes.c68 BN_ULONG word = 0; in BN_bin2bn()
147 BN_ULONG l; in BN_bn2bin()
203 BN_ULONG BN_get_word(const BIGNUM *bn) { in BN_get_word()
/external/boringssl/src/crypto/fipsmodule/ec/
Dp256-x86_64.h47 void ecp_nistz256_neg(BN_ULONG res[P256_LIMBS], const BN_ULONG a[P256_LIMBS]);
50 void ecp_nistz256_mul_mont(BN_ULONG res[P256_LIMBS],
51 const BN_ULONG a[P256_LIMBS],
52 const BN_ULONG b[P256_LIMBS]);
55 void ecp_nistz256_sqr_mont(BN_ULONG res[P256_LIMBS],
56 const BN_ULONG a[P256_LIMBS]);
60 static inline void ecp_nistz256_from_mont(BN_ULONG res[P256_LIMBS], in ecp_nistz256_from_mont()
61 const BN_ULONG in[P256_LIMBS]) { in ecp_nistz256_from_mont()
62 static const BN_ULONG ONE[P256_LIMBS] = { 1 }; in ecp_nistz256_from_mont()
68 static inline void ecp_nistz256_to_mont(BN_ULONG res[P256_LIMBS], in ecp_nistz256_to_mont()
[all …]
Dp256-x86_64.c43 static const BN_ULONG ONE[P256_LIMBS] = {
79 static void copy_conditional(BN_ULONG dst[P256_LIMBS], in copy_conditional()
80 const BN_ULONG src[P256_LIMBS], BN_ULONG move) { in copy_conditional()
81 BN_ULONG mask1 = ((BN_ULONG)0) - move; in copy_conditional()
82 BN_ULONG mask2 = ~mask1; in copy_conditional()
113 static BN_ULONG is_not_zero(BN_ULONG in) { in is_not_zero()
122 static void ecp_nistz256_mod_inverse_mont(BN_ULONG r[P256_LIMBS], in ecp_nistz256_mod_inverse_mont()
123 const BN_ULONG in[P256_LIMBS]) { in ecp_nistz256_mod_inverse_mont()
127 BN_ULONG p2[P256_LIMBS]; in ecp_nistz256_mod_inverse_mont()
128 BN_ULONG p4[P256_LIMBS]; in ecp_nistz256_mod_inverse_mont()
[all …]
Dfelem.c39 BN_ULONG mask = ec_felem_non_zero_mask(group, a); in ec_felem_neg()
40 BN_ULONG borrow = in ec_felem_neg()
63 BN_ULONG ec_felem_non_zero_mask(const EC_GROUP *group, const EC_FELEM *a) { in ec_felem_non_zero_mask()
64 BN_ULONG mask = 0; in ec_felem_non_zero_mask()
71 void ec_felem_select(const EC_GROUP *group, EC_FELEM *out, BN_ULONG mask, in ec_felem_select()
81 group->field.width * sizeof(BN_ULONG)) == 0; in ec_felem_equal()
Dp256-x86_64_test.cc111 BN_ULONG order_words[P256_LIMBS]; in TEST()
115 BN_ULONG in[P256_LIMBS], out[P256_LIMBS]; in TEST()
126 static const BN_ULONG kOneMont[P256_LIMBS] = { in TEST()
133 for (BN_ULONG i = 1; i < 2000; i++) { in TEST()
168 static bool GetFieldElement(FileTest *t, BN_ULONG out[P256_LIMBS], in GetFieldElement()
182 OPENSSL_memset(out, 0, P256_LIMBS * sizeof(BN_ULONG)); in GetFieldElement()
191 static std::string FieldElementToString(const BN_ULONG a[P256_LIMBS]) { in FieldElementToString()
203 const BN_ULONG expected[P256_LIMBS], const BN_ULONG actual[P256_LIMBS]) { in ExpectFieldElementsEqual()
204 if (OPENSSL_memcmp(expected, actual, sizeof(BN_ULONG) * P256_LIMBS) == 0) { in ExpectFieldElementsEqual()
302 BN_ULONG a[P256_LIMBS], b[P256_LIMBS]; in TestNegate()
[all …]
Dscalar.c37 group->order.width * sizeof(BN_ULONG)) == 0; in ec_scalar_equal_vartime()
41 BN_ULONG mask = 0; in ec_scalar_is_zero()
57 BN_ULONG tmp[EC_MAX_WORDS]; in ec_scalar_add()
/external/boringssl/src/crypto/fipsmodule/bn/asm/
Dx86_64-gcc.c70 register BN_ULONG high, low; \
85 register BN_ULONG high, low; \
97 BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, in bn_mul_add_words()
98 BN_ULONG w) { in bn_mul_add_words()
99 BN_ULONG c1 = 0; in bn_mul_add_words()
130 BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, in bn_mul_words()
131 BN_ULONG w) { in bn_mul_words()
132 BN_ULONG c1 = 0; in bn_mul_words()
161 void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, size_t n) { in bn_sqr_words()
188 BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, in bn_add_words()
[all …]
/external/boringssl/src/include/openssl/
Dbn.h151 #define BN_ULONG uint64_t macro
158 #define BN_ULONG uint32_t
219 OPENSSL_EXPORT int BN_set_word(BIGNUM *bn, BN_ULONG value);
309 OPENSSL_EXPORT BN_ULONG BN_get_word(const BIGNUM *bn);
377 OPENSSL_EXPORT int BN_add_word(BIGNUM *a, BN_ULONG w);
390 OPENSSL_EXPORT int BN_sub_word(BIGNUM *a, BN_ULONG w);
399 OPENSSL_EXPORT int BN_mul_word(BIGNUM *bn, BN_ULONG w);
417 OPENSSL_EXPORT BN_ULONG BN_div_word(BIGNUM *numerator, BN_ULONG divisor);
434 OPENSSL_EXPORT int BN_cmp_word(const BIGNUM *a, BN_ULONG b);
448 OPENSSL_EXPORT int BN_abs_is_word(const BIGNUM *bn, BN_ULONG w);
[all …]
/external/boringssl/src/crypto/bn_extra/
Dconvert.c133 BN_ULONG word = 0; in decode_hex()
138 BN_ULONG hex; in decode_hex()
164 BN_ULONG l = 0; in decode_dec()
267 BN_ULONG word = BN_div_word(copy, BN_DEC_CONV); in BN_bn2dec()
268 if (word == (BN_ULONG)-1) { in BN_bn2dec()
/external/boringssl/src/crypto/dh/
Dcheck.c122 BN_ULONG l; in DH_check()
173 if (l == (BN_ULONG)-1) { in DH_check()
181 if (l == (BN_ULONG)-1) { in DH_check()

12