/lib/crypto/ |
D | chacha.c | 16 static void chacha_permute(u32 *x, int nrounds) in chacha_permute() argument 24 x[0] += x[4]; x[12] = rol32(x[12] ^ x[0], 16); in chacha_permute() 25 x[1] += x[5]; x[13] = rol32(x[13] ^ x[1], 16); in chacha_permute() 26 x[2] += x[6]; x[14] = rol32(x[14] ^ x[2], 16); in chacha_permute() 27 x[3] += x[7]; x[15] = rol32(x[15] ^ x[3], 16); in chacha_permute() 29 x[8] += x[12]; x[4] = rol32(x[4] ^ x[8], 12); in chacha_permute() 30 x[9] += x[13]; x[5] = rol32(x[5] ^ x[9], 12); in chacha_permute() 31 x[10] += x[14]; x[6] = rol32(x[6] ^ x[10], 12); in chacha_permute() 32 x[11] += x[15]; x[7] = rol32(x[7] ^ x[11], 12); in chacha_permute() 34 x[0] += x[4]; x[12] = rol32(x[12] ^ x[0], 8); in chacha_permute() [all …]
|
D | sm4.c | 64 static inline u32 sm4_t_non_lin_sub(u32 x) in sm4_t_non_lin_sub() argument 68 out = (u32)sbox[x & 0xff]; in sm4_t_non_lin_sub() 69 out |= (u32)sbox[(x >> 8) & 0xff] << 8; in sm4_t_non_lin_sub() 70 out |= (u32)sbox[(x >> 16) & 0xff] << 16; in sm4_t_non_lin_sub() 71 out |= (u32)sbox[(x >> 24) & 0xff] << 24; in sm4_t_non_lin_sub() 76 static inline u32 sm4_key_lin_sub(u32 x) in sm4_key_lin_sub() argument 78 return x ^ rol32(x, 13) ^ rol32(x, 23); in sm4_key_lin_sub() 81 static inline u32 sm4_enc_lin_sub(u32 x) in sm4_enc_lin_sub() argument 83 return x ^ rol32(x, 2) ^ rol32(x, 10) ^ rol32(x, 18) ^ rol32(x, 24); in sm4_enc_lin_sub() 86 static inline u32 sm4_key_sub(u32 x) in sm4_key_sub() argument [all …]
|
D | arc4.c | 17 ctx->x = 1; in arc4_setkey() 40 u32 x, y, a, b; in arc4_crypt() local 46 x = ctx->x; in arc4_crypt() 49 a = S[x]; in arc4_crypt() 56 S[x] = b; in arc4_crypt() 57 x = (x + 1) & 0xff; in arc4_crypt() 58 ta = S[x]; in arc4_crypt() 69 ctx->x = x; in arc4_crypt()
|
D | sha256.c | 41 static inline u32 Ch(u32 x, u32 y, u32 z) in Ch() argument 43 return z ^ (x & (y ^ z)); in Ch() 46 static inline u32 Maj(u32 x, u32 y, u32 z) in Maj() argument 48 return (x & y) | (z & (x | y)); in Maj() 51 #define e0(x) (ror32(x, 2) ^ ror32(x, 13) ^ ror32(x, 22)) argument 52 #define e1(x) (ror32(x, 6) ^ ror32(x, 11) ^ ror32(x, 25)) argument 53 #define s0(x) (ror32(x, 7) ^ ror32(x, 18) ^ (x >> 3)) argument 54 #define s1(x) (ror32(x, 17) ^ ror32(x, 19) ^ (x >> 10)) argument
|
D | aes.c | 94 u32 x = w & 0x7f7f7f7f; in mul_by_x() local 98 return (x << 1) ^ (y >> 7) * 0x1b; in mul_by_x() 103 u32 x = w & 0x3f3f3f3f; in mul_by_x2() local 108 return (x << 2) ^ (y >> 7) * 0x36 ^ (z >> 6) * 0x1b; in mul_by_x2() 111 static u32 mix_columns(u32 x) in mix_columns() argument 121 u32 y = mul_by_x(x) ^ ror32(x, 16); in mix_columns() 123 return y ^ ror32(x ^ y, 8); in mix_columns() 126 static u32 inv_mix_columns(u32 x) in inv_mix_columns() argument 143 u32 y = mul_by_x2(x); in inv_mix_columns() 145 return mix_columns(x ^ y ^ ror32(y, 16)); in inv_mix_columns()
|
/lib/mpi/ |
D | mpi-bit.c | 178 void mpi_rshift(MPI x, MPI a, unsigned int n) in mpi_rshift() argument 185 if (x == a) { in mpi_rshift() 187 if (nlimbs >= x->nlimbs) { in mpi_rshift() 188 x->nlimbs = 0; in mpi_rshift() 193 for (i = 0; i < x->nlimbs - nlimbs; i++) in mpi_rshift() 194 x->d[i] = x->d[i+nlimbs]; in mpi_rshift() 195 x->d[i] = 0; in mpi_rshift() 196 x->nlimbs -= nlimbs; in mpi_rshift() 198 if (x->nlimbs && nbits) in mpi_rshift() 199 mpihelp_rshift(x->d, x->d, x->nlimbs, nbits); in mpi_rshift() [all …]
|
D | mpi-inline.h | 27 mpi_limb_t x; in mpihelp_add_1() local 29 x = *s1_ptr++; in mpihelp_add_1() 30 s2_limb += x; in mpihelp_add_1() 32 if (s2_limb < x) { /* sum is less than the left operand: handle carry */ in mpihelp_add_1() 34 x = *s1_ptr++ + 1; /* add carry */ in mpihelp_add_1() 35 *res_ptr++ = x; /* and store */ in mpihelp_add_1() 36 if (x) /* not 0 (no overflow): we can stop */ in mpihelp_add_1() 70 mpi_limb_t x; in mpihelp_sub_1() local 72 x = *s1_ptr++; in mpihelp_sub_1() 73 s2_limb = x - s2_limb; in mpihelp_sub_1() [all …]
|
D | ec.c | 65 p->x = mpi_new(0); in mpi_point_init() 74 mpi_free(p->x); p->x = NULL; in mpi_point_free_parts() 83 mpi_set(d->x, s->x); in point_set() 92 mpi_resize(p->x, nlimbs); in point_resize() 93 p->x->nlimbs = nlimbs; in point_resize() 106 mpi_swap_cond(d->x, s->x, swap); in point_swap_cond() 176 static void ec_invm(MPI x, MPI a, struct mpi_ec_ctx *ctx) in ec_invm() argument 178 if (!mpi_invm(x, a, ctx->p)) in ec_invm() 187 mpi_limb_t x; in mpih_set_cond() local 190 x = mask & (wp[i] ^ up[i]); in mpih_set_cond() [all …]
|
D | mpi-mod.c | 95 void mpi_mod_barrett(MPI r, MPI x, mpi_barrett_t ctx) in mpi_mod_barrett() argument 104 mpi_normalize(x); in mpi_mod_barrett() 105 if (mpi_get_nlimbs(x) > 2*k) { in mpi_mod_barrett() 106 mpi_mod(r, x, m); in mpi_mod_barrett() 110 sign = x->sign; in mpi_mod_barrett() 111 x->sign = 0; in mpi_mod_barrett() 118 mpi_set(r2, x); in mpi_mod_barrett() 128 mpi_set(r1, x); in mpi_mod_barrett() 149 x->sign = sign; in mpi_mod_barrett()
|
D | generic_mpih-add1.c | 24 mpi_limb_t x, y, cy; in mpihelp_add_n() local 39 x = s1_ptr[j]; in mpihelp_add_n() 42 y += x; /* add other addend */ in mpihelp_add_n() 43 cy += y < x; /* get out carry from that add, combine */ in mpihelp_add_n()
|
D | generic_mpih-sub1.c | 23 mpi_limb_t x, y, cy; in mpihelp_sub_n() local 38 x = s1_ptr[j]; in mpihelp_sub_n() 41 y = x - y; /* main subtract */ in mpihelp_sub_n() 42 cy += y > x; /* get out carry from the subtract, combine */ in mpihelp_sub_n()
|
D | generic_mpih-mul3.c | 26 mpi_limb_t x; in mpihelp_submul_1() local 41 x = res_ptr[j]; in mpihelp_submul_1() 42 prod_low = x - prod_low; in mpihelp_submul_1() 43 cy_limb += prod_low > x ? 1 : 0; in mpihelp_submul_1()
|
D | generic_mpih-mul2.c | 26 mpi_limb_t x; in mpihelp_addmul_1() local 41 x = res_ptr[j]; in mpihelp_addmul_1() 42 prod_low = x + prod_low; in mpihelp_addmul_1() 43 cy_limb += prod_low < x ? 1 : 0; in mpihelp_addmul_1()
|
D | mpiutil.c | 305 mpi_limb_t x; in mpi_swap_cond() local 315 x = mask & (a->d[i] ^ b->d[i]); in mpi_swap_cond() 316 a->d[i] = a->d[i] ^ x; in mpi_swap_cond() 317 b->d[i] = b->d[i] ^ x; in mpi_swap_cond() 320 x = mask & (a->nlimbs ^ b->nlimbs); in mpi_swap_cond() 321 a->nlimbs = a->nlimbs ^ x; in mpi_swap_cond() 322 b->nlimbs = b->nlimbs ^ x; in mpi_swap_cond() 324 x = mask & (a->sign ^ b->sign); in mpi_swap_cond() 325 a->sign = a->sign ^ x; in mpi_swap_cond() 326 b->sign = b->sign ^ x; in mpi_swap_cond()
|
/lib/math/ |
D | prime_numbers.c | 69 static bool slow_is_prime_number(unsigned long x) in slow_is_prime_number() argument 71 unsigned long y = int_sqrt(x); in slow_is_prime_number() 74 if ((x % y) == 0) in slow_is_prime_number() 82 static unsigned long slow_next_prime_number(unsigned long x) in slow_next_prime_number() argument 84 while (x < ULONG_MAX && !slow_is_prime_number(++x)) in slow_next_prime_number() 87 return x; in slow_next_prime_number() 90 static unsigned long clear_multiples(unsigned long x, in clear_multiples() argument 97 m = 2 * x; in clear_multiples() 99 m = roundup(start, x); in clear_multiples() 103 m += x; in clear_multiples() [all …]
|
D | int_sqrt.c | 20 unsigned long int_sqrt(unsigned long x) in int_sqrt() argument 24 if (x <= 1) in int_sqrt() 25 return x; in int_sqrt() 27 m = 1UL << (__fls(x) & ~1UL); in int_sqrt() 32 if (x >= b) { in int_sqrt() 33 x -= b; in int_sqrt() 49 u32 int_sqrt64(u64 x) in int_sqrt64() argument 53 if (x <= ULONG_MAX) in int_sqrt64() 54 return int_sqrt((unsigned long) x); in int_sqrt64() 56 m = 1ULL << ((fls64(x) - 1) & ~1ULL); in int_sqrt64() [all …]
|
/lib/ |
D | checksum.c | 37 static inline unsigned short from32to16(unsigned int x) in from32to16() argument 40 x = (x & 0xffff) + (x >> 16); in from32to16() 42 x = (x & 0xffff) + (x >> 16); in from32to16() 43 return x; in from32to16() 149 static inline u32 from64to32(u64 x) in from64to32() argument 152 x = (x & 0xffffffff) + (x >> 32); in from64to32() 154 x = (x & 0xffffffff) + (x >> 32); in from64to32() 155 return (u32)x; in from64to32()
|
D | extable.c | 16 #define ex_to_insn(x) ((x)->insn) argument 18 static inline unsigned long ex_to_insn(const struct exception_table_entry *x) in ex_to_insn() argument 20 return (unsigned long)&x->insn + x->insn; in ex_to_insn() 29 struct exception_table_entry *x = a, *y = b, tmp; in swap_ex() local 32 tmp = *x; in swap_ex() 33 x->insn = y->insn + delta; in swap_ex() 37 swap_ex_entry_fixup(x, y, tmp, delta); in swap_ex() 39 x->fixup = y->fixup + delta; in swap_ex() 53 const struct exception_table_entry *x = a, *y = b; in cmp_ex_sort() local 56 if (ex_to_insn(x) > ex_to_insn(y)) in cmp_ex_sort() [all …]
|
D | test_hash.c | 38 mod255(u32 x) in mod255() argument 40 x = (x & 0xffff) + (x >> 16); /* 1 <= x <= 0x1fffe */ in mod255() 41 x = (x & 0xff) + (x >> 8); /* 1 <= x <= 0x2fd */ in mod255() 42 x = (x & 0xff) + (x >> 8); /* 1 <= x <= 0x100 */ in mod255() 43 x = (x & 0xff) + (x >> 8); /* 1 <= x <= 0xff */ in mod255() 44 return x; in mod255()
|
D | locking-selftest.c | 223 #define L(x) spin_lock(&lock_##x) argument 224 #define U(x) spin_unlock(&lock_##x) argument 225 #define LU(x) L(x); U(x) argument 226 #define SI(x) spin_lock_init(&lock_##x) argument 228 #define WL(x) write_lock(&rwlock_##x) argument 229 #define WU(x) write_unlock(&rwlock_##x) argument 230 #define WLU(x) WL(x); WU(x) argument 232 #define RL(x) read_lock(&rwlock_##x) argument 233 #define RU(x) read_unlock(&rwlock_##x) argument 234 #define RLU(x) RL(x); RU(x) argument [all …]
|
D | earlycpio.c | 66 unsigned char c, x; in find_cpio_data() local 88 x = c - '0'; in find_cpio_data() 89 if (x < 10) { in find_cpio_data() 90 v += x; in find_cpio_data() 94 x = (c | 0x20) - 'a'; in find_cpio_data() 95 if (x < 6) { in find_cpio_data() 96 v += x + 10; in find_cpio_data()
|
D | crc32.c | 37 # define tole(x) ((__force u32) cpu_to_le32(x)) argument 39 # define tole(x) (x) argument 43 # define tobe(x) ((__force u32) cpu_to_be32(x)) argument 45 # define tobe(x) (x) argument 61 # define DO_CRC(x) crc = t0[(crc ^ (x)) & 255] ^ (crc >> 8) argument 67 # define DO_CRC(x) crc = t0[((crc >> 24) ^ (x)) & 255] ^ (crc << 8) 217 static u32 __attribute_const__ gf2_multiply(u32 x, u32 y, u32 modulus) argument 219 u32 product = x & 1 ? y : 0; 224 x >>= 1; 225 product ^= x & 1 ? y : 0;
|
D | sha1.c | 39 #define setW(x, val) (*(volatile __u32 *)&W(x) = (val)) argument 41 #define setW(x, val) do { W(x) = (val); __asm__("":::"memory"); } while (0) argument 43 #define setW(x, val) (W(x) = (val)) argument 47 #define W(x) (array[(x)&15]) argument
|
/lib/raid6/ |
D | altivec.uc | 43 #define NBYTES(x) ((vector signed char) {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x})
|
D | s390vx.uc | 30 * vector register x. 32 static inline void SHLBYTE(int x, int y) 34 asm volatile ("VAB %0,%1,%1" : : "i" (x), "i" (y)); 41 * register x. 43 static inline void MASK(int x, int y) 45 asm volatile ("VESRAVB %0,%1,24" : : "i" (x), "i" (y)); 48 static inline void AND(int x, int y, int z) 50 asm volatile ("VN %0,%1,%2" : : "i" (x), "i" (y), "i" (z)); 53 static inline void XOR(int x, int y, int z) 55 asm volatile ("VX %0,%1,%2" : : "i" (x), "i" (y), "i" (z)); [all …]
|