| /optee_os/core/lib/libtomcrypt/src/headers/ |
| H A D | tomcrypt_macros.h | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 9 /* ---- HELPER MACROS ---- */ 12 #define STORE32L(x, y) \ argument 13 do { (y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \ 14 (y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); } while(0) 16 #define LOAD32L(x, y) \ argument 17 do { x = ((ulong32)((y)[3] & 255)<<24) | \ 22 #define STORE64L(x, y) \ argument 23 do { (y)[7] = (unsigned char)(((x)>>56)&255); (y)[6] = (unsigned char)(((x)>>48)&255); \ [all …]
|
| H A D | tomcrypt_argchk.h | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 13 #define LTC_ARGCHK(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0) argument 14 #define LTC_ARGCHKVD(x) do { if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } }while(0) argument 19 #define LTC_ARGCHK(x) assert((x)) argument 20 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) argument 24 #define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, … argument 25 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) argument 29 #define LTC_ARGCHK(x) LTC_UNUSED_PARAM(x) argument 30 #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) argument [all …]
|
| /optee_os/core/lib/libtomcrypt/src/hashes/ |
| H A D | rmd128.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 10 /* Implementation of LTC_RIPEMD-128 based on the source by Antoon Bosselaers, ESAT-COSIC 37 #define F(x, y, z) ((x) ^ (y) ^ (z)) argument 38 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) argument 39 #define H(x, y, z) (((x) | ~(y)) ^ (z)) argument 40 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) argument 43 #define FF(a, b, c, d, x, s) \ argument 44 (a) += F((b), (c), (d)) + (x);\ 47 #define GG(a, b, c, d, x, s) \ argument [all …]
|
| H A D | rmd160.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 10 /* Implementation of LTC_RIPEMD-160 based on the source by Antoon Bosselaers, ESAT-COSIC 37 #define F(x, y, z) ((x) ^ (y) ^ (z)) argument 38 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) argument 39 #define H(x, y, z) (((x) | ~(y)) ^ (z)) argument 40 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) argument 41 #define J(x, y, z) ((x) ^ ((y) | ~(z))) argument 44 #define FF(a, b, c, d, e, x, s) \ argument 45 (a) += F((b), (c), (d)) + (x);\ [all …]
|
| H A D | rmd256.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 31 #define F(x, y, z) ((x) ^ (y) ^ (z)) argument 32 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) argument 33 #define H(x, y, z) (((x) | ~(y)) ^ (z)) argument 34 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) argument 37 #define FF(a, b, c, d, x, s) \ argument 38 (a) += F((b), (c), (d)) + (x);\ 41 #define GG(a, b, c, d, x, s) \ argument 42 (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\ [all …]
|
| H A D | rmd320.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 20 * http://oid-info.com/get/1.3.36.3.2 */ 32 #define F(x, y, z) ((x) ^ (y) ^ (z)) argument 33 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) argument 34 #define H(x, y, z) (((x) | ~(y)) ^ (z)) argument 35 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z))) argument 36 #define J(x, y, z) ((x) ^ ((y) | ~(z))) argument 39 #define FF(a, b, c, d, e, x, s) \ argument 40 (a) += F((b), (c), (d)) + (x);\ [all …]
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| 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 61 /* Ensure that the compiler cannot know the value of x (i.e., cannot optimise 75 * \param x The value to hide from the compiler. [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() 60 int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X, in mbedtls_mpi_lt_mpi_ct() argument 66 if (X->n != Y->n) { in mbedtls_mpi_lt_mpi_ct() [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 26 void mbedtls_mpi_mod_raw_cond_assign(mbedtls_mpi_uint *X, 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() 34 void mbedtls_mpi_mod_raw_cond_swap(mbedtls_mpi_uint *X, 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() 42 int mbedtls_mpi_mod_raw_read(mbedtls_mpi_uint *X, 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 …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/ocb/ |
| H A D | s_ocb_done.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 35 unsigned char *Z, *Y, *X; in s_ocb_done() local 36 int err, x; in s_ocb_done() local 43 if ((err = cipher_is_valid(ocb->cipher)) != CRYPT_OK) { in s_ocb_done() 46 if (ocb->block_len != cipher_descriptor[ocb->cipher]->block_length || in s_ocb_done() 47 (int)ptlen > ocb->block_len || (int)ptlen < 0) { in s_ocb_done() 54 X = XMALLOC(MAXBLOCKSIZE); in s_ocb_done() 55 if (X == NULL || Y == NULL || Z == NULL) { in s_ocb_done() 56 if (X != NULL) { in s_ocb_done() [all …]
|
| H A D | ocb_init.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 42 int poly, x, y, m, err; in ocb_init() local 54 ocb->block_len = cipher_descriptor[cipher]->block_length; in ocb_init() 55 x = (int)(sizeof(polys)/sizeof(polys[0])); in ocb_init() 56 for (poly = 0; poly < x; poly++) { in ocb_init() 57 if (polys[poly].len == ocb->block_len) { in ocb_init() 61 if (poly == x) { in ocb_init() 64 if (polys[poly].len != ocb->block_len) { in ocb_init() 69 if ((err = cipher_descriptor[cipher]->setup(key, keylen, 0, &ocb->key)) != CRYPT_OK) { in ocb_init() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/general/ |
| H A D | der_encode_asn1_length.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 20 unsigned long x, y; in der_encode_asn1_length() local 24 x = len; in der_encode_asn1_length() 27 while(x != 0) { in der_encode_asn1_length() 29 x >>= 8; in der_encode_asn1_length() 37 x = y; in der_encode_asn1_length() 39 x = y + 1; in der_encode_asn1_length() 45 x = 0; in der_encode_asn1_length() 47 out[x++] = (unsigned char)len; in der_encode_asn1_length() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/modes/lrw/ |
| H A D | lrw_process.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 16 @param len The length of the input, must be a multiple of 128-bits (16 octets) 24 int x, err; in lrw_process() local 39 XMEMCPY(prod, lrw->pad, 16); in lrw_process() 42 for (x = 15; x >= 0; x--) { in lrw_process() 43 lrw->IV[x] = (lrw->IV[x] + 1) & 255; in lrw_process() 44 if (lrw->IV[x]) { in lrw_process() 52 for (; x < 16; x++) { in lrw_process() 55 …YPE_PTR_CAST(lrw->pad + y)) ^= *(LTC_FAST_TYPE_PTR_CAST(&lrw->PC[x][lrw->IV[x]][y])) ^ *(LTC_FAST_… in lrw_process() [all …]
|
| /optee_os/core/lib/libfdt/include/ |
| H A D | libfdt_env.h | 1 /* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */ 5 * libfdt - Flat Device Tree manipulation 29 #define EXTRACT_BYTE(x, n) ((unsigned long long)((uint8_t *)&x)[n]) argument 30 #define CPU_TO_FDT16(x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1)) argument 31 #define CPU_TO_FDT32(x) ((EXTRACT_BYTE(x, 0) << 24) | (EXTRACT_BYTE(x, 1) << 16) | \ argument 32 (EXTRACT_BYTE(x, 2) << 8) | EXTRACT_BYTE(x, 3)) 33 #define CPU_TO_FDT64(x) ((EXTRACT_BYTE(x, 0) << 56) | (EXTRACT_BYTE(x, 1) << 48) | \ argument 34 (EXTRACT_BYTE(x, 2) << 40) | (EXTRACT_BYTE(x, 3) << 32) | \ 35 (EXTRACT_BYTE(x, 4) << 24) | (EXTRACT_BYTE(x, 5) << 16) | \ 36 (EXTRACT_BYTE(x, 6) << 8) | EXTRACT_BYTE(x, 7)) [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/set/ |
| H A D | der_encode_setof.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 21 unsigned long x; in s_qsort_helper() local 24 r = XMEMCMP(A->start, B->start, MIN(A->size, B->size)); in s_qsort_helper() 26 if (r == 0 && A->size != B->size) { in s_qsort_helper() 27 if (A->size > B->size) { in s_qsort_helper() 28 for (x = B->size; x < A->size; x++) { in s_qsort_helper() 29 if (A->start[x]) { in s_qsort_helper() 34 for (x = A->size; x < B->size; x++) { in s_qsort_helper() 35 if (B->start[x]) { in s_qsort_helper() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/choice/ |
| H A D | der_decode_choice.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 23 unsigned long size, x, z; in der_decode_choice() local 36 for (x = 0; x < outlen; x++) { in der_decode_choice() 37 list[x].used = 0; in der_decode_choice() 41 for (x = 0; x < outlen; x++) { in der_decode_choice() 42 size = list[x].size; in der_decode_choice() 43 data = list[x].data; in der_decode_choice() 45 switch (list[x].type) { in der_decode_choice() 49 list[x].used = 1; in der_decode_choice() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/ccm/ |
| H A D | ccm_test.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 108 unsigned long taglen, x, y; in ccm_test() 117 if (idx == -1) { in ccm_test() 119 if (idx == -1) { in ccm_test() 124 for (x = 0; x < (sizeof(tests)/sizeof(tests[0])); x++) { in ccm_test() 126 taglen = tests[x].taglen; in ccm_test() 128 if ((err = cipher_descriptor[idx]->setup(tests[x].key, 16, 0, &skey)) != CRYPT_OK) { in ccm_test() 133 tests[x].key, 16, in ccm_test() 135 tests[x].nonce, tests[x].noncelen, in ccm_test() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/generalizedtime/ |
| H A D | der_decode_generalizedtime.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 13 static int s_char_to_int(unsigned char x) in s_char_to_int() argument 15 switch (x) { in s_char_to_int() 31 y = s_char_to_int(buf[x])*10 + s_char_to_int(buf[x+1]); \ 33 x += 2; \ 37 …y = s_char_to_int(buf[x])*1000 + s_char_to_int(buf[x+1])*100 + s_char_to_int(buf[x+2])*10 + s_cha… 39 x += 4; \ 53 unsigned long x; in der_decode_generalizedtime() local 66 for (x = 0; x < in[1]; x++) { in der_decode_generalizedtime() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/sequence/ |
| H A D | der_length_sequence.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 30 unsigned long size, x, y, i; in der_length_sequence_ex() local 52 if ((err = der_length_boolean(&x)) != CRYPT_OK) { in der_length_sequence_ex() 55 y += x; in der_length_sequence_ex() 59 if ((err = der_length_integer(data, &x)) != CRYPT_OK) { in der_length_sequence_ex() 62 y += x; in der_length_sequence_ex() 66 if ((err = der_length_short_integer(*((unsigned long *)data), &x)) != CRYPT_OK) { in der_length_sequence_ex() 69 y += x; in der_length_sequence_ex() 74 if ((err = der_length_bit_string(size, &x)) != CRYPT_OK) { in der_length_sequence_ex() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/gcm/ |
| H A D | gcm_add_aad.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 22 unsigned long x; in gcm_add_aad() local 33 if (gcm->buflen > 16 || gcm->buflen < 0) { in gcm_add_aad() 37 if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) { in gcm_add_aad() 42 if (gcm->mode == LTC_GCM_MODE_IV) { in gcm_add_aad() 44 if (gcm->buflen == 0 && gcm->totlen == 0) return CRYPT_ERROR; in gcm_add_aad() 46 if (gcm->ivmode || gcm->buflen != 12) { in gcm_add_aad() 47 for (x = 0; x < (unsigned long)gcm->buflen; x++) { in gcm_add_aad() 48 gcm->X[x] ^= gcm->buf[x]; in gcm_add_aad() [all …]
|
| /optee_os/core/include/dt-bindings/firewall/ |
| H A D | stm32mp25-rif.h | 1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ 3 * Copyright (C) 2020-2024, STMicroelectronics - All Rights Reserved 65 #define RIF_EXTI1_RESOURCE(x) (x) argument 67 #define RIF_EXTI2_RESOURCE(x) (x) argument 69 #define RIF_FMC_CTRL(x) (x) argument 71 #define RIF_IOPORT_PIN(x) (x) argument 73 #define RIF_HPDMA_CHANNEL(x) (x) argument 75 #define RIF_IPCC_CPU1_CHANNEL(x) ((x) - 1) argument 77 #define RIF_IPCC_CPU2_CHANNEL(x) (((x) - 1) + 16) argument 79 #define RIF_PWR_RESOURCE(x) (x) argument [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/utf8/ |
| H A D | der_encode_utf8_string.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 24 unsigned long x, y, len; in der_encode_utf8_string() local 32 for (x = len = 0; x < inlen; x++) { in der_encode_utf8_string() 33 if (!der_utf8_valid_char(in[x])) return CRYPT_INVALID_ARG; in der_encode_utf8_string() 34 len += der_utf8_charsize(in[x]); in der_encode_utf8_string() 36 if ((err = der_length_asn1_length(len, &x)) != CRYPT_OK) { in der_encode_utf8_string() 39 x += len + 1; in der_encode_utf8_string() 42 if (x > *outlen) { in der_encode_utf8_string() 43 *outlen = x; in der_encode_utf8_string() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/mac/pmac/ |
| H A D | pmac_done.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 14 int err, x; in pmac_done() local 18 if ((err = cipher_is_valid(pmac->cipher_idx)) != CRYPT_OK) { in pmac_done() 22 if ((pmac->buflen > (int)sizeof(pmac->block)) || (pmac->buflen < 0) || in pmac_done() 23 (pmac->block_len > (int)sizeof(pmac->block)) || (pmac->buflen > pmac->block_len)) { in pmac_done() 28 /* handle padding. If multiple xor in L/x */ in pmac_done() 30 if (pmac->buflen == pmac->block_len) { in pmac_done() 32 for (x = 0; x < pmac->block_len; x++) { in pmac_done() 33 pmac->checksum[x] ^= pmac->block[x] ^ pmac->Lr[x]; in pmac_done() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/stream/salsa20/ |
| H A D | xsalsa20_setup.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 5 * "Extending the Salsa20 nonce", https://cr.yp.to/snuffle/xsalsa-20081128.pdf 7 * and salsa20-ref.c version 20051118 15 static const char * const constants = "expand 32-byte k"; 18 x[b] ^= (ROL((x[a] + x[d]), 7)); \ 19 x[c] ^= (ROL((x[b] + x[a]), 9)); \ 20 x[d] ^= (ROL((x[c] + x[b]), 13)); \ 21 x[a] ^= (ROL((x[d] + x[c]), 18)); 24 static void s_xsalsa20_doubleround(ulong32 *x, int rounds) in s_xsalsa20_doubleround() argument [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/asn1/der/custom_type/ |
| H A D | der_length_custom_type.c | 1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */ 2 /* SPDX-License-Identifier: Unlicense */ 16 root-ltc_asn1_list where the type is defined. 28 unsigned long size, x, y, i, inlen, id_len; in der_length_custom_type() local 40 if (root->pc == LTC_ASN1_PC_PRIMITIVE) { in der_length_custom_type() 44 list = root->data; in der_length_custom_type() 45 inlen = root->size; in der_length_custom_type() 48 if (root->pc == LTC_ASN1_PC_PRIMITIVE) { in der_length_custom_type() 65 if ((err = der_length_boolean(&x)) != CRYPT_OK) { in der_length_custom_type() 68 y += x; in der_length_custom_type() [all …]
|