/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/general/ |
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() 49 out[x++] = 0x81; in der_encode_asn1_length() 52 out[x++] = 0x82; in der_encode_asn1_length() 56 out[x++] = 0x83; in der_encode_asn1_length() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/headers/ |
A D | tomcrypt_macros.h | 243 #define ROR(x,n) _rotr(x,n) argument 244 #define ROL(x,n) _rotl(x,n) argument 245 #define RORc(x,n) ROR(x,n) argument 246 #define ROLc(x,n) ROL(x,n) argument 253 #define ROLc(x,n) ROL(x,n) argument 254 #define RORc(x,n) ROR(x,n) argument 365 #define ROR64c(x,n) ROR64(x,n) argument 366 #define ROL64c(x,n) ROL64(x,n) argument 372 #define ROR64c(x,n) ROR64(x,n) argument 440 #define MAX(x, y) ( ((x)>(y))?(x):(y) ) argument [all …]
|
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-3.20.0/core/lib/libtomcrypt/src/modes/lrw/ |
A D | lrw_process.c | 42 for (x = 15; x >= 0; x--) { in lrw_process() 43 lrw->IV[x] = (lrw->IV[x] + 1) & 255; in lrw_process() 52 for (; x < 16; x++) { 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() 74 ct[x] = pt[x] ^ prod[x]; in lrw_process() 91 for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { in lrw_process() 95 for (x = 0; x < 16; x++) { in lrw_process() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/ciphers/aes/ |
A D | aes_tab.c | 300 #define Te0(x) TE0[x] argument 301 #define Te1(x) RORc(TE0[x], 8) argument 305 #define Td0(x) TD0[x] argument 317 #define Te0(x) TE0[x] argument 318 #define Te1(x) TE1[x] argument 319 #define Te2(x) TE2[x] argument 320 #define Te3(x) TE3[x] argument 322 #define Td0(x) TD0[x] argument 323 #define Td1(x) TD1[x] argument 324 #define Td2(x) TD2[x] argument [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/ccm/ |
A D | ccm_test.c | 124 for (x = 0; x < (sizeof(tests)/sizeof(tests[0])); x++) { in ccm_test() 135 tests[x].nonce, tests[x].noncelen, in ccm_test() 154 …if ((err = ccm_init(&ccm, idx, tests[x].key, 16, tests[x].ptlen, tests[x].taglen, tests[x].headerl… in ccm_test() 171 … if (compare_testvector(buf, tests[x].ptlen, tests[x].ct, tests[x].ptlen, "CCM encrypt data", x)) { in ccm_test() 174 if (compare_testvector(tag, taglen, tests[x].tag, tests[x].taglen, "CCM encrypt tag", x)) { in ccm_test() 179 XMEMCPY(tag3, tests[x].tag, tests[x].taglen); in ccm_test() 192 …if ((err = ccm_init(&ccm, idx, tests[x].key, 16, tests[x].ptlen, tests[x].taglen, tests[x].headerl… in ccm_test() 210 …if (compare_testvector(buf2, tests[x].ptlen, tests[x].pt, tests[x].ptlen, "CCM decrypt data", x)) { in ccm_test() 215 XMEMCPY(tag3, tests[x].tag, tests[x].taglen); in ccm_test() 228 … if (compare_testvector(buf2, tests[x].ptlen, zero, tests[x].ptlen, "CCM decrypt wrong tag", x)) { in ccm_test() [all …]
|
/optee_os-3.20.0/core/lib/libfdt/include/ |
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)) 44 return (FDT_FORCE fdt16_t)CPU_TO_FDT16(x); in cpu_to_fdt16() 53 return (FDT_FORCE fdt32_t)CPU_TO_FDT32(x); in cpu_to_fdt32() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/utf8/ |
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() 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() 51 y = *outlen - x; in der_encode_utf8_string() 55 x += y; in der_encode_utf8_string() 64 …case 4: out[x++] = 0xF0 | ((in[y] >> 18) & 0x07); out[x++] = 0x80 | ((in[y] >> 12) & 0x3F); out[x+… in der_encode_utf8_string() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/generalizedtime/ |
A D | der_decode_generalizedtime.c | 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; \ 66 for (x = 0; x < in[1]; x++) { in der_decode_generalizedtime() 95 x = 0; in der_decode_generalizedtime() 111 x++; in der_decode_generalizedtime() 112 while (buf[x] >= '0' && buf[x] <= '9') { in der_decode_generalizedtime() 118 x++; in der_decode_generalizedtime() [all …]
|
/optee_os-3.20.0/core/include/drivers/ |
A D | ls_dspi.h | 16 #define DSPI_CTAR_FMSZ(x) (((x) & 0x0F) << 27) /* Frame Size [1-4] */ argument 20 #define DSPI_CTAR_PCS_SCK(x) (((x) & 0x03) << 22) /* PCSSCK [8-9] */ argument 21 #define DSPI_CTAR_PA_SCK(x) (((x) & 0x03) << 20) /* PASC [10-11] */ argument 22 #define DSPI_CTAR_P_DT(x) (((x) & 0x03) << 18) /* PDT [12-13] */ argument 23 #define DSPI_CTAR_BRP(x) \ argument 24 (((x) & 0x03) << 16) /* Baud Rate Prescaler [14-15] */ 25 #define DSPI_CTAR_CS_SCK(x) (((x) & 0x0F) << 12) /* CSSCK [16-19] */ argument 26 #define DSPI_CTAR_A_SCK(x) (((x) & 0x0F) << 8) /* ASC [20-23] */ argument 27 #define DSPI_CTAR_A_DT(x) (((x) & 0x0F) << 4) /* DT [24-27] */ argument 28 #define DSPI_CTAR_BR(x) ((x) & 0x0F) /* Baud Rate Scaler [28-31] */ argument
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/eax/ |
A D | eax_test.c | 208 int err, x, idx, res; in eax_test() 219 for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { in eax_test() 221 if ((err = eax_encrypt_authenticate_memory(idx, tests[x].key, tests[x].keylen, in eax_test() 222 tests[x].nonce, tests[x].noncelen, tests[x].header, tests[x].headerlen, in eax_test() 223 tests[x].plaintext, tests[x].msglen, outct, outtag, &len)) != CRYPT_OK) { in eax_test() 226 if (compare_testvector(outtag, len, tests[x].tag, len, "EAX Tag", x) || in eax_test() 227 … compare_testvector(outct, tests[x].msglen, tests[x].ciphertext, tests[x].msglen, "EAX CT", x)) { in eax_test() 232 if ((err = eax_decrypt_verify_memory(idx, tests[x].key, tests[x].keylen, in eax_test() 233 tests[x].nonce, tests[x].noncelen, tests[x].header, tests[x].headerlen, in eax_test() 234 outct, tests[x].msglen, outct, outtag, len, &res)) != CRYPT_OK) { in eax_test() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/printable_string/ |
A D | der_length_printable_string.c | 93 int x; in der_printable_char_encode() local 94 for (x = 0; x < (int)(sizeof(printable_table)/sizeof(printable_table[0])); x++) { in der_printable_char_encode() 95 if (printable_table[x].code == c) { in der_printable_char_encode() 96 return printable_table[x].value; in der_printable_char_encode() 104 int x; in der_printable_value_decode() local 105 for (x = 0; x < (int)(sizeof(printable_table)/sizeof(printable_table[0])); x++) { in der_printable_value_decode() 106 if (printable_table[x].value == v) { in der_printable_value_decode() 107 return printable_table[x].code; in der_printable_value_decode() 122 unsigned long x; in der_length_printable_string() local 129 for (x = 0; x < noctets; x++) { in der_length_printable_string() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/teletex_string/ |
A D | der_length_teletex_string.c | 137 int x; in der_teletex_char_encode() local 138 for (x = 0; x < (int)(sizeof(teletex_table)/sizeof(teletex_table[0])); x++) { in der_teletex_char_encode() 139 if (teletex_table[x].code == c) { in der_teletex_char_encode() 140 return teletex_table[x].value; in der_teletex_char_encode() 148 int x; in der_teletex_value_decode() local 149 for (x = 0; x < (int)(sizeof(teletex_table)/sizeof(teletex_table[0])); x++) { in der_teletex_value_decode() 150 if (teletex_table[x].value == v) { in der_teletex_value_decode() 151 return teletex_table[x].code; in der_teletex_value_decode() 166 unsigned long x; in der_length_teletex_string() local 173 for (x = 0; x < noctets; x++) { in der_length_teletex_string() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/ia5/ |
A D | der_length_ia5_string.c | 121 int x; in der_ia5_char_encode() local 122 for (x = 0; x < (int)(sizeof(ia5_table)/sizeof(ia5_table[0])); x++) { in der_ia5_char_encode() 123 if (ia5_table[x].code == c) { in der_ia5_char_encode() 124 return ia5_table[x].value; in der_ia5_char_encode() 132 int x; in der_ia5_value_decode() local 133 for (x = 0; x < (int)(sizeof(ia5_table)/sizeof(ia5_table[0])); x++) { in der_ia5_value_decode() 134 if (ia5_table[x].value == v) { in der_ia5_value_decode() 135 return ia5_table[x].code; in der_ia5_value_decode() 150 unsigned long x; in der_length_ia5_string() local 157 for (x = 0; x < noctets; x++) { in der_length_ia5_string() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/ocb/ |
A D | s_ocb_done.c | 74 for (x = 0; x < ocb->block_len; x++) { in s_ocb_done() 75 X[x] ^= ocb->Lr[x]; in s_ocb_done() 86 for (x = 0; x < (int)ptlen; x++) { in s_ocb_done() 87 ocb->checksum[x] ^= ct[x]; in s_ocb_done() 92 for (x = 0; x < (int)ptlen; x++) { in s_ocb_done() 93 ct[x] = pt[x] ^ Y[x]; in s_ocb_done() 99 for (x = 0; x < (int)ptlen; x++) { in s_ocb_done() 105 for (x = 0; x < ocb->block_len; x++) { in s_ocb_done() 106 ocb->checksum[x] ^= Y[x] ^ Z[x]; in s_ocb_done() 116 for (x = 0; x < ocb->block_len && x < (int)*taglen; x++) { in s_ocb_done() [all …]
|
A D | ocb_test.c | 159 int err, x, idx, res; in ocb_test() 170 for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { in ocb_test() 172 if ((err = ocb_encrypt_authenticate_memory(idx, tests[x].key, 16, in ocb_test() 173 tests[x].nonce, tests[x].pt, tests[x].ptlen, outct, outtag, &len)) != CRYPT_OK) { in ocb_test() 177 if (compare_testvector(outtag, len, tests[x].tag, sizeof(tests[x].tag), "OCB Tag", x) || in ocb_test() 178 compare_testvector(outct, tests[x].ptlen, tests[x].ct, tests[x].ptlen, "OCB CT", x)) { in ocb_test() 182 … if ((err = ocb_decrypt_verify_memory(idx, tests[x].key, 16, tests[x].nonce, outct, tests[x].ptlen, in ocb_test() 183 outct, tests[x].tag, len, &res)) != CRYPT_OK) { in ocb_test() 186 …if ((res != 1) || compare_testvector(outct, tests[x].ptlen, tests[x].pt, tests[x].ptlen, "OCB", x)… in ocb_test()
|
A D | ocb_init.c | 42 int poly, x, y, m, err; in ocb_init() local 61 if (poly == x) { in ocb_init() 80 for (x = 0; x < ocb->block_len; x++) { in ocb_init() 81 ocb->R[x] = ocb->L[x] ^ nonce[x]; in ocb_init() 89 for (x = 1; x < 32; x++) { in ocb_init() 92 ocb->Ls[x][y] = ((ocb->Ls[x-1][y] << 1) | (ocb->Ls[x-1][y+1] >> 7)) & 255; in ocb_init() 94 ocb->Ls[x][ocb->block_len-1] = (ocb->Ls[x-1][ocb->block_len-1] << 1) & 255; in ocb_init() 107 for (x = ocb->block_len - 1; x > 0; x--) { in ocb_init() 108 ocb->Lr[x] = ((ocb->L[x] >> 1) | (ocb->L[x-1] << 7)) & 255; in ocb_init() 113 for (x = 0; x < ocb->block_len; x++) { in ocb_init() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/set/ |
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() 34 for (x = A->size; x < B->size; x++) { in s_qsort_helper() 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() 102 x = 0; in der_encode_setof() 125 ++x; in der_encode_setof() 135 for (y = (unsigned long)hdrlen, x = 0; x < inlen; x++) { in der_encode_setof() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/stream/salsa20/ |
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)); 76 LOAD32L(x[ 1], key + 0); in xsalsa20_setup() 77 LOAD32L(x[ 2], key + 4); in xsalsa20_setup() 78 LOAD32L(x[ 3], key + 8); in xsalsa20_setup() 79 LOAD32L(x[ 4], key + 12); in xsalsa20_setup() 80 LOAD32L(x[11], key + 16); in xsalsa20_setup() 81 LOAD32L(x[12], key + 20); in xsalsa20_setup() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/mac/pmac/ |
A D | pmac_done.c | 14 int err, x; in pmac_done() local 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-3.20.0/core/lib/libtomcrypt/src/stream/rc4/ |
A D | rc4_stream.c | 18 int x, y; in rc4_stream_setup() local 26 for (x = 0; x < 256; x++) { in rc4_stream_setup() 27 s[x] = x; in rc4_stream_setup() 30 for (j = x = y = 0; x < 256; x++) { in rc4_stream_setup() 35 tmp = s[x]; s[x] = s[y]; s[y] = tmp; in rc4_stream_setup() 37 st->x = 0; in rc4_stream_setup() 59 x = st->x; in rc4_stream_crypt() 63 x = (x + 1) & 255; in rc4_stream_crypt() 64 y = (y + s[x]) & 255; in rc4_stream_crypt() 65 tmp = s[x]; s[x] = s[y]; s[y] = tmp; in rc4_stream_crypt() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/ocb3/ |
A D | ocb3_int_xor_blocks.c | 21 int x; in ocb3_int_xor_blocks() local 23 for (x = 0; x < (int)block_len; x++) out[x] ^= block_b[x]; in ocb3_int_xor_blocks() 26 for (x = 0; x < (int)block_len; x++) out[x] = block_a[x] ^ block_b[x]; in ocb3_int_xor_blocks()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/sequence/ |
A D | der_length_sequence.c | 55 y += x; in der_length_sequence_ex() 62 y += x; in der_length_sequence_ex() 69 y += x; in der_length_sequence_ex() 77 y += x; in der_length_sequence_ex() 84 y += x; in der_length_sequence_ex() 95 y += x; in der_length_sequence_ex() 102 y += x; in der_length_sequence_ex() 109 y += x; in der_length_sequence_ex() 116 y += x; in der_length_sequence_ex() 123 y += x; in der_length_sequence_ex() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/misc/crypt/ |
A D | crypt_register_cipher.c | 17 int x; in register_cipher() local 23 for (x = 0; x < TAB_SIZE; x++) { in register_cipher() 24 if (cipher_descriptor[x] != NULL && cipher_descriptor[x]->ID == cipher->ID) { in register_cipher() 26 return x; in register_cipher() 31 for (x = 0; x < TAB_SIZE; x++) { in register_cipher() 32 if (cipher_descriptor[x] == NULL) { in register_cipher() 33 cipher_descriptor[x] = cipher; in register_cipher() 35 return x; in register_cipher()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/asn1/der/utctime/ |
A D | der_decode_utctime.c | 14 switch (x) { in s_char_to_int() 30 y = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \ 32 x += 2; 45 unsigned long x; in der_decode_utctime() local 58 for (x = 0; x < in[1]; x++) { in der_decode_utctime() 63 buf[x] = y; in der_decode_utctime() 65 *inlen = 2 + x; in der_decode_utctime() 79 x = 0; in der_decode_utctime() 90 if (buf[x] == 'Z') { in der_decode_utctime() 93 if (buf[x] == '+' || buf[x] == '-') { in der_decode_utctime() [all …]
|