| /optee_os/core/lib/libtomcrypt/src/hashes/ |
| H A D | md5.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 98 ulong32 i, W[16], a, b, c, d; in ss_md5_compress() local 103 /* copy the state into 512-bits into W[0..15] */ in ss_md5_compress() 105 LOAD32L(W[i], buf + (4*i)); in ss_md5_compress() 109 a = md->md5.state[0]; in ss_md5_compress() 110 b = md->md5.state[1]; in ss_md5_compress() 111 c = md->md5.state[2]; in ss_md5_compress() 112 d = md->md5.state[3]; in ss_md5_compress() 116 FF(a,b,c,d,W[Worder[i]],Rorder[i],Korder[i]); in ss_md5_compress() [all …]
|
| 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() 49 LOAD32H(W[i], buf + (4*i)); 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() [all …]
|
| /optee_os/core/crypto/ |
| H A D | sm3.c | 1 // SPDX-License-Identifier: BSD-2-Clause 10 * 2011-10-26 40 ctx->total[0] = 0; in sm3_init() 41 ctx->total[1] = 0; in sm3_init() 43 ctx->state[0] = 0x7380166F; in sm3_init() 44 ctx->state[1] = 0x4914B2B9; in sm3_init() 45 ctx->state[2] = 0x172442D7; in sm3_init() 46 ctx->state[3] = 0xDA8A0600; in sm3_init() 47 ctx->state[4] = 0xA96F30BC; in sm3_init() 48 ctx->state[5] = 0x163138AA; in sm3_init() [all …]
|
| /optee_os/lib/libutils/isoc/arch/arm/ |
| H A D | arm32_aeabi_shift.c | 1 // SPDX-License-Identifier: BSD-2-Clause 8 unsigned long w[2]; member 15 unsigned long hi = dword.w[1]; in __aeabi_llsl() 16 unsigned long lo = dword.w[0]; in __aeabi_llsl() 19 hi = lo << (shift - 32); in __aeabi_llsl() 22 hi = (hi << shift) | (lo >> (32 - shift)); in __aeabi_llsl() 26 dword.w[1] = hi; in __aeabi_llsl() 27 dword.w[0] = lo; in __aeabi_llsl() 35 unsigned long hi = dword.w[1]; in __aeabi_llsr() 36 unsigned long lo = dword.w[0]; in __aeabi_llsr() [all …]
|
| /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 | sha512.c | 2 * FIPS-180-2 compliant SHA-384/512 implementation 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 8 * The SHA-512 Secure Hash Standard was published by NIST in 2002. 10 * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf 15 /* TODO: Re-consider above after https://reviews.llvm.org/D131064 merged. 18 * these are normally only enabled by the -march option on the command line. 20 * requiring -march on the command line. 50 /* *INDENT-OFF* */ 55 * Best performance comes from most recent compilers, with intrinsics and -O3. 56 * Must compile with -march=armv8.2-a+sha3, but we can't detect armv8.2-a, and [all …]
|
| H A D | aria.c | 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 10 * [1] http://210.104.33.10/ARIA/doc/ARIA-specification-e.pdf 29 * modify byte order: ( A B C D ) -> ( B A D C ), i.e. swap pairs of bytes 38 /* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */ 71 * modify byte order: ( A B C D ) -> ( C D A B ), i.e. rotate by 16 bits 80 * modify byte order: ( A B C D ) -> ( D C B A ), i.e. change endianness 106 * half of App. B.1 in [1] in terms of 4-byte operators P1, P2, P3 and P4. 136 * (sa, sb, sc, sd) = 256 8-bit S-Boxes (see below) 138 * By passing sb1, sb2, is1, is2 as S-Boxes you get SL1 139 * By passing is1, is2, sb1, sb2 as S-Boxes you get SL2 [all …]
|
| H A D | ecp.c | 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 11 * SEC1 https://www.secg.org/sec1-v2.pdf 12 * GECC = Guide to Elliptic Curve Cryptography - Hankerson, Menezes, Vanstone 13 * FIPS 186-3 http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf 15 * - https://www.rfc-editor.org/rfc/rfc4492 17 * - https://www.rfc-editor.org/rfc/rfc7748 19 * [Curve25519] https://cr.yp.to/ecdh/curve25519-20060209.pdf 21 * [2] CORON, Jean-S'ebastien. Resistance against differential power analysis 23 * Embedded Systems. Springer Berlin Heidelberg, 1999. p. 292-302. 24 * <http://link.springer.com/chapter/10.1007/3-540-48059-5_25> [all …]
|
| H A D | sha256.c | 2 * FIPS-180-2 compliant SHA-256 implementation 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 8 * The SHA-256 Secure Hash Standard was published by NIST in 2002. 10 * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf 24 /* TODO: Re-consider above after https://reviews.llvm.org/D131064 merged. 27 * these are normally only enabled by the -march option on the command line. 29 * requiring -march on the command line. 35 /* See: https://arm-software.github.io/acle/main/acle.html#cryptographic-extensions 46 /* Ensure that SIG_SETMASK is defined when -std=c99 is used. */ 79 /* *INDENT-OFF* */ [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/dsa/ |
| H A D | dsa_verify_hash.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 27 void *w, *v, *u1, *u2; in dsa_verify_hash_raw() local 39 if ((err = mp_init_multi(&w, &v, &u1, &u2, LTC_NULL)) != CRYPT_OK) { in dsa_verify_hash_raw() 44 …= LTC_MP_GT || mp_cmp_d(s, 0) != LTC_MP_GT || mp_cmp(r, key->q) != LTC_MP_LT || mp_cmp(s, key->q) … in dsa_verify_hash_raw() 49 /* FIPS 186-4 4.7: use leftmost min(bitlen(q), bitlen(hash)) bits of 'hash' */ in dsa_verify_hash_raw() 50 hashlen = MIN(hashlen, (unsigned long)(key->qord)); in dsa_verify_hash_raw() 52 /* w = 1/s mod q */ in dsa_verify_hash_raw() 53 …if ((err = mp_invmod(s, key->q, w)) != CRYPT_OK) { goto erro… in dsa_verify_hash_raw() 55 /* u1 = m * w mod q */ in dsa_verify_hash_raw() [all …]
|
| 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() 45 * 3. n = ceil(L / outlen) - 1 in s_dsa_make_params() 46 * 4. b = L- 1 - (n * outlen) in s_dsa_make_params() 48 * 6. U = Hash (domain_parameter_seed) mod 2^(N-1) in s_dsa_make_params() 49 * 7. q = 2^(N-1) + U + 1 - (U mod 2) in s_dsa_make_params() [all …]
|
| /optee_os/core/arch/arm/include/ |
| H A D | arm64_macros.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 10 * create a ldp/stp instruction. It also selects register name x/w 20 w\reg0, w\reg1, [\base_reg, #\base_offs] 26 * create a ldr/str instruction. It also selects register name x/w 36 w\reg, [\base_reg, #\base_offs] 47 .if (\to_regnum - \from_regnum + 1) >= 2 54 .if (\to_regnum - \from_regnum + 1) > 2 70 * Stores registers w[from_regnum]..w[to_regnum] at 86 * Loads registers w[from_regnum]..w[to_regnum] at 96 stp \r1, \r2, [sp, #-16]! [all …]
|
| /optee_os/core/arch/riscv/kernel/ |
| H A D | spinlock.S | 1 // SPDX-License-Identifier: BSD-2-Clause 12 addi sp, sp, -(RISCV_XLEN_BYTES * 2) 30 fence rw, w 31 amoswap.w x0, x0, 0(a0) 38 amoswap.w a0, t0, 0(a0)
|
| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| H A D | ecc_recover_key.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 21 @param recid The recovery ID ("v"), can be -1 if signature contains it 32 void *r, *s, *v, *w, *t1, *t2, *u1, *u2, *v1, *v2, *e, *x, *y, *a_plus3; in ecc_recover_key() local 49 …if ((err = mp_init_multi(&r, &s, &v, &w, &t1, &t2, &u1, &u2, &v1, &v2, &e, &x, &y, &a_plus3, LTC_N… in ecc_recover_key() 53 p = key->dp.order; in ecc_recover_key() 54 m = key->dp.prime; in ecc_recover_key() 55 a = key->dp.A; in ecc_recover_key() 56 b = key->dp.B; in ecc_recover_key() 71 /* ANSI X9.62 format - ASN.1 encoded SEQUENCE{ INTEGER(r), INTEGER(s) } */ in ecc_recover_key() [all …]
|
| H A D | ecc_verify_hash.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 29 void *r, *s, *v, *w, *u1, *u2, *e, *p, *m, *a, *a_plus3; in ecc_verify_hash_ex() local 45 if ((err = mp_init_multi(&r, &s, &v, &w, &u1, &u2, &e, &a_plus3, LTC_NULL)) != CRYPT_OK) { in ecc_verify_hash_ex() 49 p = key->dp.order; in ecc_verify_hash_ex() 50 m = key->dp.prime; in ecc_verify_hash_ex() 51 a = key->dp.A; in ecc_verify_hash_ex() 65 /* ANSI X9.62 format - ASN.1 encoded SEQUENCE{ INTEGER(r), INTEGER(s) } */ in ecc_verify_hash_ex() 72 /* RFC7518 format - raw (r,s) */ in ecc_verify_hash_ex() 73 i = mp_unsigned_bin_size(key->dp.order); in ecc_verify_hash_ex() [all …]
|
| /optee_os/lib/libmbedtls/mbedtls/include/mbedtls/ |
| H A D | constant_time.h | 2 * Constant-time functions 6 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 14 /** Constant-time buffer comparison without branches. 18 * the time taken is constant w.r.t. the data pointed to by \p a and \p b, 19 * and w.r.t. whether \p a and \p b are equal or not. It is not constant-time 20 * w.r.t. \p n . 22 * This function can be used to write constant-time code by replacing branches 30 * otherwise non-zero.
|
| /optee_os/core/lib/libtomcrypt/src/hashes/sha2/ |
| H A D | sha512.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 84 /* compress 1024-bits */ 91 ulong64 S[8], W[80], t0, t1; in ss_sha512_compress() local 96 S[i] = md->sha512.state[i]; in ss_sha512_compress() 99 /* copy the state into 1024-bits into W[0..15] */ in ss_sha512_compress() 101 LOAD64H(W[i], buf + (8*i)); in ss_sha512_compress() 104 /* fill W[16..79] */ in ss_sha512_compress() 106 W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; in ss_sha512_compress() 112 t0 = S[7] + Sigma1(S[4]) + Ch(S[4], S[5], S[6]) + K[i] + W[i]; in ss_sha512_compress() [all …]
|
| H A D | sha256.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 59 /* compress 512-bits */ 66 ulong32 S[8], W[64], t0, t1; in ss_sha256_compress() local 74 S[i] = md->sha256.state[i]; in ss_sha256_compress() 77 /* copy the state into 512-bits into W[0..15] */ in ss_sha256_compress() 79 LOAD32H(W[i], buf + (4*i)); in ss_sha256_compress() 82 /* fill W[16..63] */ in ss_sha256_compress() 84 W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; in ss_sha256_compress() 90 t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ in ss_sha256_compress() [all …]
|
| /optee_os/lib/libutils/ext/arch/riscv/ |
| H A D | atomic_rv.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 3 * Copyright 2022-2023 NXP 11 amoadd.w.aqrl a2, a1, (a0) 18 li a1, -1 19 amoadd.w.aqrl a2, a1, (a0)
|
| /optee_os/core/arch/riscv/include/ |
| H A D | riscv_macros.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 3 * Copyright 2022-2023 NXP 12 * create a l(w,d)/s(w,d) instruction. 25 .if (\to_regnum - \from_regnum + 1) > 1 53 * Multiplication macro for RISC-V harts without M extension.
|
| /optee_os/core/lib/libtomcrypt/src/ciphers/ |
| H A D | skipjack.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 48 /* simple x - 1 (mod 10) in one step */ 76 skey->skipjack.key[x] = key[x] & 255; in skipjack_setup() 83 tmp = g_func(w1, &kp, skey->skipjack.key); \ 89 tmp = g_func(w1, &kp, skey->skipjack.key); \ 96 w1 = ig_func(w2, &kp, skey->skipjack.key); \ 100 tmp = ig_func(w2, &kp, skey->skipjack.key); \ 104 static unsigned g_func(unsigned w, int *kp, const unsigned char *key) in g_func() argument 108 g1 = (w >> 8) & 255; g2 = w & 255; in g_func() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/misc/base32/ |
| H A D | base32_decode.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 31 …13/*N*/,14/*O*/,15/*P*/,16/*Q*/,17/*R*/,18/*S*/,19/*T*/,20/*U*/,21/*V*/,22/*W*/,23/*X*/,24/*Y*/,25… in base32_decode() 37 …23/*N*/,24/*O*/,25/*P*/,26/*Q*/,27/*R*/,28/*S*/,29/*T*/,30/*U*/,31/*V*/,99/*W*/,99/*X*/,99/*Y*/,99… in base32_decode() 43 …2/*N*/,16/*O*/,13/*P*/,14/*Q*/, 4/*R*/,22/*S*/,17/*T*/,19/*U*/,99/*V*/,20/*W*/,15/*X*/, 0/*Y*/,23/… in base32_decode() 49 …21/*N*/, 0/*O*/,22/*P*/,23/*Q*/,24/*R*/,25/*S*/,26/*T*/,99/*U*/,27/*V*/,28/*W*/,29/*X*/,30/*Y*/,31… in base32_decode() 60 while (inlen > 0 && in[inlen-1] == '=') inlen--; in base32_decode() 86 if ((c >= 'a') && (c <= 'z')) c -= 32; in base32_decode() 87 if (c < '0' || c > 'Z' || map[c-'0'] > 31) { in base32_decode() 90 t = (t<<5) | map[c-'0']; in base32_decode() [all …]
|
| /optee_os/scripts/ |
| H A D | get_maintainer.py | 5 # SPDX-License-Identifier: BSD-2-Clause 17 DIFF_GIT_RE = re.compile(r'^diff --git a/(?P<path>.*) ') 18 REVIEWED_RE = re.compile(r'^Reviewed-by: (?P<approver>.*>)') 19 ACKED_RE = re.compile(r'^Acked-by: (?P<approver>.*>)') 20 PATCH_START = re.compile(r'^From [0-9a-f]{40}') 28 '(With -m) Check if a patch or pull ' 31 parser.add_argument('-m', '--merge-check', action='store_true', 32 help='use Reviewed-by: and Acked-by: tags found in ' 35 parser.add_argument('-p', '--show-paths', action='store_true', 37 parser.add_argument('-s', '--strict', action='store_true', [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/printable_string/ |
| H A D | der_length_printable_string.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 21 { '-', 45 }, 59 { 'W', 87 }, 85 { 'w', 119 }, 99 return -1; in der_printable_char_encode() 110 return -1; in der_printable_value_decode() 130 if (der_printable_char_encode(octets[x]) == -1) { in der_length_printable_string()
|
| /optee_os/core/include/mm/ |
| H A D | tee_mmu_types.h | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 39 * Device-nGnRnE most restrictive (equivalent to Strongly Ordered memory 41 * https://developer.arm.com/documentation/den0024/a/Memory-Ordering/Memory-types/Device-memory 43 * If an ARMv7 architecture operating system runs on a Cortex-A53 processor, 44 * the Device memory type matches the nGnRE encoding and the Strongly-Ordered 46 * https://developer.arm.com/documentation/den0024/a/Memory-Ordering/Memory-types/Device-memory 48 #define TEE_MATTR_MEM_TYPE_DEV U(0) /* Device-nGnRE */ 50 #define TEE_MATTR_MEM_TYPE_STRONGLY_O U(2) /* Device-nGnRnE */ 70 * The mapping should only be mapped read-only, not enforced by the vm_* 140 str[0] = (attr & TEE_MATTR_UR) ? 'r' : '-'; in mattr_perm_to_str() [all …]
|