Home
last modified time | relevance | path

Searched refs:m (Results 1 – 25 of 31) sorted by relevance

12

/crypto/fipsmodule/bn/test/
A Dmiller_rabin_tests.txt61 # b^m = w-1
66 # b^m = w-1
71 # b^m = w-1
91 # b^m = 1
96 # b^m = 1
101 # b^m = 1
162 # b^m = 1
167 # b^m = 1
187 # b^m = 1
192 # b^m = 1
[all …]
/crypto/bn/
A Dexponentiation.cc71 const BIGNUM *m, BN_CTX *ctx) { in mod_exp_even() argument
94 if (!BN_mod_sqr(r, r, m, ctx) || in mod_exp_even()
105 if (m->neg) { in BN_mod_exp()
109 if (a->neg || BN_ucmp(a, m) >= 0) { in BN_mod_exp()
110 if (!BN_nnmod(r, a, m, ctx)) { in BN_mod_exp()
116 if (BN_is_odd(m)) { in BN_mod_exp()
117 return BN_mod_exp_mont(r, a, p, m, ctx, NULL); in BN_mod_exp()
120 return mod_exp_even(r, a, p, m, ctx); in BN_mod_exp()
127 if (bn_minimal_width(m) == 1) { in BN_mod_exp_mont_word()
128 a %= m->d[0]; in BN_mod_exp_mont_word()
[all …]
/crypto/fipsmodule/bn/
A Drsaz_exp.cc.inc59 m = storage; // should not cross page
64 rsaz_1024_norm2red_avx2(m, m_norm);
70 rsaz_1024_mul_avx2(R2, R2, R2, m, k0);
72 rsaz_1024_mul_avx2(R2, R2, rsaz_two80, m, k0);
78 rsaz_1024_mul_avx2(a_inv, a_inv, R2, m, k0);
82 rsaz_1024_sqr_avx2(result, a_inv, m, k0, 1);
85 rsaz_1024_sqr_avx2(result, result, m, k0, 1);
88 rsaz_1024_sqr_avx2(result, result, m, k0, 1);
91 rsaz_1024_sqr_avx2(result, result, m, k0, 1);
112 rsaz_1024_sqr_avx2(result, result, m, k0, 5);
[all …]
A Ddiv.cc.inc359 // We know 0 <= |a| < 2*|m|, so -|m| <= |r| < |m|.
386 // tmp = a - b + m
387 bn_add_words(tmp, r, m, num);
536 bn_mod_add_words(r->d, a->d, b->d, m->d, tmp->d, m->width);
537 r->width = m->width;
560 bn_mod_sub_words(r->d, a->d, b->d, m->d, tmp->d, m->width);
561 r->width = m->width;
603 return BN_mod(r, r, m, ctx);
613 if (m->neg) {
614 abs_m.reset(BN_dup(m));
[all …]
A Ddiv_extra.cc.inc26 // computing |m| and |q| without architecture-specific code.
32 // |p| and |m| from |bn_mod_u16_consttime| below.
33 static uint16_t mod_u16(uint32_t n, uint16_t d, uint32_t p, uint32_t m) {
35 uint32_t q = ((uint64_t)m * n) >> 32;
49 uint32_t p, uint32_t m) {
54 t = mod_u16(t, d, p, m);
58 t = mod_u16(t, d, p, m);
73 uint32_t m = (uint32_t)(((UINT64_C(1) << (32 + p)) + d - 1) / d);
78 ret = shift_and_add_mod_u16(ret, bn->d[i], d, p, m);
80 ret = shift_and_add_mod_u16(ret, bn->d[i] >> 32, d, p, m);
[all …]
A Dbn_test.cc589 ASSERT_TRUE(m); in TestModMul()
597 if (BN_is_odd(m.get())) { in TestModMul()
667 ASSERT_TRUE(m); in TestModSquare()
682 if (BN_is_odd(m.get())) { in TestModSquare()
744 ASSERT_TRUE(m); in TestModExp()
755 if (BN_is_odd(m.get())) { in TestModExp()
847 ASSERT_TRUE(m); in TestModInv()
2817 bssl::UniquePtr<BIGNUM> m(BN_new()); in TEST_F() local
2818 ASSERT_TRUE(m); in TEST_F()
2819 ASSERT_TRUE(BN_set_bit(m.get(), 0)); in TEST_F()
[all …]
A Dinternal.h461 BIGNUM *m; member
508 const BN_ULONG *m, size_t num);
512 BN_ULONG bn_reduce_once_in_place(BN_ULONG *r, BN_ULONG carry, const BN_ULONG *m,
588 const BN_ULONG *m, BN_ULONG *tmp, size_t num);
592 const BIGNUM *m, BN_CTX *ctx);
598 const BN_ULONG *m, BN_ULONG *tmp, size_t num);
602 const BIGNUM *m, BN_CTX *ctx);
606 int bn_mod_lshift1_consttime(BIGNUM *r, const BIGNUM *a, const BIGNUM *m,
610 int bn_mod_lshift_consttime(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m,
A Dexponentiation.cc.inc128 if (!BN_is_odd(m)) {
132 if (m->neg) {
136 // |a| is secret, but |a < m| is not.
145 if (BN_abs_is_word(m, 1)) {
164 new_mont.reset(BN_MONT_CTX_new_consttime(m, ctx));
413 const BIGNUM *m, BN_CTX *ctx,
421 if (!BN_is_odd(m)) {
425 if (m->neg) {
442 if (BN_abs_is_word(m, 1)) {
453 new_mont.reset(BN_MONT_CTX_new_consttime(m, ctx));
[all …]
A Dprime.cc.inc127 // // Sum over m
128 // for m:=3 to M do
131 // for j:=2 to m do
134 // S+:=2^(m-(m-1)*t)*s;
410 miller_rabin->m = BN_CTX_get(ctx);
414 miller_rabin->m == NULL || //
425 if (!bn_rshift_secret_shift(miller_rabin->m, miller_rabin->w1,
706 // Write w1 as m*2^a (Steps 1 and 2).
711 BIGNUM *m = BN_CTX_get(ctx);
712 if (m == nullptr || !BN_rshift(m, w1, a)) {
[all …]
A Dcheck_bn_tests.go255 m := test.Values["M"]
257 if a.Sign() == 0 && m.IsInt64() && m.Int64() == 1 {
262 r = new(big.Int).ModInverse(a, m)
/crypto/poly1305/
A Dpoly1305_vec.cc411 m += 64; in poly1305_blocks()
680 m += 32; in CRYPTO_poly1305_update()
686 m += want; in CRYPTO_poly1305_update()
702 m += want; in CRYPTO_poly1305_update()
714 poly1305_blocks(st, m, want); in CRYPTO_poly1305_update()
715 m += want; in CRYPTO_poly1305_update()
728 uint8_t *m = st->buffer; in CRYPTO_poly1305_finish() local
739 m += consumed; in CRYPTO_poly1305_finish()
759 t0 = CRYPTO_load_u64_le(m + 0); in CRYPTO_poly1305_finish()
783 m += 16; in CRYPTO_poly1305_finish()
[all …]
/crypto/evp/
A Dsign.cc46 uint8_t m[EVP_MAX_MD_SIZE]; in EVP_SignFinal() local
50 !EVP_DigestFinal_ex(tmp_ctx.get(), m, &m_len)) { in EVP_SignFinal()
58 !EVP_PKEY_sign(pkctx.get(), sig, &sig_len, m, m_len)) { in EVP_SignFinal()
79 uint8_t m[EVP_MAX_MD_SIZE]; in EVP_VerifyFinal() local
83 !EVP_DigestFinal_ex(tmp_ctx.get(), m, &m_len)) { in EVP_VerifyFinal()
93 return EVP_PKEY_verify(pkctx.get(), sig, sig_len, m, m_len); in EVP_VerifyFinal()
/crypto/fipsmodule/ec/
A Dec_montgomery.cc.inc343 // m = 3*xx + a*zz^2
344 EC_FELEM m;
345 ec_GFp_mont_felem_sqr(group, &m, &zz);
346 ec_GFp_mont_felem_mul(group, &m, &group->a, &m);
347 ec_felem_add(group, &m, &m, &xx);
348 ec_felem_add(group, &m, &m, &xx);
349 ec_felem_add(group, &m, &m, &xx);
351 // x_out = m^2 - 2*s
352 ec_GFp_mont_felem_sqr(group, &r->X, &m);
362 // y_out = m*(s-x_out) - 8*yyyy
[all …]
/crypto/siphash/
A Dsiphash.cc51 uint64_t m = CRYPTO_load_u64_le(input); in SIPHASH_24() local
52 v[3] ^= m; in SIPHASH_24()
55 v[0] ^= m; in SIPHASH_24()
/crypto/fipsmodule/ecdsa/
A Decdsa.cc.inc70 EC_SCALAR r, s, u1, u2, s_inv_mont, m;
86 // u1 = m * s^-1 mod order
89 // |s_inv_mont| is in Montgomery form while |m| and |r| are not, so |u1| and
91 digest_to_scalar(group, &m, digest, digest_len);
92 ec_scalar_mul_montgomery(group, &u1, &m, &s_inv_mont);
156 // s = m + priv_key * r.
161 // s = k^-1 * (m + priv_key * r). First, we compute k^-1 in the Montgomery
/crypto/dsa/
A Ddsa.cc178 int k, n = 0, m = 0; in DSA_generate_parameters_ex() local
227 if (!BN_GENCB_call(cb, BN_GENCB_GENERATED, m++)) { in DSA_generate_parameters_ex()
539 BIGNUM m; in DSA_do_sign() local
544 BN_init(&m); in DSA_do_sign()
576 if (BN_bin2bn(digest, digest_len, &m) == NULL) { in DSA_do_sign()
585 if (!bn_resize_words(&m, q_width) || !bn_resize_words(&xr, q_width)) { in DSA_do_sign()
588 bn_reduce_once_in_place(m.d, 0 /* no carry word */, dsa->q->d, in DSA_do_sign()
594 !bn_mod_add_consttime(s, &xr, &m, dsa->q, ctx) || in DSA_do_sign()
629 BN_clear_free(&m); in DSA_do_sign()
/crypto/kyber/
A Dkyber.cc268 static void matrix_mult(vector *out, const matrix *m, const vector *a) { in matrix_mult() argument
273 scalar_mult(&product, &m->v[i][j], &a->v[j]); in matrix_mult()
279 static void matrix_mult_transpose(vector *out, const matrix *m, in matrix_mult_transpose() argument
285 scalar_mult(&product, &m->v[j][i], &a->v[j]); in matrix_mult_transpose()
583 matrix m; member
651 matrix_expand(&priv->pub.m, rho); in KYBER_generate_key_external_entropy()
658 matrix_mult_transpose(&priv->pub.t, &priv->pub.m, &priv->s); in KYBER_generate_key_external_entropy()
700 matrix_mult(&u, &pub->m, &secret); in encrypt_cpa()
817 matrix_expand(&pub->m, pub->rho); in kyber_parse_public_key_no_hash()
/crypto/cipher/test/
A Dxchacha20_poly1305_tests.txt17 # uint8_t m[64], c[64];
21 # for (size_t m_len = 0; m_len < sizeof(m); m_len += 5) {
24 # randombytes(m, m_len);
30 # c, tag, &tag_len, m, m_len, ad, ad_len, NULL, nonce, key)) {
39 # hexdump(m, m_len);
/crypto/fipsmodule/bn/asm/
A Dx86_64-gcc.cc.inc31 * A. x86_64 features own ABI which I'm not familiar with. This is
78 // "m"(a), "+m"(r) is the way to favor DirectPath µ-code;
82 __asm__("mulq %3" : "=a"(low), "=d"(high) : "a"(word), "m"(a) : "cc"); \
88 : "+m"(r), "+d"(high) \
119 : "+m"(r0), "+m"(r1), "+r"(carry) \
282 __asm__("mulq %3" : "=a"(t1), "=d"(t2) : "a"(a), "m"(b) : "cc"); \
302 __asm__("mulq %3" : "=a"(t1), "=d"(t2) : "a"(a), "m"(b) : "cc"); \
/crypto/hrss/
A Dhrss.cc327 const crypto_word_t m = in poly2_mod_phiN() local
330 p->v[i] ^= m; in poly2_mod_phiN()
363 crypto_word_t m) { in poly2_fmadd() argument
365 out->v[i] ^= in->v[i] & m; in poly2_fmadd()
1965 struct poly m, r, m_lifted; in HRSS_encap() member
1988 poly_short_sample(&vars->m, in); in HRSS_encap()
1990 poly_lift(&vars->m_lifted, &vars->m); in HRSS_encap()
1999 poly_marshal_mod3(vars->m_bytes, &vars->m); in HRSS_encap()
2032 struct poly m, m_lifted; in HRSS_decap() member
2104 poly_from_poly3(&vars->m, &vars->m3); in HRSS_decap()
[all …]
/crypto/des/
A Ddes.cc59 #define PERM_OP(a, b, t, n, m) \ argument
61 (t) = ((((a) >> (n)) ^ (b)) & (m)); \
335 #define HPERM_OP(a, t, n, m) \ argument
336 ((t) = ((((a) << (16 - (n))) ^ (a)) & (m)), \
/crypto/x509/
A Dx509_lu.cc148 X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, const X509_LOOKUP_METHOD *m) { in X509_STORE_add_lookup() argument
152 if (m == lu->method) { in X509_STORE_add_lookup()
157 X509_LOOKUP *lu = X509_LOOKUP_new(m, v); in X509_STORE_add_lookup()
/crypto/fipsmodule/mlkem/
A Dmlkem.cc.inc330 static void matrix_mult(vector<RANK> *out, const matrix<RANK> *m,
336 scalar_mult(&product, &m->v[i][j], &a->v[j]);
343 void matrix_mult_transpose(vector<RANK> *out, const matrix<RANK> *m,
349 scalar_mult(&product, &m->v[j][i], &a->v[j]);
652 matrix<RANK> m;
713 matrix_expand(&priv->pub.m, rho);
720 matrix_mult_transpose(&priv->pub.t, &priv->pub.m, &priv->s);
767 matrix_mult(&u, &pub->m, &secret);
830 matrix_expand(&pub->m, pub->rho);
/crypto/
A Dinternal.h399 uint8_t m = value_barrier_w(mask); in constant_time_select_8() local
400 return (m & a) | (~m & b); in constant_time_select_8()
/crypto/fipsmodule/rsa/
A Drsa.cc.inc707 const BIGNUM *m, unsigned m_min_bits,
710 constant_time_declassify_int(BN_cmp(ainv, m) >= 0)) {
716 // checking |ainv| is in range bounds the running time, assuming |m|'s bounds
722 !bn_div_consttime(NULL, tmp, tmp, m, m_min_bits, ctx)) {

Completed in 850 milliseconds

12