| /optee_os/lib/libutils/isoc/include/ |
| H A D | stdint.h | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 3 * Copyright (c) 2014, STMicroelectronics International N.V. 38 /* 7.18.1.1 Exact-width interger types */ 68 /* 7.18.1.2 Minimum-width integer types */ 78 /* 7.18.1.3 Fastest minimum-width integer types */ 98 * 7.18.2 Limits of specified-width integer types 101 /* 7.18.2.1 Limits of exact-width interger types */ 103 #define INT8_MIN (-0x7f-1) 104 #define INT16_MIN (-0x7fff-1) 105 #define INT32_MIN (-0x7fffffff-1) [all …]
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| 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 119 V(A5, 63, 63, C6), V(84, 7C, 7C, F8), V(99, 77, 77, EE), V(8D, 7B, 7B, F6), \ 120 V(0D, F2, F2, FF), V(BD, 6B, 6B, D6), V(B1, 6F, 6F, DE), V(54, C5, C5, 91), \ 121 V(50, 30, 30, 60), V(03, 01, 01, 02), V(A9, 67, 67, CE), V(7D, 2B, 2B, 56), \ [all …]
|
| H A D | pkcs12.c | 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 10 …* http://www.rsa.com/rsalabs/pkcs/files/h11301-wp-pkcs-12v1-1-personal-information-exchange-synta… 11 * ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12v1-1.asn 40 unsigned char **p = ¶ms->p; in pkcs12_parse_pbe_params() 41 const unsigned char *end = params->p + params->len; in pkcs12_parse_pbe_params() 44 * pkcs-12PbeParams ::= SEQUENCE { in pkcs12_parse_pbe_params() 50 if (params->tag != (MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) { in pkcs12_parse_pbe_params() 55 if ((ret = mbedtls_asn1_get_tag(p, end, &salt->len, MBEDTLS_ASN1_OCTET_STRING)) != 0) { in pkcs12_parse_pbe_params() 59 salt->p = *p; in pkcs12_parse_pbe_params() 60 *p += salt->len; in pkcs12_parse_pbe_params() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/misc/pkcs12/ |
| H A D | pkcs12_kdf.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 14 unsigned long u = hash_descriptor[hash_id]->hashsize; in pkcs12_kdf() 15 unsigned long v = hash_descriptor[hash_id]->blocksize; in pkcs12_kdf() local 16 unsigned long c = (outlen + u - 1) / u; in pkcs12_kdf() 17 unsigned long Slen = ((saltlen + v - 1) / v) * v; in pkcs12_kdf() 18 unsigned long Plen = ((pwlen + v - 1) / v) * v; in pkcs12_kdf() 19 unsigned long k = (Plen + Slen) / v; in pkcs12_kdf() 36 for (i = 0; i < v; i++) D[i] = purpose; /* D - diversifier */ in pkcs12_kdf() 42 … err = hash_memory_multi(hash_id, A, &Alen, D, v, I, Slen + Plen, LTC_NULL); /* A = HASH(D || I) */ in pkcs12_kdf() [all …]
|
| /optee_os/lib/libutils/ext/include/ |
| H A D | util.h | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 3 * Copyright (c) 2014, STMicroelectronics International N.V. 55 ((((x) + (__typeof__(x))(y) - 1) / (__typeof__(x))(y)) * \ 59 #define ROUNDUP2(v, size) \ argument 62 (((v) + ((__typeof__(v))(size) - 1)) & \ 63 ~((__typeof__(v))(size) - 1)); \ 67 * ROUNDUP_OVERFLOW(v, size, res) 69 * @v: Input value to round 74 * Round up value @v to the even multiple of @size and return if result 78 #define ROUNDUP_OVERFLOW(v, size, res) \ argument [all …]
|
| /optee_os/core/lib/libtomcrypt/src/hashes/ |
| H A D | blake2s.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 5 BLAKE2 reference source code package - reference C implementations 11 - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 12 - OpenSSL license : https://www.openssl.org/source/license.html 13 - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 66 "blake2s-128", 81 "blake2s-160", 96 "blake2s-224", 111 "blake2s-256", [all …]
|
| H A D | blake2b.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 5 BLAKE2 reference source code package - reference C implementations 11 - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 12 - OpenSSL license : https://www.openssl.org/source/license.html 13 - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 68 "blake2b-160", 83 "blake2b-256", 98 "blake2b-384", 113 "blake2b-512", [all …]
|
| /optee_os/core/arch/arm/crypto/ |
| H A D | sha512_armv8a_ce_a64.S | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 7 /* Core SHA-384/SHA-512 transform using v8 Crypto Extensions */ 34 * The SHA-512 round constants 83 ld1 {v\rc1\().2d}, [x4], #16 85 add v5.2d, v\rc0\().2d, v\in0\().2d 86 ext v6.16b, v\i2\().16b, v\i3\().16b, #8 88 ext v7.16b, v\i1\().16b, v\i2\().16b, #8 89 add v\i3\().2d, v\i3\().2d, v5.2d 91 ext v5.16b, v\in3\().16b, v\in4\().16b, #8 92 sha512su0 v\in0\().2d, v\in1\().2d [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 */ 11 .arch armv8-a+crypto 35 add t1.4s, v\s0\().4s, \rc\().4s 44 add t0.4s, v\s0\().4s, \rc\().4s 52 sha1su0 v\s0\().4s, v\s1\().4s, v\s2\().4s 54 sha1su1 v\s0\().4s, v\s3\().4s 73 0: ld1 {v8.16b-v11.16b}, [x1], #64
|
| 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 */ 11 .arch armv8-a+crypto 31 add t1.4s, v\s0\().4s, \rc\().4s 36 add t0.4s, v\s0\().4s, \rc\().4s 44 sha256su0 v\s0\().4s, v\s1\().4s 46 sha256su1 v\s0\().4s, v\s2\().4s, v\s3\().4s 57 ld1 { v0.4s- v3.4s}, [x8], #64 58 ld1 { v4.4s- v7.4s}, [x8], #64 [all …]
|
| /optee_os/core/drivers/crypto/caam/include/ |
| H A D | caam_io.h | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 22 #define caam_write_val32(a, v) put_be32(a, v) argument 30 #define caam_write_val32(a, v) put_le32(a, v) argument 33 #define caam_write_val64(a, v) put_le64(a, v) argument
|
| /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 //===----------------------------------------------------------------------===// 23 static inline du_int udiv128by64to64default(du_int u1, du_int u0, du_int v, in udiv128by64to64default() argument 34 s = __builtin_clzll(v); in udiv128by64to64default() 37 v = v << s; in udiv128by64to64default() 38 un64 = (u1 << s) | (u0 >> (n_udword_bits - s)); in udiv128by64to64default() 46 // Break divisor up into two 32-bit digits. in udiv128by64to64default() 47 vn1 = v >> (n_udword_bits / 2); in udiv128by64to64default() [all …]
|
| /optee_os/core/arch/arm/plat-sunxi/ |
| H A D | main.c | 1 // SPDX-License-Identifier: BSD-2-Clause 103 vaddr_t v = (vaddr_t)phys_to_virt(SUNXI_TZPC_BASE, MEM_AREA_IO_SEC, in tzpc_init() local 106 DMSG("SMTA_DECPORT0=%x", io_read32(v + REG_TZPC_SMTA_DECPORT0_STA_REG)); in tzpc_init() 107 DMSG("SMTA_DECPORT1=%x", io_read32(v + REG_TZPC_SMTA_DECPORT1_STA_REG)); in tzpc_init() 108 DMSG("SMTA_DECPORT2=%x", io_read32(v + REG_TZPC_SMTA_DECPORT2_STA_REG)); in tzpc_init() 111 io_write32(v + REG_TZPC_SMTA_DECPORT0_SET_REG, 0xbe); in tzpc_init() 112 io_write32(v + REG_TZPC_SMTA_DECPORT1_SET_REG, 0xff); in tzpc_init() 113 io_write32(v + REG_TZPC_SMTA_DECPORT2_SET_REG, 0x7f); in tzpc_init() 115 DMSG("SMTA_DECPORT0=%x", io_read32(v + REG_TZPC_SMTA_DECPORT0_STA_REG)); in tzpc_init() 116 DMSG("SMTA_DECPORT1=%x", io_read32(v + REG_TZPC_SMTA_DECPORT1_STA_REG)); in tzpc_init() [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() 53 …if ((err = mp_invmod(s, key->q, w)) != CRYPT_OK) { goto erro… in dsa_verify_hash_raw() 57 …if ((err = mp_mulmod(u1, w, key->q, u1)) != CRYPT_OK) { goto erro… in dsa_verify_hash_raw() 60 …if ((err = mp_mulmod(r, w, key->q, u2)) != CRYPT_OK) { goto erro… in dsa_verify_hash_raw() [all …]
|
| /optee_os/core/kernel/ |
| H A D | boot.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2015-2023, Linaro Limited 20 uint32_t v; in get_dt_val_and_advance() local 22 memcpy(&v, (const uint8_t *)data + *offs, sizeof(v)); in get_dt_val_and_advance() 23 *offs += sizeof(v); in get_dt_val_and_advance() 24 rv = fdt32_to_cpu(v); in get_dt_val_and_advance() 26 uint64_t v; in get_dt_val_and_advance() local 28 memcpy(&v, (const uint8_t *)data + *offs, sizeof(v)); in get_dt_val_and_advance() 29 *offs += sizeof(v); in get_dt_val_and_advance() 30 rv = fdt64_to_cpu(v); in get_dt_val_and_advance() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/bit/ |
| H A D | der_decode_raw_bit_string.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 13 #define SETBIT(v, n) (v=((unsigned char)(v) | (1U << (unsigned char)(n)))) argument 14 #define CLRBIT(v, n) (v=((unsigned char)(v) & ~(1U << (unsigned char)(n)))) argument 48 y = inlen - 1; in der_decode_raw_bit_string() 54 if ((dlen == 0) || (dlen > (inlen - x))) { in der_decode_raw_bit_string() 59 blen = ((dlen - 1) << 3) - (in[x++] & 7); in der_decode_raw_bit_string() 69 if (in[x] & (1 << (7 - (y & 7)))) { in der_decode_raw_bit_string() 70 SETBIT(out[y/8], 7-(y%8)); in der_decode_raw_bit_string() 72 CLRBIT(out[y/8], 7-(y%8)); in der_decode_raw_bit_string()
|
| /optee_os/lib/libmbedtls/mbedtls/include/psa/ |
| H A D | crypto_struct.h | 10 * implementation-specific definitions. 13 * cryptography module, it is expected that the front-end and the back-end 32 * In particular, it is not guaranteed that a freshly-initialized structure 33 * is all-zero: we initialize structures to something like `{0, 0}`, which 46 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 58 * Include the build-time configuration information header. Here, we do not 61 * TF-PSA-Crypto repository which has a different build system and 66 /* Include the context definition for the compiled-in drivers for the primitive 75 * operation. Since driver contexts are driver-specific, swapping 77 * ID values are auto-generated in psa_driver_wrappers.h. [all …]
|
| /optee_os/lib/libutils/isoc/arch/arm/softfloat/source/ |
| H A D | s_shiftRightJam128Extra.c | 1 // SPDX-License-Identifier: BSD-3-Clause 5 This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic 51 negCount = -count; in softfloat_shiftRightJam128Extra() 53 z.v.v64 = a64>>count; in softfloat_shiftRightJam128Extra() 54 z.v.v0 = a64<<(negCount & 63) | a0>>count; in softfloat_shiftRightJam128Extra() 57 z.v.v64 = 0; in softfloat_shiftRightJam128Extra() 59 z.v.v0 = a64; in softfloat_shiftRightJam128Extra() 64 z.v.v0 = a64>>(count & 63); in softfloat_shiftRightJam128Extra() 67 z.v.v0 = 0; in softfloat_shiftRightJam128Extra()
|
| /optee_os/scripts/ |
| H A D | arm32_sysreg.py | 2 # SPDX-License-Identifier: BSD-2-Clause 75 print('\tuint64_t v;') 78 crm + '"' + ' : "=r" (v));') 80 print('\treturn v;') 89 '(uint64_t v)') 92 crm + '"' + ' : : "r" (v));') 103 print('\tuint32_t v;') 106 crm + ', ' + opc2 + '"' + ' : "=r" (v));') 108 print('\treturn v;') 117 '(uint32_t v)') [all …]
|
| /optee_os/lib/libutee/ |
| H A D | tee_uuid_from_str.c | 1 // SPDX-License-Identifier: BSD-2-Clause 17 return lc - '0'; in hex() 19 return lc - 'a' + 10; in hex() 20 return -1; in hex() 25 uint32_t v = 0; in parse_hex() local 31 if (c == -1) { in parse_hex() 35 v = (v << 4) + c; in parse_hex() 39 return v; in parse_hex() 51 if (p[8] != '-' || p[13] != '-' || p[18] != '-' || p[23] != '-') in tee_uuid_from_str()
|
| /optee_os/lib/libutee/include/ |
| H A D | riscv_user_sysreg.h | 1 /* SPDX-License-Identifier: BSD-2-Clause */ 12 register unsigned long v; \ 13 asm volatile ("csrr %0, " #csr : "=r"(v) : : "memory"); \ 14 v; \
|
| /optee_os/lib/libutils/ext/ |
| H A D | mempool.c | 1 // SPDX-License-Identifier: BSD-2-Clause 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 * Copyright (c) 2018-2019, Linaro Limited 29 * - the total size (in bytes) of the pool 30 * - the offset of the last item allocated in the pool (struct 31 * mempool_item). This offset is -1 is nothing is allocated yet. 34 * - the size of the item 35 * - the offsets, in the pool, of the previous and next items 40 * - the heap is never used. 41 * - there is no assumption on the size of the allocated memory buffers. Only [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| 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 …]
|
| H A D | ecc_sign_hash.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 33 int v = 0; in ecc_sign_hash_ex() local 44 if (key->type != PK_PRIVATE) { 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() 83 v = 0; in ecc_sign_hash_ex() 87 v += 2; in ecc_sign_hash_ex() 90 if (mp_isodd(pubkey.pubkey.y)) v += 1; in ecc_sign_hash_ex() [all …]
|
| /optee_os/.github/workflows/ |
| H A D | ci.yml | 6 group: ci-${{ github.ref }} # unique per branch 7 cancel-in-progress: true # cancel previous runs on the same branch 11 runs-on: ubuntu-latest 14 - name: Checkout 17 fetch-depth: 0 # full history so checkpatch can check commit IDs in commit messages 18 - name: Update Git config 19 run: git config --globa [all...] |