| /optee_os/ta/pkcs11/scripts/ |
| H A D | verify-helpers.sh | 2 # SPDX-License-Identifier: BSD-2-Clause 6 basepath="$(dirname $(dirname $(readlink -f "$0")))" 8 details () [[ ${SHOW_DETAILS} -ne 0 ]] 12 SYMBOL_LIST="$(grep PKCS11\_$PREFIX\_ ${basepath}/include/pkcs11_ta.h | cut -f2 | cut '-d ' -f1)" 13 details && echo -e "\e[4m${PREFIX}\e[0m" 15 details && echo -e "symbol\tuses\tstatus" 17 details && echo -n "$symbol" 18 COUNT="$(grep ${symbol} ${basepath}/src/* | wc -l)" 19 details && echo -n -e "\t${COUNT}\t" 20 PRESENT="$(grep PKCS11_ID.*\($symbol.*\) ${basepath}/src/pkcs11_helpers.c | wc -l)" [all …]
|
| H A D | dump_ec_curve_params.sh | 2 # SPDX-License-Identifier: BSD-2-Clause 14 openssl ecparam -name ${EC_CURVE} -param_enc named_curve | \ 15 openssl asn1parse -noout -out /dev/stdout | \ 16 hexdump -v -e '/8 "\t"' -e '/1 "0x%02x, " ' -e '/8 "\n"' | \ 24 openssl ecparam -name ${EC_CURVE} -param_enc explicit | \ 25 openssl asn1parse -noout -out /dev/stdout | \ 26 hexdump -v -e '/8 "\t"' -e '/1 "0x%02x, " ' -e '/8 "\n"' | \
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | sha1.c | 2 * FIPS-180-1 compliant SHA-1 implementation 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 8 * The SHA-1 standard was published by NIST in 1993. 10 * http://www.itl.nist.gov/fipspubs/fip180-1.htm 48 * SHA-1 context setup 52 ctx->total[0] = 0; in mbedtls_sha1_starts() 53 ctx->total[1] = 0; in mbedtls_sha1_starts() 55 ctx->state[0] = 0x67452301; in mbedtls_sha1_starts() 56 ctx->state[1] = 0xEFCDAB89; in mbedtls_sha1_starts() 57 ctx->state[2] = 0x98BADCFE; in mbedtls_sha1_starts() [all …]
|
| H A D | ripemd160.c | 2 * RIPE MD-160 implementation 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 9 * The RIPEMD-160 algorithm was designed by RIPE in 1996 11 * http://ehash.iaik.tugraz.at/wiki/RIPEMD-160 49 * RIPEMD-160 context setup 53 ctx->total[0] = 0; in mbedtls_ripemd160_starts() 54 ctx->total[1] = 0; in mbedtls_ripemd160_starts() 56 ctx->state[0] = 0x67452301; in mbedtls_ripemd160_starts() 57 ctx->state[1] = 0xEFCDAB89; in mbedtls_ripemd160_starts() 58 ctx->state[2] = 0x98BADCFE; in mbedtls_ripemd160_starts() [all …]
|
| H A D | rsa_alt_helpers.c | 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 21 * Setting F := lcm(P-1,Q-1), the idea is as follows: 25 * square roots of 1 in Z/PZ and Z/QZ are +1 and -1, this leaves the four 26 * possibilities X^(F/2) = (+-1, +-1). If it happens that X^(F/2) = (-1,+1) 27 * or (+1,-1), then gcd(X^(F/2) + 1, N) will be equal to one of the prime 31 * construction still applies since (-)^K is the identity on the set of 34 * The public and private key primitives (-)^E and (-)^D are mutually inverse 35 * bijections on Z/NZ if and only if (-)^(DE) is the identity on Z/NZ, i.e. 36 * if and only if DE - 1 is a multiple of F, say DE - 1 = F * L. 39 * DE - 1 = FL = (F/2) * (2^(t+1)) * K, [all …]
|
| H A D | bignum_internal.h | 4 * \brief Internal-only bignum public-key cryptosystem API. 6 * This file declares bignum-related functions that are to be used 12 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 18 * \brief Perform a modular exponentiation: X = A^E mod N 20 * \warning This function is not constant time with respect to \p E (the exponent). 23 * This must not alias E or N. 26 * \param E The exponent MPI. This must point to an initialized MPI. 30 * speed-up multiple modular exponentiations for the same value 42 * even, or if \c E is negative. 47 const mbedtls_mpi *E, const mbedtls_mpi *N,
|
| H A D | rsa_alt_helpers.h | 4 * \brief Context-independent RSA helper functions 6 * This module declares some RSA-related helper functions useful when 13 * End-users of Mbed TLS who are not providing their own alternative RSA 23 * (1) Parameter-generating helpers. These are: 24 * - mbedtls_rsa_deduce_primes 25 * - mbedtls_rsa_deduce_private_exponent 26 * - mbedtls_rsa_deduce_crt 30 * (2) Parameter-checking helpers. These are: 31 * - mbedtls_rsa_validate_params 32 * - mbedtls_rsa_validate_crt [all …]
|
| H A D | aes.c | 2 * FIPS-197 compliant AES implementation 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 10 …src.nist.gov/csrc/media/projects/cryptographic-standards-and-guidelines/documents/aes-development/… 11 * http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf 59 * This is a convenience shorthand macro to check if we need reverse S-box and 71 static int aes_padlock_ace = -1; 76 * Forward S-box 124 V(15, FA, FA, EF), V(EB, 59, 59, B2), V(C9, 47, 47, 8E), V(0B, F0, F0, FB), \ 128 V(5A, 36, 36, 6C), V(41, 3F, 3F, 7E), V(02, F7, F7, F5), V(4F, CC, CC, 83), \ 131 V(0C, 04, 04, 08), V(52, C7, C7, 95), V(65, 23, 23, 46), V(5E, C3, C3, 9D), \ [all …]
|
| /optee_os/core/lib/libtomcrypt/src/hashes/ |
| H A D | sha1.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 42 ulong32 a,b,c,d,e,W[80],i; in ss_sha1_compress() local 47 /* copy the state into 512-bits into W[0..15] */ in ss_sha1_compress() 53 a = md->sha1.state[0]; in ss_sha1_compress() 54 b = md->sha1.state[1]; in ss_sha1_compress() 55 c = md->sha1.state[2]; in ss_sha1_compress() 56 d = md->sha1.state[3]; in ss_sha1_compress() 57 e = md->sha1.state[4]; in ss_sha1_compress() 61 W[i] = ROL(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1); in ss_sha1_compress() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/rsa/ |
| H A D | rsa_make_key.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 12 static int s_rsa_make_key(prng_state *prng, int wprng, int size, void *e, rsa_key *key) in s_rsa_make_key() argument 34 … if ((err = mp_sub_d( p, 1, tmp1)) != CRYPT_OK) { goto cleanup; } /* tmp1 = p-1 */ in s_rsa_make_key() 35 …if ((err = mp_gcd( tmp1, e, tmp2)) != CRYPT_OK) { goto cleanup; } /* tmp2 = gcd(p-1… in s_rsa_make_key() 36 …p_cmp_d( tmp2, 1) != 0); /* while e divides p-1 */ in s_rsa_make_key() 41 … if ((err = mp_sub_d( q, 1, tmp1)) != CRYPT_OK) { goto cleanup; } /* tmp1 = q-1 */ in s_rsa_make_key() 42 …if ((err = mp_gcd( tmp1, e, tmp2)) != CRYPT_OK) { goto cleanup; } /* tmp2 = gcd(q-1, e)… in s_rsa_make_key() 43 …mp_cmp_d( tmp2, 1) != 0); /* while e divides q-1 */ in s_rsa_make_key() 45 /* tmp1 = lcm(p-1, q-1) */ in s_rsa_make_key() [all …]
|
| H A D | rsa_set.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 13 @param e RSA's e 14 @param elen RSA's e's length 21 const unsigned char *e, unsigned long elen, in rsa_set_key() argument 29 LTC_ARGCHK(e != NULL); in rsa_set_key() 34 …if ((err = mp_read_unsigned_bin(key->N , (unsigned char *)N , Nlen)) != CRYPT_OK) { goto LBL_ER… in rsa_set_key() 35 …if ((err = mp_read_unsigned_bin(key->e , (unsigned char *)e , elen)) != CRYPT_OK) { goto LBL_ER… in rsa_set_key() 37 …if ((err = mp_read_unsigned_bin(key->d , (unsigned char *)d , dlen)) != CRYPT_OK) { goto LBL_ERR; } in rsa_set_key() 38 key->type = PK_PRIVATE; in rsa_set_key() [all …]
|
| /optee_os/core/tee/ |
| H A D | tee_svc_storage.c | 1 // SPDX-License-Identifier: BSD-2-Clause 4 * Copyright (c) 2020, 2022-2023 Linaro Limited 46 struct tee_storage_enum *e; in tee_svc_storage_get_enum() local 48 TAILQ_FOREACH(e, &utc->storage_enums, link) { in tee_svc_storage_get_enum() 49 if (enum_id == (vaddr_t)e) { in tee_svc_storage_get_enum() 50 *e_out = e; in tee_svc_storage_get_enum() 58 struct tee_storage_enum *e) in tee_svc_close_enum() argument 60 if (e == NULL || utc == NULL) in tee_svc_close_enum() 63 TAILQ_REMOVE(&utc->storage_enums, e, link); in tee_svc_close_enum() 65 if (e->fops) in tee_svc_close_enum() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| H A D | ecc_sign_hash.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 32 void *r, *s, *e, *p, *b; in ecc_sign_hash_ex() local 44 if (key->type != PK_PRIVATE) { in ecc_sign_hash_ex() 49 if ((err = mp_init_multi(&r, &s, &e, &b, LTC_NULL)) != CRYPT_OK) { in ecc_sign_hash_ex() 53 /* get the hash and load it as a bignum into 'e' */ in ecc_sign_hash_ex() 54 p = key->dp.order; in ecc_sign_hash_ex() 58 … if ((err = mp_read_unsigned_bin(e, (unsigned char *)in, inlen)) != CRYPT_OK) { goto errnokey; } in ecc_sign_hash_ex() 61 … if ((err = mp_read_unsigned_bin(e, (unsigned char *)in, pbytes)) != CRYPT_OK) { goto errnokey; } in ecc_sign_hash_ex() 64 shift_right = 8 - pbits % 8; in ecc_sign_hash_ex() [all …]
|
| /optee_os/core/arch/arm/dts/ |
| H A D | stm32mp15-pinctrl.dtsi | 1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 3 * Copyright (C) STMicroelectronics 2017 - All Rights Reserved 6 #include <dt-bindings/pinctrl/stm32-pinfunc.h> 9 adc1_in6_pins_a: adc1-in6-0 { 15 adc12_ain_pins_a: adc12-ain-0 { 24 adc12_ain_pins_b: adc12-ain-1 { 31 adc12_usb_cc_pins_a: adc12-usb-cc-pins-0 { 38 cec_pins_a: cec-0 { 41 bias-disable; 42 drive-open-drain; [all …]
|
| /optee_os/lib/libmbedtls/core/ |
| H A D | rsa.c | 1 // SPDX-License-Identifier: BSD-2-Clause 105 rsa->E = *(mbedtls_mpi *)key->e; in rsa_complete_from_key_pair() 106 rsa->N = *(mbedtls_mpi *)key->n; in rsa_complete_from_key_pair() 107 rsa->D = *(mbedtls_mpi *)key->d; in rsa_complete_from_key_pair() 108 rsa->len = mbedtls_mpi_size(&rsa->N); in rsa_complete_from_key_pair() 110 if (key->p && crypto_bignum_num_bytes(key->p)) { in rsa_complete_from_key_pair() 111 rsa->P = *(mbedtls_mpi *)key->p; in rsa_complete_from_key_pair() 112 rsa->Q = *(mbedtls_mpi *)key->q; in rsa_complete_from_key_pair() 113 rsa->QP = *(mbedtls_mpi *)key->qp; in rsa_complete_from_key_pair() 114 rsa->DP = *(mbedtls_mpi *)key->dp; in rsa_complete_from_key_pair() [all …]
|
| H A D | sm2-dsa.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2019-2021 Huawei Technologies Co., Ltd 17 #include "sm2-dsa.h" 34 mbedtls_mpi e = { }; in sm2_mbedtls_dsa_sign() local 45 mbedtls_mpi_init(&e); in sm2_mbedtls_dsa_sign() 60 * Steps A1 and A2 are the generation of the hash value e from user in sm2_mbedtls_dsa_sign() 62 * here since @msg is expected to be the hash value e already. in sm2_mbedtls_dsa_sign() 80 /* Step A5: compute r = (e + x1) mod n */ in sm2_mbedtls_dsa_sign() 82 mbedtls_mpi_read_binary(&e, (unsigned char *)msg, msg_len); in sm2_mbedtls_dsa_sign() 83 mres = mbedtls_mpi_add_mpi(&r, &e, &x1y1p.X); in sm2_mbedtls_dsa_sign() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/ciphers/safer/ |
| H A D | safer.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 8 * LTC_DESCRIPTION: block-cipher algorithm LTC_SAFER (Secure And Fast Encryption 9 * Routine) in its four versions: LTC_SAFER K-64, LTC_SAFER K-128, 10 * LTC_SAFER SK-64 and LTC_SAFER SK-128. 15 * CH-8092 Zuerich, Switzerland 31 "safer-k64", 43 "safer-sk64", 55 "safer-k128", 67 "safer-sk128", [all …]
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | sm2-dsa.c | 1 // SPDX-License-Identifier: BSD-2-Clause 30 void *e = NULL; in sm2_ltc_dsa_sign() local 40 ltc_res = mp_init_multi(&k, &e, &r, &s, &tmp, NULL); in sm2_ltc_dsa_sign() 55 * Steps A1 and A2 are the generation of the hash value e from user in sm2_ltc_dsa_sign() 57 * here since @msg is expected to be the hash value e already. in sm2_ltc_dsa_sign() 78 /* Step A5: compute r = (e + x1) mod n */ in sm2_ltc_dsa_sign() 80 mp_read_unsigned_bin(e, (unsigned char *)msg, msg_len); in sm2_ltc_dsa_sign() 81 ltc_res = mp_addmod(e, x1y1p->x, ltc_key.dp.order, r); in sm2_ltc_dsa_sign() 95 /* Step A6: compute s = ((1 + dA)^-1 * (k - r*dA)) mod n */ in sm2_ltc_dsa_sign() 132 mp_clear_multi(k, e, r, s, tmp, NULL); in sm2_ltc_dsa_sign() [all …]
|
| H A D | rsa.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2014-2019, 2022 Linaro Limited 24 * - TEE_SUCCESS in case of success, 25 * - TEE_ERROR_BAD_PARAMETERS in case algo is not a valid algo 26 * - TEE_ERROR_NOT_SUPPORTED in case algo is not supported by LTC 27 * Return -1 in case of error 83 *ltc_hashindex = -1; in tee_algo_to_ltc_hashindex() 104 if (!bn_alloc_max(&s->e)) in sw_crypto_acipher_alloc_rsa_keypair() 106 if (!bn_alloc_max(&s->d)) in sw_crypto_acipher_alloc_rsa_keypair() 108 if (!bn_alloc_max(&s->n)) in sw_crypto_acipher_alloc_rsa_keypair() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/ciphers/ |
| H A D | serpent.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 4 /* Based on serpent.cpp - originally written and placed in the public domain by Wei Dai 7 On 2017-10-16 wikipedia says: 30 #define s_lt(i,a,b,c,d,e) { \ argument 40 #define s_ilt(i,a,b,c,d,e) { \ argument 52 /* order of output from S-box functions */ 53 #define s_beforeS0(f) f(0,a,b,c,d,e) 54 #define s_afterS0(f) f(1,b,e,c,a,d) 55 #define s_afterS1(f) f(2,c,b,a,e,d) [all …]
|
| /optee_os/core/kernel/ |
| H A D | asan.c | 1 // SPDX-License-Identifier: BSD-2-Clause 4 * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net 52 ((addr + size - 1) >> ASAN_BLOCK_SHIFT); in addr_crosses_scale_boundary() 64 return ((vaddr_t)end - (vaddr_t)begin) / ASAN_BLOCK_SIZE; in va_range_to_shadow_size() 70 vaddr_t e = (vaddr_t)end; in va_range_inside_shadow() local 72 if (b >= e) in va_range_inside_shadow() 74 return (b >= asan_va_base) && (e <= (asan_va_base + asan_va_size)); in va_range_inside_shadow() 80 vaddr_t e = (vaddr_t)end; in va_range_outside_shadow() local 82 if (b >= e) in va_range_outside_shadow() 84 return (e <= asan_va_base) || (b >= (asan_va_base + asan_va_size)); in va_range_outside_shadow() [all …]
|
| /optee_os/lib/libutils/ext/ |
| H A D | array.c | 1 // SPDX-License-Identifier: BSD-2-Clause 15 void *e = b + pos * elem_size; in ins_array_elem() local 19 memmove(b + (pos + 1) * elem_size, e, in ins_array_elem() 20 (elem_count - pos - 1) * elem_size); in ins_array_elem() 23 memcpy(e, elem, elem_size); in ins_array_elem() 25 return e; in ins_array_elem() 43 (elem_count - pos - 1) * elem_size); in rem_array_elem() 50 memset((uint8_t *)base + (elem_count - 1) * elem_size, 0, elem_size); in rem_array_elem_zero_pad()
|
| /optee_os/core/pta/ |
| H A D | hwrng.c | 1 // SPDX-License-Identifier: BSD-2-Clause 6 * Based on plat-synquacer/rng_pta.c 25 uint8_t *e = NULL; in rng_get_entropy() local 35 e = (uint8_t *)params[0].memref.buffer; in rng_get_entropy() 36 if (!e) in rng_get_entropy() 39 return crypto_rng_read(e, params[0].memref.size); in rng_get_entropy()
|
| /optee_os/scripts/ |
| H A D | symbolize.py | 2 # SPDX-License-Identifier: BSD-2-Clause 18 TEE_LOAD_ADDR_RE = re.compile(r'TEE load address @ (?P<load_addr>0x[0-9a-f]+)') 20 # E/TC:0 0x001044a8 22 r'[UEIDFM]/(TC|LD):([0-9]+ )?(\?*|[0-9]*) [0-9]* +(?P<addr>0x[0-9a-f]+)') 23 ABORT_ADDR_RE = re.compile(r'-abort at address (?P<addr>0x[0-9a-f]+)') 24 TA_PANIC_RE = re.compile(r'TA panicked with code (?P<code>0x[0-9a-f]+)') 25 REGION_RE = re.compile(r'region +[0-9]+: va (?P<addr>0x[0-9a-f]+) ' 26 r'pa 0x[0-9a-f]+ size (?P<size>0x[0-9a-f]+)' 27 r'( flags .{4} (\[(?P<elf_idx>[0-9]+)\])?)?') 28 ELF_LIST_RE = re.compile(r'\[(?P<idx>[0-9]+)\] (?P<uuid>[0-9a-f\-]+)' [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/dsa/ |
| H A D | dsa_generate_pqg.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 7 DSA implementation - generate DSA parameters p, q & g 28 void *t2L1, *t2N1, *t2q, *t2seedlen, *U, *W, *X, *c, *h, *e, *seedinc; in s_dsa_make_params() local 29 …const char *accepted_hashes[] = { "sha3-512", "sha512", "sha3-384", "sha384", "sha3-256", "sha256"… in s_dsa_make_params() 36 /* FIPS-186-4 A.1.1.2 Generation of the Probable Primes p and q Using an Approved Hash Function in s_dsa_make_params() 38 * L = The desired length of the prime p (in bits e.g. L = 1024) in s_dsa_make_params() 39 * N = The desired length of the prime q (in bits e.g. N = 160) in s_dsa_make_params() 45 * 3. n = ceil(L / outlen) - 1 in s_dsa_make_params() 46 * 4. b = L- 1 - (n * outlen) in s_dsa_make_params() [all …]
|