| /optee_os/core/lib/libtomcrypt/src/pk/rsa/ |
| H A D | rsa_exptmod.c | 27 void *tmp, *tmpa, *tmpb; in rsa_exptmod() local 50 if ((err = mp_init_multi(&tmp, &tmpa, &tmpb, in rsa_exptmod() 56 if ((err = mp_read_unsigned_bin(tmp, (unsigned char *)in, (int)inlen)) != CRYPT_OK) in rsa_exptmod() 61 if (mp_cmp(key->N, tmp) == LTC_MP_LT) { in rsa_exptmod() 88 err = mp_mulmod( tmp, rnd, key->N, tmp); in rsa_exptmod() 105 …if ((err = mp_exptmod(tmp, key->d, key->N, tmp)) != CRYPT_OK) { goto … in rsa_exptmod() 108 …if ((err = mp_exptmod(tmp, key->dP, key->p, tmpa)) != CRYPT_OK) { goto … in rsa_exptmod() 111 …if ((err = mp_exptmod(tmp, key->dQ, key->q, tmpb)) != CRYPT_OK) { goto … in rsa_exptmod() 114 …if ((err = mp_sub(tmpa, tmpb, tmp)) != CRYPT_OK) { goto … in rsa_exptmod() 115 …if ((err = mp_mulmod(tmp, key->qP, key->p, tmp)) != CRYPT_OK) { goto … in rsa_exptmod() [all …]
|
| H A D | rsa_key.c | 20 void *tmp[10] = { 0 }; in s_mpi_shrink_multi() local 29 if (n >= sizeof(tmp)/sizeof(tmp[0])) { in s_mpi_shrink_multi() 34 if ((err = mp_init_copy(&tmp[n], *arg[n])) != CRYPT_OK) { in s_mpi_shrink_multi() 46 *arg[n] = tmp[n]; in s_mpi_shrink_multi() 54 (n >= sizeof(tmp)/sizeof(tmp[0]))) { in s_mpi_shrink_multi() 55 for (n = 0; n < sizeof(tmp)/sizeof(tmp[0]); ++n) { in s_mpi_shrink_multi() 56 if (tmp[n] != NULL) { in s_mpi_shrink_multi() 57 mp_clear(tmp[n]); in s_mpi_shrink_multi()
|
| H A D | rsa_decrypt_key.c | 36 unsigned char *tmp; in rsa_decrypt_key_ex() local 70 tmp = XMALLOC(inlen); in rsa_decrypt_key_ex() 71 if (tmp == NULL) { in rsa_decrypt_key_ex() 77 if ((err = ltc_mp.rsa_me(in, inlen, tmp, &x, PK_PRIVATE, key)) != CRYPT_OK) { in rsa_decrypt_key_ex() 78 XFREE(tmp); in rsa_decrypt_key_ex() 84 err = pkcs_1_oaep_decode(tmp, x, lparam, lparamlen, modulus_bitlen, mgf_hash, in rsa_decrypt_key_ex() 88 err = pkcs_1_v1_5_decode(tmp, x, LTC_PKCS_1_EME, modulus_bitlen, out, outlen, stat); in rsa_decrypt_key_ex() 91 XFREE(tmp); in rsa_decrypt_key_ex()
|
| H A D | rsa_export.c | 56 unsigned char* tmp = NULL; in rsa_export() local 60 tmp = XMALLOC(tmplen); in rsa_export() 62 if (tmp == NULL) { in rsa_export() 67 tmp = out; in rsa_export() 71 err = der_encode_sequence_multi(tmp, ptmplen, in rsa_export() 81 LTC_OID_RSA, tmp, tmplen, LTC_ASN1_NULL, NULL, 0); in rsa_export() 84 if (tmp != out) XFREE(tmp); in rsa_export()
|
| /optee_os/core/include/ |
| H A D | io.h | 138 const struct __unaligned_u64_t *tmp = p; in get_unaligned_be64() local 140 return TEE_U64_FROM_BIG_ENDIAN(tmp->x); in get_unaligned_be64() 145 struct __unaligned_u64_t *tmp = p; in put_unaligned_be64() local 147 tmp->x = TEE_U64_TO_BIG_ENDIAN(val); in put_unaligned_be64() 152 const struct __unaligned_u32_t *tmp = p; in get_unaligned_be32() local 154 return TEE_U32_FROM_BIG_ENDIAN(tmp->x); in get_unaligned_be32() 159 struct __unaligned_u32_t *tmp = p; in put_unaligned_be32() local 161 tmp->x = TEE_U32_TO_BIG_ENDIAN(val); in put_unaligned_be32() 166 const struct __unaligned_u16_t *tmp = p; in get_unaligned_be16() local 168 return TEE_U16_FROM_BIG_ENDIAN(tmp->x); in get_unaligned_be16() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/ciphers/ |
| H A D | rc2.c | 66 unsigned char tmp[128]; in rc2_setup_ex() local 85 tmp[i] = key[i] & 255; in rc2_setup_ex() 91 tmp[i] = permute[(tmp[i - 1] + tmp[i - keylen]) & 255]; in rc2_setup_ex() 98 tmp[128 - T8] = permute[tmp[128 - T8] & TM]; in rc2_setup_ex() 100 tmp[i] = permute[tmp[i + 1] ^ tmp[i + T8]]; in rc2_setup_ex() 105 xkey[i] = (unsigned)tmp[2*i] + ((unsigned)tmp[2*i+1] << 8); in rc2_setup_ex() 109 zeromem(tmp, sizeof(tmp)); in rc2_setup_ex() 347 unsigned char tmp[2][8]; in rc2_test() 350 zeromem(tmp, sizeof(tmp)); in rc2_test() 362 rc2_ecb_encrypt(tests[x].pt, tmp[0], &skey); in rc2_test() [all …]
|
| H A D | tea.c | 147 unsigned char tmp[2][8]; in tea_test() 166 tea_ecb_encrypt(ptct[0], tmp[0], &skey); in tea_test() 167 tea_ecb_decrypt(tmp[0], tmp[1], &skey); in tea_test() 169 if (compare_testvector(tmp[0], 8, ptct[1], 8, "TEA Encrypt", i) != 0 || in tea_test() 170 compare_testvector(tmp[1], 8, ptct[0], 8, "TEA Decrypt", i) != 0) { in tea_test() 175 for (y = 0; y < 8; y++) tmp[0][y] = 0; in tea_test() 176 for (y = 0; y < 1000; y++) tea_ecb_encrypt(tmp[0], tmp[0], &skey); in tea_test() 177 for (y = 0; y < 1000; y++) tea_ecb_decrypt(tmp[0], tmp[0], &skey); in tea_test() 178 for (y = 0; y < 8; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; in tea_test()
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/utf8/ |
| H A D | der_decode_utf8_string.c | 24 wchar_t tmp; in der_decode_utf8_string() local 62 tmp = in[x++]; in der_decode_utf8_string() 78 for (z = 0; (tmp & 0x80) && (z <= 4); z++, tmp = (tmp << 1) & 0xFF); in der_decode_utf8_string() 86 tmp >>= z; in der_decode_utf8_string() 100 tmp = (tmp << 6) | ((wchar_t)in[x++] & 0x3F); in der_decode_utf8_string() 104 out[y] = tmp; in der_decode_utf8_string()
|
| /optee_os/mk/ |
| H A D | checkconf.mk | 23 echo "#ifndef $${guard}" >$@.tmp; \ 24 echo "#define $${guard}" >>$@.tmp; \ 25 echo -n "$${cnf}" | sed 's/_nl_ */\n/g' >>$@.tmp; \ 26 echo "#endif" >>$@.tmp; \ 27 $(call mv-if-changed,$@.tmp,$@) 37 echo "# auto-generated TEE configuration file" >$@.tmp; \ 38 echo "# TEE version ${TEE_IMPL_VERSION}" >>$@.tmp; \ 39 echo -n "$${cnf}" | sed 's/_nl_ */\n/g' >>$@.tmp; \ 40 $(call mv-if-changed,$@.tmp,$@) 50 echo "# auto-generated TEE configuration file" >$@.tmp; \ [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/ocb3/ |
| H A D | ocb3_done.c | 21 unsigned char tmp[MAXBLOCKSIZE]; in ocb3_done() local 44 ocb3_int_xor_blocks(tmp, ocb->adata_buffer, ocb->aOffset_current, ocb->adata_buffer_bytes); in ocb3_done() 47 tmp[x] = 0x80 ^ ocb->aOffset_current[x]; in ocb3_done() 50 tmp[x] = 0x00 ^ ocb->aOffset_current[x]; in ocb3_done() 55 if ((err = cipher_descriptor[ocb->cipher]->ecb_encrypt(tmp, tmp, &ocb->key)) != CRYPT_OK) { in ocb3_done() 58 ocb3_int_xor_blocks(ocb->aSum_current, ocb->aSum_current, tmp, ocb->block_len); in ocb3_done() 65 ocb3_int_xor_blocks(tmp, ocb->tag_part, ocb->aSum_current, ocb->block_len); in ocb3_done() 68 for(x = 0; x < ocb->tag_len; x++) tag[x] = tmp[x]; in ocb3_done() 75 zeromem(tmp, MAXBLOCKSIZE); in ocb3_done()
|
| H A D | ocb3_decrypt.c | 22 unsigned char tmp[MAXBLOCKSIZE]; in ocb3_decrypt() local 51 ocb3_int_xor_blocks(tmp, ct_b, ocb->Offset_current, ocb->block_len); in ocb3_decrypt() 54 if ((err = cipher_descriptor[ocb->cipher]->ecb_decrypt(tmp, tmp, &ocb->key)) != CRYPT_OK) { in ocb3_decrypt() 59 ocb3_int_xor_blocks(pt_b, tmp, ocb->Offset_current, ocb->block_len); in ocb3_decrypt() 71 zeromem(tmp, sizeof(tmp)); in ocb3_decrypt()
|
| H A D | ocb3_encrypt.c | 22 unsigned char tmp[MAXBLOCKSIZE]; in ocb3_encrypt() local 51 ocb3_int_xor_blocks(tmp, pt_b, ocb->Offset_current, ocb->block_len); in ocb3_encrypt() 54 if ((err = cipher_descriptor[ocb->cipher]->ecb_encrypt(tmp, tmp, &ocb->key)) != CRYPT_OK) { in ocb3_encrypt() 59 ocb3_int_xor_blocks(ct_b, tmp, ocb->Offset_current, ocb->block_len); in ocb3_encrypt() 71 zeromem(tmp, sizeof(tmp)); in ocb3_encrypt()
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/general/ |
| H A D | der_encode_asn1_identifier.c | 20 ulong64 tmp; in der_encode_asn1_identifier() local 64 tmp = id->tag; in der_encode_asn1_identifier() 67 tmp >>= 7; in der_encode_asn1_identifier() 68 } while (tmp); in der_encode_asn1_identifier() 75 for (tmp = 1; tmp <= tag_len; ++tmp) { in der_encode_asn1_identifier() 76 out[tmp] = ((id->tag >> (7 * (tag_len - tmp))) & 0x7f) | 0x80; in der_encode_asn1_identifier()
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/integer/ |
| H A D | der_encode_integer.c | 78 void *tmp; in der_encode_integer() local 81 if (mp_init(&tmp) != CRYPT_OK) { in der_encode_integer() 89 if (mp_2expt(tmp, y) != CRYPT_OK || mp_add(tmp, num, tmp) != CRYPT_OK) { in der_encode_integer() 90 mp_clear(tmp); in der_encode_integer() 93 if ((err = mp_to_unsigned_bin(tmp, out)) != CRYPT_OK) { in der_encode_integer() 94 mp_clear(tmp); in der_encode_integer() 97 mp_clear(tmp); in der_encode_integer()
|
| H A D | der_decode_integer.c | 52 void *tmp; in der_decode_integer() local 53 if (mp_init(&tmp) != CRYPT_OK) { in der_decode_integer() 57 if (mp_2expt(tmp, mp_count_bits(num)) != CRYPT_OK || mp_sub(num, tmp, num) != CRYPT_OK) { in der_decode_integer() 58 mp_clear(tmp); in der_decode_integer() 61 mp_clear(tmp); in der_decode_integer()
|
| /optee_os/core/lib/libtomcrypt/src/ciphers/aes/ |
| H A D | aes_desc.c | 186 unsigned char tmp[2][16]; in AES_TEST() 198 AES_ENC(tests[i].pt, tmp[0], &key); in AES_TEST() 199 if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES Encrypt", i)) { in AES_TEST() 203 AES_DEC(tmp[0], tmp[1], &key); in AES_TEST() 204 if (compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES Decrypt", i)) { in AES_TEST() 209 for (y = 0; y < 16; y++) tmp[0][y] = 0; in AES_TEST() 210 for (y = 0; y < 1000; y++) AES_ENC(tmp[0], tmp[0], &key); in AES_TEST() 211 for (y = 0; y < 1000; y++) AES_DEC(tmp[0], tmp[0], &key); in AES_TEST() 212 for (y = 0; y < 16; y++) if (tmp[0][y] != 0) return CRYPT_FAIL_TESTVECTOR; in AES_TEST()
|
| /optee_os/core/lib/libtomcrypt/src/prngs/ |
| H A D | fortuna.c | 110 unsigned char tmp[MAXBLOCKSIZE]; in s_fortuna_reseed() local 129 sha256_done(&md, tmp); in s_fortuna_reseed() 138 if ((err = sha256_done(&prng->u.fortuna.pool[x], tmp)) != CRYPT_OK) { in s_fortuna_reseed() 139 sha256_done(&md, tmp); in s_fortuna_reseed() 143 if ((err = sha256_process(&md, tmp, 32)) != CRYPT_OK) { in s_fortuna_reseed() 144 sha256_done(&md, tmp); in s_fortuna_reseed() 149 sha256_done(&md, tmp); in s_fortuna_reseed() 178 zeromem(tmp, sizeof(tmp)); in s_fortuna_reseed() 195 unsigned char tmp[MAXBLOCKSIZE]; in fortuna_update_seed() local 202 sha256_done(&md, tmp); in fortuna_update_seed() [all …]
|
| /optee_os/core/lib/zlib/ |
| H A D | adler32.c | 30 unsigned long tmp = a >> 16; \ 32 a += (tmp << 4) - tmp; \ 46 z_off64_t tmp = a >> 32; \ 48 a += (tmp << 8) - (tmp << 5) + tmp; \ 49 tmp = a >> 16; \ 51 a += (tmp << 4) - tmp; \ 52 tmp = a >> 16; \ 54 a += (tmp << 4) - tmp; \
|
| /optee_os/core/arch/arm/kernel/ |
| H A D | unwind_arm64.c | 53 vaddr_t *tmp = NULL; in unw_get_kernel_stack() local 63 tmp = unw_grow(addr, &size, (n + 1) * sizeof(vaddr_t)); in unw_get_kernel_stack() 64 if (!tmp) in unw_get_kernel_stack() 66 addr = tmp; in unw_get_kernel_stack() 72 tmp = unw_grow(addr, &size, (n + 1) * sizeof(vaddr_t)); in unw_get_kernel_stack() 73 if (!tmp) in unw_get_kernel_stack() 75 addr = tmp; in unw_get_kernel_stack()
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/oid/ |
| H A D | pk_oid_str.c | 49 char tmp[256] = { 0 }; in pk_oid_num_to_str() local 58 tmp[k] = '0'; in pk_oid_num_to_str() 59 if (++k >= sizeof(tmp)) return CRYPT_ERROR; in pk_oid_num_to_str() 63 tmp[k] = '0' + (j % 10); in pk_oid_num_to_str() 64 if (++k >= sizeof(tmp)) return CRYPT_ERROR; in pk_oid_num_to_str() 69 tmp[k] = '.'; in pk_oid_num_to_str() 70 if (++k >= sizeof(tmp)) return CRYPT_ERROR; in pk_oid_num_to_str() 78 for (j = 0; j < k; j++) OID[j] = tmp[k - j - 1]; in pk_oid_num_to_str()
|
| /optee_os/core/arch/arm/plat-marvell/armada7k8k/ |
| H A D | hal_sec_perf.c | 142 uint32_t tmp; in _find_valid_range() local 145 tmp = io_read32(MCU_TZ_RANGE_LOW_REG(i)); in _find_valid_range() 146 if (!TZ_IS_VALID(tmp)) in _find_valid_range() 211 uint32_t tmp; in _dump_range() local 219 tmp = io_read32(MCU_TZ_RANGE_LOW_REG(i)); in _dump_range() 221 if (TZ_IS_VALID(tmp)) { in _dump_range() 222 TZ_GET_PERM(tmp, perm_read); in _dump_range() 223 TZ_GET_AREA_LEN_CODE(tmp, sizecode_read); in _dump_range() 224 TZ_GET_START_ADDR_L(tmp, addr_read); in _dump_range() 228 i, MCU_TZ_RANGE_LOW_REG(i), tmp); in _dump_range() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/stream/rc4/ |
| H A D | rc4_stream.c | 17 unsigned char tmp, *s; in rc4_stream_setup() local 35 tmp = s[x]; s[x] = s[y]; s[y] = tmp; in rc4_stream_setup() 53 unsigned char x, y, *s, tmp; in rc4_stream_crypt() local 65 tmp = s[x]; s[x] = s[y]; s[y] = tmp; in rc4_stream_crypt() 66 tmp = (s[x] + s[y]) & 255; in rc4_stream_crypt() 67 *out++ = *in++ ^ s[tmp]; in rc4_stream_crypt()
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | ecp.c | 1207 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_mpi(&tmp, &grp->P, (X))); \ 1208 MBEDTLS_MPI_CHK(mbedtls_mpi_safe_cond_assign((X), &tmp, \ 1466 mbedtls_mpi tmp; in ecp_safe_invert_jac() local 1467 mbedtls_mpi_init(&tmp); in ecp_safe_invert_jac() 1472 mbedtls_mpi_free(&tmp); in ecp_safe_invert_jac() 1492 mbedtls_mpi tmp[4]) in ecp_double_jac() 1512 MPI_ECP_SQR(&tmp[1], &P->Z); in ecp_double_jac() 1513 MPI_ECP_ADD(&tmp[2], &P->X, &tmp[1]); in ecp_double_jac() 1514 MPI_ECP_SUB(&tmp[3], &P->X, &tmp[1]); in ecp_double_jac() 1515 MPI_ECP_MUL(&tmp[1], &tmp[2], &tmp[3]); in ecp_double_jac() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/dh/ |
| H A D | dh_shared_secret.c | 19 void *tmp; in dh_shared_secret() local 38 if ((err = mp_init(&tmp)) != CRYPT_OK) { in dh_shared_secret() 48 if ((err = mp_exptmod(public_key->y, private_key->x, private_key->prime, tmp)) != CRYPT_OK) { in dh_shared_secret() 53 x = (unsigned long)mp_unsigned_bin_size(tmp); in dh_shared_secret() 59 if ((err = mp_to_unsigned_bin(tmp, out)) != CRYPT_OK) { in dh_shared_secret() 66 mp_clear(tmp); in dh_shared_secret()
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | des2_key.h | 7 uint8_t *tmp) in get_des2_key() argument 17 memcpy(tmp, *key, 16); in get_des2_key() 18 memcpy(tmp + 16, *key, 8); in get_des2_key() 19 *key = tmp; in get_des2_key()
|