| /optee_os/core/lib/libtomcrypt/src/hashes/sha2/ |
| H A D | sha256.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 52 #define S(x, n) RORc((x),(n)) macro 54 #define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) 55 #define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) 56 #define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) 57 #define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) 59 /* compress 512-bits */ 66 ulong32 S[8], W[64], t0, t1; in ss_sha256_compress() local 72 /* copy state into S */ in ss_sha256_compress() [all …]
|
| H A D | sha512.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 77 #define S(x, n) ROR64c(x, n) macro 79 #define Sigma0(x) (S(x, 28) ^ S(x, 34) ^ S(x, 39)) 80 #define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41)) 81 #define Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7)) 82 #define Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6)) 84 /* compress 1024-bits */ 91 ulong64 S[8], W[80], t0, t1; in ss_sha512_compress() local 94 /* copy state into S */ in ss_sha512_compress() [all …]
|
| /optee_os/core/arch/arm/crypto/ |
| H A D | sm4_armv8a_ce_a64.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 8 * Cryptographic Extension for ARMv8.2-A. 10 * The CE implementation refers to Linux kernel (sm4-ce-core.S contributed 14 #include <asm.S> 16 .arch armv8.2-a+crypto+sm4 40 /* round keys: v0-v7 */ 50 /* plain blocks: v8-v15 */ 72 stp x15, x16, [sp, #-0x10]! 73 stp x17, x18, [sp, #-0x10]! 74 stp x19, x20, [sp, #-0x10]! [all …]
|
| H A D | sha256_armv8a_ce_a64.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 3 * Copyright (c) 2015-2020, Linaro Limited 7 /* Core SHA-224/SHA-256 transform using v8 Crypto Extensions */ 9 #include <asm.S> 11 .arch armv8-a+crypto 31 add t1.4s, v\s0\().4s, \rc\().4s 32 sha256h dg0q, dg1q, t0.4s 33 sha256h2 dg1q, dg2q, t0.4s 36 add t0.4s, v\s0\().4s, \rc\().4s 38 sha256h dg0q, dg1q, t1.4s [all …]
|
| H A D | sha1_armv8a_ce_a64.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 3 * Copyright (c) 2014-2020, Linaro Limited 7 /* SHA-1 secure hash using ARMv8 Crypto Extensions */ 9 #include <asm.S> 11 .arch armv8-a+crypto 35 add t1.4s, v\s0\().4s, \rc\().4s 38 sha1\op dg0q, \dg1, t0.4s 40 sha1\op dg0q, dg1s, t0.4s 44 add t0.4s, v\s0\().4s, \rc\().4s 47 sha1\op dg0q, dg2s, t1.4s [all …]
|
| H A D | sm3_armv8a_ce_a64.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 9 #include <asm.S> 10 #include <arm64_macros.S> 13 .set .Lv\b\().4s, \b 45 sm3ss1 v5.4s, v8.4s, \t0\().4s, v9.4s 46 shl \t1\().4s, \t0\().4s, #1 47 sri \t1\().4s, \t0\().4s, #31 48 sm3tt1\ab v8.4s, v5.4s, v10.4s, \i 49 sm3tt2\ab v9.4s, v5.4s, \s0\().4s, \i 57 sm3partw1 \s4\().4s, \s0\().4s, \s3\().4s [all …]
|
| H A D | sm4_armv8a_aese_a64.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 8 * optional Cryptographic Extension for ARMv8-A. 10 * The NEON implementation refers to Linux kernel (sm4-neon-core.S contributed 19 #include <asm.S> 21 .arch armv8-a+crypto 49 /* round keys: v0-v7 */ 59 /* plain blocks: v8-v15 */ 93 stp x15, x16, [sp, #-0x10]! 94 stp x17, x18, [sp, #-0x10]! 95 stp x19, x20, [sp, #-0x10]! [all …]
|
| H A D | sub.mk | 2 srcs-$(CFG_ARM64_core) += ghash-ce-core_a64.S 3 srcs-$(CFG_ARM32_core) += ghash-ce-core_a32.S 4 srcs-y += aes-gcm-ce.c 8 srcs-y += aes_armv8a_ce.c 9 srcs-$(CFG_ARM64_core) += aes_modes_armv8a_ce_a64.S 10 aflags-aes_modes_armv8a_ce_a64.S-y += -DINTERLEAVE=4 11 srcs-$(CFG_ARM32_core) += aes_modes_armv8a_ce_a32.S 15 srcs-y += sha1_armv8a_ce.c 16 srcs-$(CFG_ARM64_core) += sha1_armv8a_ce_a64.S 17 srcs-$(CFG_ARM32_core) += sha1_armv8a_ce_a32.S [all …]
|
| /optee_os/core/tee/ |
| H A D | uuid.c | 1 // SPDX-License-Identifier: BSD-2-Clause 10 void tee_uuid_to_octets(uint8_t *d, const TEE_UUID *s) in tee_uuid_to_octets() argument 12 d[0] = s->timeLow >> 24; in tee_uuid_to_octets() 13 d[1] = s->timeLow >> 16; in tee_uuid_to_octets() 14 d[2] = s->timeLow >> 8; in tee_uuid_to_octets() 15 d[3] = s->timeLow; in tee_uuid_to_octets() 16 d[4] = s->timeMid >> 8; in tee_uuid_to_octets() 17 d[5] = s->timeMid; in tee_uuid_to_octets() 18 d[6] = s->timeHiAndVersion >> 8; in tee_uuid_to_octets() 19 d[7] = s->timeHiAndVersion; in tee_uuid_to_octets() [all …]
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | sha3.c | 2 * FIPS-202 compliant SHA3 implementation 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 8 * The SHA-3 Secure Hash Standard was published by NIST in 2015. 24 * these; the defaults here should give sensible trade-offs for gcc and clang on aarch64 and 25 * x86-64. 28 #define MBEDTLS_SHA3_THETA_UNROLL 0 //no-check-names 32 #define MBEDTLS_SHA3_CHI_UNROLL 0 //no-check-names 34 #define MBEDTLS_SHA3_CHI_UNROLL 1 //no-check-names 38 #define MBEDTLS_SHA3_PI_UNROLL 1 //no-check-names 41 #define MBEDTLS_SHA3_RHO_UNROLL 1 //no-check-names [all …]
|
| /optee_os/lib/libutils/compiler-rt/lib/builtins/ |
| H A D | udivmodti4.c | 1 //===-- udivmodti4.c - Implement __udivmodti4 -----------------------------===// 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 //===----------------------------------------------------------------------===// 11 //===----------------------------------------------------------------------===// 27 du_int un1, un0; // Norm. dividend LSD's in udiv128by64to64default() 32 si_int s; // Shift amount for normalization in udiv128by64to64default() local 34 s = __builtin_clzll(v); in udiv128by64to64default() 35 if (s > 0) { in udiv128by64to64default() 37 v = v << s; in udiv128by64to64default() 38 un64 = (u1 << s) | (u0 >> (n_udword_bits - s)); in udiv128by64to64default() [all …]
|
| 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 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 23 if (sr == N - 1) // d == 1 26 // 1 <= sr <= N - 1. Shifts do not trigger UB. [all …]
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | dsa.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2014-2019, Linaro Limited 16 TEE_Result crypto_acipher_alloc_dsa_keypair(struct dsa_keypair *s, in crypto_acipher_alloc_dsa_keypair() argument 19 memset(s, 0, sizeof(*s)); in crypto_acipher_alloc_dsa_keypair() 20 if (!bn_alloc_max(&s->g)) in crypto_acipher_alloc_dsa_keypair() 23 if (!bn_alloc_max(&s->p)) in crypto_acipher_alloc_dsa_keypair() 25 if (!bn_alloc_max(&s->q)) in crypto_acipher_alloc_dsa_keypair() 27 if (!bn_alloc_max(&s->y)) in crypto_acipher_alloc_dsa_keypair() 29 if (!bn_alloc_max(&s->x)) in crypto_acipher_alloc_dsa_keypair() 33 crypto_bignum_free(&s->g); in crypto_acipher_alloc_dsa_keypair() [all …]
|
| /optee_os/core/kernel/ |
| H A D | tee_ta_manager.c | 1 // SPDX-License-Identifier: BSD-2-Clause 79 /* Wait until the single-instance lock is available. */ in lock_single_instance() 96 tee_ta_single_instance_count--; in unlock_single_instance() 112 assert(is_ta_ctx(sess->ctx) || is_stmm_ctx(sess->ctx)); in to_ta_session() 122 return &(to_stmm_ctx(ctx)->ta_ctx); in ts_to_ta_ctx() 131 if (ctx->flags & TA_FLAG_CONCURRENT) in tee_ta_try_set_busy() 136 if (ctx->flags & TA_FLAG_SINGLE_INSTANCE) in tee_ta_try_set_busy() 140 if (ctx->busy) { in tee_ta_try_set_busy() 142 * We're holding the single-instance lock and the in tee_ta_try_set_busy() 144 * dead-lock, we release the lock and return false. in tee_ta_try_set_busy() [all …]
|
| H A D | ts_manager.c | 1 // SPDX-License-Identifier: BSD-2-Clause 19 struct ts_session *s = TAILQ_FIRST(&tsd->sess_stack); in update_current_ctx() local 21 if (s) { in update_current_ctx() 22 if (is_pseudo_ta_ctx(s->ctx)) in update_current_ctx() 23 s = TAILQ_NEXT(s, link_tsd); in update_current_ctx() 25 if (s) in update_current_ctx() 26 ctx = s->ctx; in update_current_ctx() 29 if (tsd->ctx != ctx) in update_current_ctx() 38 void ts_push_current_session(struct ts_session *s) in ts_push_current_session() argument 42 TAILQ_INSERT_HEAD(&tsd->sess_stack, s, link_tsd); in ts_push_current_session() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/rsa/ |
| H A D | rsa_set.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 11 @param N RSA's N 12 @param Nlen RSA's N's length 13 @param e RSA's e 14 @param elen RSA's e's length 15 @param d RSA's d (only private key, NULL for public key) 16 @param dlen RSA's d's length 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() [all …]
|
| /optee_os/lib/libmbedtls/core/ |
| H A D | ecc.c | 1 // SPDX-License-Identifier: BSD-2-Clause 20 #include "sm2-dsa.h" 21 #include "sm2-pke.h" 38 static void ecc_free_public_key(struct ecc_public_key *s) in ecc_free_public_key() argument 40 if (!s) in ecc_free_public_key() 43 crypto_bignum_free(&s->x); in ecc_free_public_key() 44 crypto_bignum_free(&s->y); in ecc_free_public_key() 119 res = ecc_get_keysize(key->curve, 0, &key_size_bytes, &key_size_bits); in ecc_generate_keypair() 129 gid = curve_to_group_id(key->curve); in ecc_generate_keypair() 154 crypto_bignum_copy(key->d, (void *)&ecdsa.d); in ecc_generate_keypair() [all …]
|
| H A D | dh.c | 1 // SPDX-License-Identifier: BSD-2-Clause 17 TEE_Result crypto_acipher_alloc_dh_keypair(struct dh_keypair *s, in crypto_acipher_alloc_dh_keypair() argument 20 memset(s, 0, sizeof(*s)); in crypto_acipher_alloc_dh_keypair() 21 s->g = crypto_bignum_allocate(key_size_bits); in crypto_acipher_alloc_dh_keypair() 22 if (!s->g) in crypto_acipher_alloc_dh_keypair() 24 s->p = crypto_bignum_allocate(key_size_bits); in crypto_acipher_alloc_dh_keypair() 25 if (!s->p) in crypto_acipher_alloc_dh_keypair() 27 s->y = crypto_bignum_allocate(key_size_bits); in crypto_acipher_alloc_dh_keypair() 28 if (!s->y) in crypto_acipher_alloc_dh_keypair() 30 s->x = crypto_bignum_allocate(key_size_bits); in crypto_acipher_alloc_dh_keypair() [all …]
|
| /optee_os/ |
| H A D | MAINTAINERS | 1 Maintainers in the OP-TEE project 3 Linaro as such maintains OP-TEE, but for individual devices which might not be 5 sub-maintainers for these platforms. 7 Please keep this list in alphabetical order, and refer to the Linux kernel's 10 Note that OP-TEE development mainly occurs on GitHub [2] so this file should be 14 For example, [@jbech-linaro]. 18 e-mail addresses below. Maintainers normally are subscribed to GitHub 31 [2] https://github.com/OP-TEE/optee_os 33 ---------- 37 S: Maintained [all …]
|
| /optee_os/core/arch/arm/kernel/ |
| H A D | sub.mk | 1 srcs-y += rpc_io_i2c.c 2 srcs-y += idle.c 4 srcs-$(CFG_SECURE_TIME_SOURCE_CNTPCT) += tee_time_arm_cntpct.c 6 srcs-$(CFG_ARM64_core) += generic_timer.c 8 srcs-$(CFG_ARM64_core) += timer_a64.c 10 srcs-$(CFG_ARM32_core) += spin_lock_a32.S 11 srcs-$(CFG_ARM64_core) += spin_lock_a64.S 12 srcs-$(CFG_ARM32_core) += tlb_helpers_a32.S 13 srcs-$(CFG_ARM64_core) += tlb_helpers_a64.S 14 srcs-$(CFG_ARM64_core) += cache_helpers_a64.S [all …]
|
| /optee_os/core/lib/libtomcrypt/src/stream/rc4/ |
| H A D | rc4_stream.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 12 @param keylen The length of the secret key (8 - 256 bytes) 17 unsigned char tmp, *s; in rc4_stream_setup() local 23 LTC_ARGCHK(keylen >= 5); /* 40-2048 bits */ in rc4_stream_setup() 25 s = st->buf; in rc4_stream_setup() 27 s[x] = x; in rc4_stream_setup() 31 y = (y + s[x] + key[j++]) & 255; 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() [all …]
|
| /optee_os/lib/libutils/isoc/newlib/ |
| H A D | strtok_r.c | 33 __strtok_r (register char *s, in __strtok_r() argument 43 if (s == NULL && (s = *lasts) == NULL) in __strtok_r() 47 * Skip (span) leading delimiters (s += strspn(s, delim), sort of). in __strtok_r() 50 c = *s++; in __strtok_r() 57 *lasts = s; in __strtok_r() 58 s[-1] = 0; in __strtok_r() 59 return (s - 1); in __strtok_r() 64 if (c == 0) { /* no non-delimiter characters */ in __strtok_r() 68 tok = s - 1; in __strtok_r() 71 * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). in __strtok_r() [all …]
|
| H A D | strchr.c | 1 // SPDX-License-Identifier: BSD-3-Clause 3 * Copyright (c) 1994-2009 Red Hat, Inc. 35 <<strchr>>---search for character in string 73 #define UNALIGNED(X) ((long)X & (sizeof (long) - 1)) 79 #define DETECTNULL(X) (((X) - 0x01010101L) & ~(X) & 0x80808080UL) 83 #define DETECTNULL(X) (((X) - 0x0101010101010101L) & ~(X) & \ 99 _CONST unsigned char *s = (_CONST unsigned char *)s1; variable 110 while (UNALIGNED (s)) 112 if (!*s) 113 return (char *) s; [all …]
|
| /optee_os/lib/libutils/ext/arch/arm/ |
| H A D | memtag.c | 1 // SPDX-License-Identifier: BSD-2-Clause 63 size -= dcsz; in set_tags_dc_gva() 72 size -= dcsz; in clear_mem_dc_gzva() 94 size_t mask = dcsz - 1; in set_tags_dc_helper() 95 size_t s = 0; in set_tags_dc_helper() local 98 s = MIN(dcsz - (va & mask), size); in set_tags_dc_helper() 99 set_tags_helper((void *)va, s); in set_tags_dc_helper() 100 va += s; in set_tags_dc_helper() 101 size -= s; in set_tags_dc_helper() 103 s = size & ~mask; in set_tags_dc_helper() [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() 54 p = key->dp.order; in ecc_sign_hash_ex() 64 shift_right = 8 - pbits % 8; in ecc_sign_hash_ex() 67 ch = (in[i] << (8-shift_right)); in ecc_sign_hash_ex() 84 if (mp_copy(pubkey.pubkey.x, s) != CRYPT_OK) { goto error; } in ecc_sign_hash_ex() 85 while (mp_cmp_d(s, 0) == LTC_MP_GT && mp_cmp(s, p) != LTC_MP_LT) { in ecc_sign_hash_ex() [all …]
|