| /optee_os/core/lib/libtomcrypt/src/headers/ |
| H A D | tomcrypt_macros.h | 12 #define STORE32L(x, y) \ argument 13 do { (y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \ 14 (y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); } while(0) 16 #define LOAD32L(x, y) \ argument 17 do { x = ((ulong32)((y)[3] & 255)<<24) | \ 22 #define STORE64L(x, y) \ argument 23 do { (y)[7] = (unsigned char)(((x)>>56)&255); (y)[6] = (unsigned char)(((x)>>48)&255); \ 24 (y)[5] = (unsigned char)(((x)>>40)&255); (y)[4] = (unsigned char)(((x)>>32)&255); \ 25 (y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \ 26 (y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); } while(0) [all …]
|
| H A D | tomcrypt_argchk.h | 13 #define LTC_ARGCHK(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0) argument 14 #define LTC_ARGCHKVD(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0) argument 19 #define LTC_ARGCHK(x) assert((x)) argument 20 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) argument 24 #define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, … argument 25 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) argument 29 #define LTC_ARGCHK(x) LTC_UNUSED_PARAM(x) argument 30 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) argument 34 #define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG; argument 35 #define LTC_ARGCHKVD(x) if (!(x)) return; argument
|
| /optee_os/core/lib/libtomcrypt/src/hashes/ |
| H A D | rmd128.c | 37 #define F(x, y, z) ((x) ^ (y) ^ (z)) argument 38 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) argument 39 #define H(x, y, z) (((x) | ~(y)) ^ (z)) argument 40 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) argument 43 #define FF(a, b, c, d, x, s) \ argument 44 (a) += F((b), (c), (d)) + (x);\ 47 #define GG(a, b, c, d, x, s) \ argument 48 (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ 51 #define HH(a, b, c, d, x, s) \ argument 52 (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ [all …]
|
| H A D | rmd160.c | 37 #define F(x, y, z) ((x) ^ (y) ^ (z)) argument 38 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) argument 39 #define H(x, y, z) (((x) | ~(y)) ^ (z)) argument 40 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) argument 41 #define J(x, y, z) ((x) ^ ((y) | ~(z))) argument 44 #define FF(a, b, c, d, e, x, s) \ argument 45 (a) += F((b), (c), (d)) + (x);\ 49 #define GG(a, b, c, d, e, x, s) \ argument 50 (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ 54 #define HH(a, b, c, d, e, x, s) \ argument [all …]
|
| H A D | rmd256.c | 31 #define F(x, y, z) ((x) ^ (y) ^ (z)) argument 32 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) argument 33 #define H(x, y, z) (((x) | ~(y)) ^ (z)) argument 34 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) argument 37 #define FF(a, b, c, d, x, s) \ argument 38 (a) += F((b), (c), (d)) + (x);\ 41 #define GG(a, b, c, d, x, s) \ argument 42 (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ 45 #define HH(a, b, c, d, x, s) \ argument 46 (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\ [all …]
|
| H A D | rmd320.c | 32 #define F(x, y, z) ((x) ^ (y) ^ (z)) argument 33 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) argument 34 #define H(x, y, z) (((x) | ~(y)) ^ (z)) argument 35 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) argument 36 #define J(x, y, z) ((x) ^ ((y) | ~(z))) argument 39 #define FF(a, b, c, d, e, x, s) \ argument 40 (a) += F((b), (c), (d)) + (x);\ 44 #define GG(a, b, c, d, e, x, s) \ argument 45 (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ 49 #define HH(a, b, c, d, e, x, s) \ argument [all …]
|
| H A D | md4.c | 44 #define F(x, y, z) (z ^ (x & (y ^ z))) argument 45 #define G(x, y, z) ((x & y) | (z & (x | y))) argument 46 #define H(x, y, z) ((x) ^ (y) ^ (z)) argument 48 /* ROTATE_LEFT rotates x left n bits. */ 49 #define ROTATE_LEFT(x, n) ROLc(x, n) argument 54 #define FF(a, b, c, d, x, s) { \ argument 55 (a) += F ((b), (c), (d)) + (x); \ 58 #define GG(a, b, c, d, x, s) { \ argument 59 (a) += G ((b), (c), (d)) + (x) + 0x5a827999UL; \ 62 #define HH(a, b, c, d, x, s) { \ argument [all …]
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | constant_time_impl.h | 61 /* Ensure that the compiler cannot know the value of x (i.e., cannot optimise 75 * \param x The value to hide from the compiler. 78 * x = mbedtls_ct_compiler_opaque(1), x will be unknown). 85 static inline mbedtls_ct_uint_t mbedtls_ct_compiler_opaque(mbedtls_ct_uint_t x) in mbedtls_ct_compiler_opaque() argument 88 asm volatile ("" : [x] "+r" (x) :); in mbedtls_ct_compiler_opaque() 89 return x; in mbedtls_ct_compiler_opaque() 91 return x ^ mbedtls_ct_zero; in mbedtls_ct_compiler_opaque() 120 static inline mbedtls_ct_condition_t mbedtls_ct_bool(mbedtls_ct_uint_t x) in mbedtls_ct_bool() argument 132 asm volatile ("neg %x[s], %x[x] \n\t" in mbedtls_ct_bool() 133 "orr %x[x], %x[s], %x[x] \n\t" in mbedtls_ct_bool() [all …]
|
| H A D | bignum.c | 60 int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X, in mbedtls_mpi_lt_mpi_ct() argument 66 if (X->n != Y->n) { in mbedtls_mpi_lt_mpi_ct() 74 X_is_negative = mbedtls_ct_bool((X->s & 2) >> 1); in mbedtls_mpi_lt_mpi_ct() 79 * That is if X is negative (X_is_negative == 1), then X < Y is true and it in mbedtls_mpi_lt_mpi_ct() 80 * is false if X is positive (X_is_negative == 0). in mbedtls_mpi_lt_mpi_ct() 86 * Assuming signs are the same, compare X and Y. We switch the comparison in mbedtls_mpi_lt_mpi_ct() 92 void * const p[2] = { X->p, Y->p }; in mbedtls_mpi_lt_mpi_ct() 94 mbedtls_ct_condition_t lt = mbedtls_mpi_core_lt_ct(p[i], p[i ^ 1], X->n); in mbedtls_mpi_lt_mpi_ct() 109 * Conditionally assign X = Y, without leaking information 111 * (Leaking information about the respective sizes of X and Y is ok however.) [all …]
|
| H A D | bignum_mod_raw.c | 26 void mbedtls_mpi_mod_raw_cond_assign(mbedtls_mpi_uint *X, in mbedtls_mpi_mod_raw_cond_assign() argument 31 mbedtls_mpi_core_cond_assign(X, A, N->limbs, mbedtls_ct_bool(assign)); in mbedtls_mpi_mod_raw_cond_assign() 34 void mbedtls_mpi_mod_raw_cond_swap(mbedtls_mpi_uint *X, in mbedtls_mpi_mod_raw_cond_swap() argument 39 mbedtls_mpi_core_cond_swap(X, Y, N->limbs, mbedtls_ct_bool(swap)); in mbedtls_mpi_mod_raw_cond_swap() 42 int mbedtls_mpi_mod_raw_read(mbedtls_mpi_uint *X, in mbedtls_mpi_mod_raw_read() argument 52 ret = mbedtls_mpi_core_read_le(X, N->limbs, in mbedtls_mpi_mod_raw_read() 56 ret = mbedtls_mpi_core_read_be(X, N->limbs, in mbedtls_mpi_mod_raw_read() 67 if (!mbedtls_mpi_core_lt_ct(X, N->p, N->limbs)) { in mbedtls_mpi_mod_raw_read() 95 void mbedtls_mpi_mod_raw_sub(mbedtls_mpi_uint *X, in mbedtls_mpi_mod_raw_sub() argument 100 mbedtls_mpi_uint c = mbedtls_mpi_core_sub(X, A, B, N->limbs); in mbedtls_mpi_mod_raw_sub() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/ocb/ |
| H A D | s_ocb_done.c | 35 unsigned char *Z, *Y, *X; in s_ocb_done() local 36 int err, x; in s_ocb_done() local 54 X = XMALLOC(MAXBLOCKSIZE); in s_ocb_done() 55 if (X == NULL || Y == NULL || Z == NULL) { in s_ocb_done() 56 if (X != NULL) { in s_ocb_done() 57 XFREE(X); in s_ocb_done() 68 /* compute X[m] = len(pt[m]) XOR Lr XOR Z[m] */ in s_ocb_done() 69 ocb_shift_xor(ocb, X); in s_ocb_done() 70 XMEMCPY(Z, X, ocb->block_len); in s_ocb_done() 72 X[ocb->block_len-1] ^= (ptlen*8)&255; in s_ocb_done() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/general/ |
| H A D | der_encode_asn1_length.c | 20 unsigned long x, y; in der_encode_asn1_length() local 24 x = len; in der_encode_asn1_length() 27 while(x != 0) { in der_encode_asn1_length() 29 x >>= 8; in der_encode_asn1_length() 37 x = y; in der_encode_asn1_length() 39 x = y + 1; in der_encode_asn1_length() 45 x = 0; in der_encode_asn1_length() 47 out[x++] = (unsigned char)len; in der_encode_asn1_length() 49 out[x++] = 0x81; in der_encode_asn1_length() 50 out[x++] = (unsigned char)len; in der_encode_asn1_length() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/modes/lrw/ |
| H A D | lrw_process.c | 24 int x, err; in lrw_process() local 42 for (x = 15; x >= 0; x--) { in lrw_process() 43 lrw->IV[x] = (lrw->IV[x] + 1) & 255; in lrw_process() 44 if (lrw->IV[x]) { in lrw_process() 52 for (; x < 16; x++) { in lrw_process() 55 … y)) ^= *(LTC_FAST_TYPE_PTR_CAST(&lrw->PC[x][lrw->IV[x]][y])) ^ *(LTC_FAST_TYPE_PTR_CAST(&lrw->PC[… in lrw_process() 59 lrw->pad[y] ^= lrw->PC[x][lrw->IV[x]][y] ^ lrw->PC[x][(lrw->IV[x]-1)&255][y]; in lrw_process() 69 for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { in lrw_process() 70 …*(LTC_FAST_TYPE_PTR_CAST(ct + x)) = *(LTC_FAST_TYPE_PTR_CAST(pt + x)) ^ *(LTC_FAST_TYPE_PTR_CAST(p… in lrw_process() 73 for (x = 0; x < 16; x++) { in lrw_process() [all …]
|
| /optee_os/core/lib/libfdt/include/ |
| H A D | libfdt_env.h | 29 #define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n]) argument 30 #define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1)) argument 31 #define CPU_TO_FDT32(x) ((EXTRACT_BYTE(x, 0) << 24) | (EXTRACT_BYTE(x, 1) << 16) | \ argument 32 (EXTRACT_BYTE(x, 2) << 8) | EXTRACT_BYTE(x, 3)) 33 #define CPU_TO_FDT64(x) ((EXTRACT_BYTE(x, 0) << 56) | (EXTRACT_BYTE(x, 1) << 48) | \ argument 34 (EXTRACT_BYTE(x, 2) << 40) | (EXTRACT_BYTE(x, 3) << 32) | \ 35 (EXTRACT_BYTE(x, 4) << 24) | (EXTRACT_BYTE(x, 5) << 16) | \ 36 (EXTRACT_BYTE(x, 6) << 8) | EXTRACT_BYTE(x, 7)) 38 static inline uint16_t fdt16_to_cpu(fdt16_t x) in fdt16_to_cpu() argument 40 return (FDT_FORCE uint16_t)CPU_TO_FDT16(x); in fdt16_to_cpu() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/set/ |
| H A D | der_encode_setof.c | 21 unsigned long x; in s_qsort_helper() local 28 for (x = B->size; x < A->size; x++) { in s_qsort_helper() 29 if (A->start[x]) { in s_qsort_helper() 34 for (x = A->size; x < B->size; x++) { in s_qsort_helper() 35 if (B->start[x]) { in s_qsort_helper() 56 unsigned long x, y, z; in der_encode_setof() local 63 for (x = 1; x < inlen; x++) { in der_encode_setof() 64 if (list[x].type != list[x-1].type) { in der_encode_setof() 92 x = *ptr++; in der_encode_setof() 93 if (x >= 0x80) { in der_encode_setof() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/choice/ |
| H A D | der_decode_choice.c | 23 unsigned long size, x, z; in der_decode_choice() local 36 for (x = 0; x < outlen; x++) { in der_decode_choice() 37 list[x].used = 0; in der_decode_choice() 41 for (x = 0; x < outlen; x++) { in der_decode_choice() 42 size = list[x].size; in der_decode_choice() 43 data = list[x].data; in der_decode_choice() 45 switch (list[x].type) { in der_decode_choice() 49 list[x].used = 1; in der_decode_choice() 59 list[x].used = 1; in der_decode_choice() 69 list[x].used = 1; in der_decode_choice() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/ccm/ |
| H A D | ccm_test.c | 108 unsigned long taglen, x, y; in ccm_test() 124 for (x = 0; x < (sizeof(tests)/sizeof(tests[0])); x++) { in ccm_test() 126 taglen = tests[x].taglen; in ccm_test() 128 if ((err = cipher_descriptor[idx]->setup(tests[x].key, 16, 0, &skey)) != CRYPT_OK) { in ccm_test() 133 tests[x].key, 16, in ccm_test() 135 tests[x].nonce, tests[x].noncelen, in ccm_test() 136 tests[x].header, tests[x].headerlen, in ccm_test() 137 (unsigned char*)tests[x].pt, tests[x].ptlen, in ccm_test() 144 tests[x].key, 16, in ccm_test() 146 tests[x].nonce, tests[x].noncelen, in ccm_test() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/sequence/ |
| H A D | der_length_sequence.c | 30 unsigned long size, x, y, i; in der_length_sequence_ex() local 52 if ((err = der_length_boolean(&x)) != CRYPT_OK) { in der_length_sequence_ex() 55 y += x; in der_length_sequence_ex() 59 if ((err = der_length_integer(data, &x)) != CRYPT_OK) { in der_length_sequence_ex() 62 y += x; in der_length_sequence_ex() 66 if ((err = der_length_short_integer(*((unsigned long *)data), &x)) != CRYPT_OK) { in der_length_sequence_ex() 69 y += x; in der_length_sequence_ex() 74 if ((err = der_length_bit_string(size, &x)) != CRYPT_OK) { in der_length_sequence_ex() 77 y += x; in der_length_sequence_ex() 81 if ((err = der_length_octet_string(size, &x)) != CRYPT_OK) { in der_length_sequence_ex() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/generalizedtime/ |
| H A D | der_decode_generalizedtime.c | 13 static int s_char_to_int(unsigned char x) in s_char_to_int() argument 15 switch (x) { in s_char_to_int() 31 y = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \ 33 x += 2; \ 37 …y = s_char_to_int(buf[x])*1000 + s_char_to_int(buf[x+1])*100 + s_char_to_int(buf[x+2])*10 + s_cha… 39 x += 4; \ 53 unsigned long x; in der_decode_generalizedtime() local 66 for (x = 0; x < in[1]; x++) { in der_decode_generalizedtime() 67 y = der_ia5_value_decode(in[x+2]); in der_decode_generalizedtime() 76 buf[x] = y; in der_decode_generalizedtime() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/gcm/ |
| H A D | gcm_add_aad.c | 22 unsigned long x; in gcm_add_aad() local 47 for (x = 0; x < (unsigned long)gcm->buflen; x++) { in gcm_add_aad() 48 gcm->X[x] ^= gcm->buf[x]; in gcm_add_aad() 52 gcm_mult_h(gcm, gcm->X); in gcm_add_aad() 58 for (x = 0; x < 16; x++) { in gcm_add_aad() 59 gcm->X[x] ^= gcm->buf[x]; in gcm_add_aad() 61 gcm_mult_h(gcm, gcm->X); in gcm_add_aad() 64 XMEMCPY(gcm->Y, gcm->X, 16); in gcm_add_aad() 65 zeromem(gcm->X, 16); in gcm_add_aad() 84 x = 0; in gcm_add_aad() [all …]
|
| /optee_os/core/include/dt-bindings/firewall/ |
| H A D | stm32mp25-rif.h | 65 #define RIF_EXTI1_RESOURCE(x) (x) argument 67 #define RIF_EXTI2_RESOURCE(x) (x) argument 69 #define RIF_FMC_CTRL(x) (x) argument 71 #define RIF_IOPORT_PIN(x) (x) argument 73 #define RIF_HPDMA_CHANNEL(x) (x) argument 75 #define RIF_IPCC_CPU1_CHANNEL(x) ((x) - 1) argument 77 #define RIF_IPCC_CPU2_CHANNEL(x) (((x) - 1) + 16) argument 79 #define RIF_PWR_RESOURCE(x) (x) argument 81 #define RIF_HSEM_RESOURCE(x) (x) argument 84 #define RIF_PWR_RESOURCE_WIO(x) ((x) + 6) argument [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/utf8/ |
| H A D | der_encode_utf8_string.c | 24 unsigned long x, y, len; in der_encode_utf8_string() local 32 for (x = len = 0; x < inlen; x++) { in der_encode_utf8_string() 33 if (!der_utf8_valid_char(in[x])) return CRYPT_INVALID_ARG; in der_encode_utf8_string() 34 len += der_utf8_charsize(in[x]); in der_encode_utf8_string() 36 if ((err = der_length_asn1_length(len, &x)) != CRYPT_OK) { in der_encode_utf8_string() 39 x += len + 1; in der_encode_utf8_string() 42 if (x > *outlen) { in der_encode_utf8_string() 43 *outlen = x; in der_encode_utf8_string() 48 x = 0; in der_encode_utf8_string() 49 out[x++] = 0x0C; in der_encode_utf8_string() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/mac/pmac/ |
| H A D | pmac_done.c | 14 int err, x; in pmac_done() local 28 /* handle padding. If multiple xor in L/x */ in pmac_done() 32 for (x = 0; x < pmac->block_len; x++) { in pmac_done() 33 pmac->checksum[x] ^= pmac->block[x] ^ pmac->Lr[x]; in pmac_done() 37 for (x = 0; x < pmac->buflen; x++) { in pmac_done() 38 pmac->checksum[x] ^= pmac->block[x]; in pmac_done() 40 pmac->checksum[x] ^= 0x80; in pmac_done() 50 for (x = 0; x < pmac->block_len && x < (int)*outlen; x++) { in pmac_done() 51 out[x] = pmac->checksum[x]; in pmac_done() 53 *outlen = x; in pmac_done()
|
| /optee_os/core/lib/libtomcrypt/src/stream/salsa20/ |
| H A D | xsalsa20_setup.c | 18 x[b] ^= (ROL((x[a] + x[d]), 7)); \ 19 x[c] ^= (ROL((x[b] + x[a]), 9)); \ 20 x[d] ^= (ROL((x[c] + x[b]), 13)); \ 21 x[a] ^= (ROL((x[d] + x[c]), 18)); 24 static void s_xsalsa20_doubleround(ulong32 *x, int rounds) in s_xsalsa20_doubleround() argument 58 const int sti[] = {0, 5, 10, 15, 6, 7, 8, 9}; /* indices used to build subkey fm x */ in xsalsa20_setup() 59 ulong32 x[64]; /* input to & output fm doubleround */ in xsalsa20_setup() local 72 LOAD32L(x[ 0], constants + 0); in xsalsa20_setup() 73 LOAD32L(x[ 5], constants + 4); in xsalsa20_setup() 74 LOAD32L(x[10], constants + 8); in xsalsa20_setup() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/custom_type/ |
| H A D | der_length_custom_type.c | 28 unsigned long size, x, y, i, inlen, id_len; in der_length_custom_type() local 65 if ((err = der_length_boolean(&x)) != CRYPT_OK) { in der_length_custom_type() 68 y += x; in der_length_custom_type() 72 if ((err = der_length_integer(data, &x)) != CRYPT_OK) { in der_length_custom_type() 75 y += x; in der_length_custom_type() 79 if ((err = der_length_short_integer(*((unsigned long *)data), &x)) != CRYPT_OK) { in der_length_custom_type() 82 y += x; in der_length_custom_type() 87 if ((err = der_length_bit_string(size, &x)) != CRYPT_OK) { in der_length_custom_type() 90 y += x; in der_length_custom_type() 94 if ((err = der_length_octet_string(size, &x)) != CRYPT_OK) { in der_length_custom_type() [all …]
|