| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | bn_mul.h | 4 * \brief Multi-precision integer library 8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 16 * . IA-32 (386+) . AMD64 / EM64T 17 * . IA-32 (SSE2) . Motorola 68000 18 * . PowerPC, 32-bit . MicroBlaze 19 * . PowerPC, 64-bit . TriCore 51 #else /* 64-bits */ 71 /* *INDENT-OFF* */ 74 /* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */ 86 * instead of using a fixed register, was implemented on x86/x86-64 [all …]
|
| H A D | bignum_mod_raw.c | 2 * Low-level modular bignum functions 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 28 const mbedtls_mpi_mod_modulus *N, 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() 36 const mbedtls_mpi_mod_modulus *N, 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() 43 const mbedtls_mpi_mod_modulus *N, 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() [all …]
|
| H A D | bignum_mod.c | 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 26 const mbedtls_mpi_mod_modulus *N, in mbedtls_mpi_mod_residue_setup() argument 30 if (p_limbs != N->limbs || !mbedtls_mpi_core_lt_ct(p, N->p, N->limbs)) { in mbedtls_mpi_mod_residue_setup() 34 r->limbs = N->limbs; in mbedtls_mpi_mod_residue_setup() 35 r->p = p; in mbedtls_mpi_mod_residue_setup() 46 r->limbs = 0; in mbedtls_mpi_mod_residue_release() 47 r->p = NULL; in mbedtls_mpi_mod_residue_release() 50 void mbedtls_mpi_mod_modulus_init(mbedtls_mpi_mod_modulus *N) in mbedtls_mpi_mod_modulus_init() argument 52 if (N == NULL) { in mbedtls_mpi_mod_modulus_init() 56 N->p = NULL; in mbedtls_mpi_mod_modulus_init() [all …]
|
| H A D | aesni.c | 2 * AES-NI support functions 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 …* [AES-WP] https://www.intel.com/content/www/us/en/developer/articles/tool/intel-advanced-encrypti… 10 …CLMUL-WP] https://www.intel.com/content/www/us/en/develop/download/intel-carry-less-multiplication… 47 * AES-NI support detection routine 53 * https://github.com/Mbed-TLS/mbedtls/issues/9840 in mbedtls_aesni_has_support() 58 * (See example 8-1 in Sewell et al., "x86-TSO: A Rigorous and Usable in mbedtls_aesni_has_support() 75 asm ("movl $1, %%eax \n\t" in mbedtls_aesni_has_support() 76 "cpuid \n\t" in mbedtls_aesni_has_support() 91 * AES-NI AES-ECB block en(de)cryption [all …]
|
| H A D | padlock.c | 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 29 static int flags = -1; in mbedtls_padlock_has_support() 32 if (flags == -1) { in mbedtls_padlock_has_support() 33 asm ("movl %%ebx, %0 \n\t" in mbedtls_padlock_has_support() 34 "movl $0xC0000000, %%eax \n\t" in mbedtls_padlock_has_support() 35 "cpuid \n\t" in mbedtls_padlock_has_support() 36 "cmpl $0xC0000001, %%eax \n\t" in mbedtls_padlock_has_support() 37 "movl $0, %%edx \n\t" in mbedtls_padlock_has_support() 38 "jb 1f \n\t" in mbedtls_padlock_has_support() 39 "movl $0xC0000001, %%eax \n\t" in mbedtls_padlock_has_support() [all …]
|
| H A D | bignum_mod_raw.h | 2 * Low-level modular bignum functions 4 * This interface should only be used by the higher-level modular bignum 6 * modules should use the high-level modular bignum interface (bignum_mod.h) 9 * This is a low-level interface to operations on integers modulo which 11 * the wrong size. The functions in bignum_mod.h provide a higher-level 17 * - **Modulus parameters**: the modulus is passed as a pointer to a structure 21 * named \c N and is usually input-only. 22 * - **Bignum parameters**: Bignums are passed as pointers to an array of 24 * - Bignum parameters called \c A, \c B, ... are inputs, and are not 26 * - Bignum parameters called \c X, \c Y are outputs or input-output. [all …]
|
| H A D | bignum_mod.h | 9 * - **Modulus parameters**: the modulus is passed as a pointer to a structure 13 * named \c N and is usually input-only. Functions which take a parameter 15 * - **Bignum parameters**: Bignums are passed as pointers to an array of 18 * associated with the modulus \c N. Unless otherwise specified: 19 * - Bignum parameters called \c A, \c B, ... are inputs and are not 22 * - Bignum parameters called \c X, \c Y, ... are outputs or input-output. 23 * The initial bignum value of output-only parameters is ignored, but 24 * they must be set up and associated with the modulus \c N. Some 25 * functions (typically constant-flow) require that the limbs in an 27 * - Bignum parameters called \c p are inputs used to set up a modulus or [all …]
|
| H A D | bignum.c | 2 * Multi-precision integer library 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 * The following sources were referenced in the design of this Multi-precision 12 * [1] Handbook of Applied Cryptography - 1997 15 * [2] Multi-Precision Math 19 * [3] GNU Multi-Precision Arithmetic Library 48 * (MPI sign is the field s in mbedtls_mpi. It is unsigned short and only 1 and -1 are valid 54 return (signed short) mbedtls_ct_uint_if(cond, sign1 + 1, sign2 + 1) - 1; in mbedtls_ct_mpi_sign_if() 66 if (X->n != Y->n) { in mbedtls_mpi_lt_mpi_ct() 71 * Set N_is_negative to MBEDTLS_CT_FALSE if N >= 0, MBEDTLS_CT_TRUE if N < 0. in mbedtls_mpi_lt_mpi_ct() [all …]
|
| H A D | psa_crypto_core_common.h | 8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 18 * (`p + n` has undefined behavior when `p` is null, even when `n == 0`. 22 * \param p Pointer to a buffer of at least n bytes. 23 * This may be \p NULL if \p n is zero. 24 * \param n An offset in bytes. 25 * \return Pointer to offset \p n in the buffer \p p. 27 * buffer is at least \p n + 1. 30 unsigned char *p, size_t n) in psa_crypto_buffer_offset() argument 32 return p == NULL ? NULL : p + n; in psa_crypto_buffer_offset() 35 /** Return an offset into a read-only buffer. [all …]
|
| H A D | constant_time_impl.h | 2 * Constant-time functions 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 28 * This appears to behave as if the declaration-without-definition was not present 29 * (except for warnings if gcc -Wredundant-decls or similar is used). 31 * Disable -Wredundant-decls so that gcc does not warn about this. This is re-enabled 36 #pragma GCC diagnostic ignored "-Wredundant-decls" 39 /* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */ 58 * Core const-time primitives 109 * syntax afterwards - otherwise old versions of gcc seem to apply 114 #define RESTORE_ASM_SYNTAX ".syntax divided \n\t" [all …]
|
| /optee_os/core/lib/libtomcrypt/src/misc/crypt/ |
| H A D | crypt.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 13 "LibTomCrypt " SCRYPT " (www.libtom.net)\n" 14 "LibTomCrypt is public domain software.\n" 16 "Built on " __DATE__ " at " __TIME__ "\n" 18 "\n\nEndianness: " 28 " (32-bit words)\n" 30 " (64-bit words)\n" 32 " (no wordsize defined)\n" 36 "enabled\n" [all …]
|
| /optee_os/core/lib/scmi-server/ |
| H A D | conf.mk | 1 # Configuration switches for SCP-firmware: 3 # CFG_SCMI_SCPFW Boolean switch, embeds SCP-firmware SCMI stack when enabled. 4 # CFG_SCMI_SCPFW_PRODUCT Name of the SCP-firmware product to build. 5 # CFG_SCP_FIRMWARE Directory path to SCP-firmware source tree 6 # CFG_SCPFW_LOG_LEVEL SCP-firmware log level 7 # CFG_SCPFW_MOD_x Boolean switch, embeds SCP-firmware module x when enabled 11 # Boolean y|n switches for module features 21 include core/lib/scmi-server/conf-optee-$(CFG_SCMI_SCPFW_PRODUCT).mk 23 # SCP-fmw log level: 0 trace/verbose, 1 info, 2 warning, 3 error, 4 critical 34 CFG_SCPFW_MOD_CLOCK ?= n [all …]
|
| /optee_os/lib/libutils/compiler-rt/lib/builtins/ |
| H A D | int_div_impl.inc | 1 //===-- int_div_impl.inc - Integer division ---------------------*- C++ -*-===// 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 //===----------------------------------------------------------------------===// 11 //===----------------------------------------------------------------------===// 15 // Adapted from Figure 3-40 of The PowerPC Compiler Writer's Guide 16 static __inline fixuint_t __udivXi3(fixuint_t n, fixuint_t d) { 17 const unsigned N = sizeof(fixuint_t) * CHAR_BIT; 19 unsigned sr = (d ? clz(d) : N) - (n ? clz(n) : N); 20 // 0 <= sr <= N - 1 or sr is very large. 21 if (sr > N - 1) // n < d [all …]
|
| /optee_os/core/arch/arm/plat-sam/ |
| H A D | tz_matrix.h | 1 /* SPDX-License-Identifier: BSD-Source-Code */ 10 * - Redistributions of source code must retain the above copyright notice, 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 30 #define MATRIX_MCFG(n) (0x0000 + (n) * 4) /* Master Configuration Register */ argument 31 #define MATRIX_SCFG(n) (0x0040 + (n) * 4) /* Slave Configuration Register */ argument 32 #define MATRIX_PRAS(n) (0x0080 + (n) * 8) /* Priority Register A for Slave */ argument 33 #define MATRIX_PRBS(n) (0x0084 + (n) * 8) /* Priority Register B for Slave */ argument 41 /* Master n Error Address Register */ 42 #define MATRIX_MEAR(n) (0x0160 + (n) * 4) argument 47 /* Security Slave n Register */ [all …]
|
| /optee_os/lib/libutee/ |
| H A D | user_ta_entry_compat.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2014, STMicroelectronics International N.V. 12 size_t n = 0; in to_gp11_param() local 14 for (n = 0; n < TEE_NUM_PARAMS; n++) { in to_gp11_param() 15 switch (TEE_PARAM_TYPE_GET(pt, n)) { in to_gp11_param() 19 gp11_params[n].value.a = params[n].value.a; in to_gp11_param() 20 gp11_params[n].value.b = params[n].value.b; in to_gp11_param() 25 gp11_params[n].memref.buffer = params[n].memref.buffer; in to_gp11_param() 26 gp11_params[n].memref.size = params[n].memref.size; in to_gp11_param() 38 size_t n = 0; in from_gp11_param() local [all …]
|
| H A D | tee_api.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2014, STMicroelectronics International N.V. 16 * return a known non-NULL invalid pointer when the 34 /* System API - Internal Client API */ 39 size_t n = 0; in copy_param() local 43 up->types = param_types; in copy_param() 44 for (n = 0; n < TEE_NUM_PARAMS; n++) { in copy_param() 45 switch (TEE_PARAM_TYPE_GET(up->types, n)) { in copy_param() 48 a = params[n].value.a; in copy_param() 49 b = params[n].value.b; in copy_param() [all …]
|
| /optee_os/core/kernel/ |
| H A D | thread.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2016-2022, Linaro Limited 4 * Copyright (c) 2014, STMicroelectronics International N.V. 5 * Copyright (c) 2020-2021, Arm Limited 47 * stack_xxx[n] "hard" top "soft" top bottom 64 #define GET_STACK_BOTTOM(stack, n) ((vaddr_t)&(stack)[n] + sizeof(stack[n]) - \ argument 68 #define GET_STACK_BOTTOM(stack, n) 0 argument 73 #define GET_STACK_THREAD_BOTTOM(n) 0 argument 76 #define GET_STACK_THREAD_BOTTOM(n) \ argument 77 ((vaddr_t)&stack_thread[n] + sizeof(stack_thread[n]) - \ [all …]
|
| H A D | handle.c | 1 // SPDX-License-Identifier: BSD-2-Clause 22 size_t n = 0; in handle_db_destroy() local 24 for (n = 0; n < db->max_ptrs; n++) in handle_db_destroy() 25 if (db->ptrs[n]) in handle_db_destroy() 26 ptr_destructor(db->ptrs[n]); in handle_db_destroy() 28 free(db->ptrs); in handle_db_destroy() 29 db->ptrs = NULL; in handle_db_destroy() 30 db->max_ptrs = 0; in handle_db_destroy() 36 size_t n = 0; in handle_db_is_empty() local 39 for (n = 0; n < db->max_ptrs; n++) { in handle_db_is_empty() [all …]
|
| /optee_os/lib/libutils/ext/ |
| H A D | base64.c | 1 // SPDX-License-Identifier: BSD-2-Clause 4 * Copyright (c) 2014, STMicroelectronics International N.V. 18 size_t n = 0; in base64_enc() local 22 n = base64_enc_len(dlen); in base64_enc() 23 if (*blen < n) { in base64_enc() 24 *blen = n; in base64_enc() 28 for (n = 0; n < dlen; n += 3) { in base64_enc() 31 igrp = d[n]; in base64_enc() 34 if ((n + 1) < dlen) in base64_enc() 35 igrp |= d[n + 1]; in base64_enc() [all …]
|
| /optee_os/core/crypto/ |
| H A D | aes-gcm-sw.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2017-2020, Linaro Limited 8 #include <crypto/internal_aes-gcm.h> 17 internal_aes_gcm_ghash_gen_tbl(&state->ghash_key, ek); in internal_aes_gcm_set_key() 19 crypto_aes_enc_block(ek->data, sizeof(ek->data), ek->rounds, in internal_aes_gcm_set_key() 20 state->ctr, state->ghash_key.hash_subkey); in internal_aes_gcm_set_key() 27 void *y = state->hash_state; in ghash_update_block() 31 internal_aes_gcm_ghash_mult_tbl(&state->ghash_key, y, y); in ghash_update_block() 33 internal_aes_gcm_gfmul(state->ghash_key.hash_subkey, y, y); in ghash_update_block() 41 size_t n = 0; in internal_aes_gcm_ghash_update() local [all …]
|
| /optee_os/core/drivers/clk/sam/ |
| H A D | sama5d2_clk.c | 1 // SPDX-License-Identifier: GPL-2.0+ or BSD-3-Clause 17 #include <dt-bindings/clock/at91.h> 23 const char *n; member 64 { .n = "ddrck", .id = 2 }, 65 { .n = "lcdck", .id = 3 }, 66 { .n = "uhpck", .id = 6 }, 67 { .n = "udpck", .id = 7 }, 68 { .n = "pck0", .id = 8 }, 69 { .n = "pck1", .id = 9 }, 70 { .n = "pck2", .id = 10 }, [all …]
|
| /optee_os/lib/libutils/ext/include/ |
| H A D | speculation_barrier.h | 1 /* SPDX-License-Identifier: BSL-1.0 */ 4 Boost Software License - Version 1.0 - August 17th, 2003 10 Software, and to permit third-parties to whom the Software is furnished to do 17 solely in the form of machine-executable object code generated by a source 22 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 66 upper-bound comparison. We need to cast __high to an \ 74 "cmp\t%[__c], %[__l]\n\t" \ 75 "bcc\t.ns%=\n\t" \ 76 "ldr" __sz "\t%" __w "[__v], %[__p]\n" \ 77 ".ns%=:\n\t" \ [all …]
|
| /optee_os/scripts/ |
| H A D | gen_ldelf_hex.py | 2 # SPDX-License-Identifier: BSD-2-Clause 22 $ apt install python3-pyelftools 31 def round_up(n, m): argument 32 if n == 0: 35 return (((n - 1) // m) + 1) * m 48 n = 0 50 # read only first, then read-write. Compute padding at end of each segment, 54 pad = segment['p_vaddr'] - (prev_segment['p_vaddr'] + 68 print('RO load segment found after RW one(s) (m={})'.format(n)) 74 # which might need to be adjusted -- who knows what the [all …]
|
| H A D | ts_bin_to_c.py | 2 # SPDX-License-Identifier: BSD-2-Clause 5 # Copyright (c) 2020-2023, Arm Limited. 25 parser.add_argument('--out', required=True, 29 '--ta', 32 'such as: 8aaaf200-2450-11e4-abe2-0002a5d5c51b.stripped.elf') 35 '--sp', 38 'such as: 8aaaf200-2450-11e4-abe2-0002a5d5c51b.stripped.elf') 41 '--compress', 48 '--manifest', 75 offs = s2.header['sh_offset'] - s2.header['sh_addr'] [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/rsa/ |
| H A D | rsa_key.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 17 unsigned n; in s_mpi_shrink_multi() local 23 /* We re-allocate in the order that we received the varargs */ in s_mpi_shrink_multi() 24 n = 0; in s_mpi_shrink_multi() 29 if (n >= sizeof(tmp)/sizeof(tmp[0])) { in s_mpi_shrink_multi() 33 arg[n] = cur; in s_mpi_shrink_multi() 34 if ((err = mp_init_copy(&tmp[n], *arg[n])) != CRYPT_OK) { in s_mpi_shrink_multi() 37 n++; in s_mpi_shrink_multi() 44 while (n != 0 && arg[--n] != NULL) { in s_mpi_shrink_multi() [all …]
|