| /optee_os/core/lib/libtomcrypt/src/ciphers/ |
| H A D | kseed.c | 233 static void rounds(ulong32 *P, const ulong32 *K) in rounds() argument 238 F(P[0], P[1], P[2], P[3], K[0], K[1]); in rounds() 239 F(P[2], P[3], P[0], P[1], K[2], K[3]); in rounds() 253 ulong32 P[4]; in kseed_ecb_encrypt() local 254 LOAD32H(P[0], pt); in kseed_ecb_encrypt() 255 LOAD32H(P[1], pt+4); in kseed_ecb_encrypt() 256 LOAD32H(P[2], pt+8); in kseed_ecb_encrypt() 257 LOAD32H(P[3], pt+12); in kseed_ecb_encrypt() 258 rounds(P, skey->kseed.K); in kseed_ecb_encrypt() 259 STORE32H(P[2], ct); in kseed_ecb_encrypt() [all …]
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | md5.c | 91 #define P(a, b, c, d, k, s, t) \ in mbedtls_internal_md5_process() macro 105 P(local.A, local.B, local.C, local.D, 0, 7, 0xD76AA478); in mbedtls_internal_md5_process() 106 P(local.D, local.A, local.B, local.C, 1, 12, 0xE8C7B756); in mbedtls_internal_md5_process() 107 P(local.C, local.D, local.A, local.B, 2, 17, 0x242070DB); in mbedtls_internal_md5_process() 108 P(local.B, local.C, local.D, local.A, 3, 22, 0xC1BDCEEE); in mbedtls_internal_md5_process() 109 P(local.A, local.B, local.C, local.D, 4, 7, 0xF57C0FAF); in mbedtls_internal_md5_process() 110 P(local.D, local.A, local.B, local.C, 5, 12, 0x4787C62A); in mbedtls_internal_md5_process() 111 P(local.C, local.D, local.A, local.B, 6, 17, 0xA8304613); in mbedtls_internal_md5_process() 112 P(local.B, local.C, local.D, local.A, 7, 22, 0xFD469501); in mbedtls_internal_md5_process() 113 P(local.A, local.B, local.C, local.D, 8, 7, 0x698098D8); in mbedtls_internal_md5_process() [all …]
|
| H A D | sha1.c | 100 #define P(a, b, c, d, e, x) \ in mbedtls_internal_sha1_process() macro 116 P(local.A, local.B, local.C, local.D, local.E, local.W[0]); in mbedtls_internal_sha1_process() 117 P(local.E, local.A, local.B, local.C, local.D, local.W[1]); in mbedtls_internal_sha1_process() 118 P(local.D, local.E, local.A, local.B, local.C, local.W[2]); in mbedtls_internal_sha1_process() 119 P(local.C, local.D, local.E, local.A, local.B, local.W[3]); in mbedtls_internal_sha1_process() 120 P(local.B, local.C, local.D, local.E, local.A, local.W[4]); in mbedtls_internal_sha1_process() 121 P(local.A, local.B, local.C, local.D, local.E, local.W[5]); in mbedtls_internal_sha1_process() 122 P(local.E, local.A, local.B, local.C, local.D, local.W[6]); in mbedtls_internal_sha1_process() 123 P(local.D, local.E, local.A, local.B, local.C, local.W[7]); in mbedtls_internal_sha1_process() 124 P(local.C, local.D, local.E, local.A, local.B, local.W[8]); in mbedtls_internal_sha1_process() [all …]
|
| H A D | rsa_alt_helpers.c | 52 mbedtls_mpi *P, mbedtls_mpi *Q) in mbedtls_rsa_deduce_primes() argument 75 if (P == NULL || Q == NULL || P->p != NULL || Q->p != NULL) { in mbedtls_rsa_deduce_primes() 120 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes() 121 if (mbedtls_mpi_cmp_int(P, 1) != 0) { in mbedtls_rsa_deduce_primes() 139 MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N)); in mbedtls_rsa_deduce_primes() 141 if (mbedtls_mpi_cmp_int(P, 1) == 1 && in mbedtls_rsa_deduce_primes() 142 mbedtls_mpi_cmp_mpi(P, N) == -1) { in mbedtls_rsa_deduce_primes() 148 MBEDTLS_MPI_CHK(mbedtls_mpi_div_mpi(Q, NULL, N, P)); in mbedtls_rsa_deduce_primes() 182 int mbedtls_rsa_deduce_private_exponent(mbedtls_mpi const *P, in mbedtls_rsa_deduce_private_exponent() argument 194 if (mbedtls_mpi_cmp_int(P, 1) <= 0 || in mbedtls_rsa_deduce_private_exponent() [all …]
|
| H A D | psa_crypto_ffdh.c | 31 mbedtls_mpi *P, in mbedtls_psa_ffdh_set_prime_generator() argument 40 if (P == NULL && G == NULL) { in mbedtls_psa_ffdh_set_prime_generator() 120 if (P != NULL) { in mbedtls_psa_ffdh_set_prime_generator() 121 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(P, dhm_P, in mbedtls_psa_ffdh_set_prime_generator() 153 mbedtls_mpi GX, G, X, P; in mbedtls_psa_ffdh_export_public_key() local 168 mbedtls_mpi_init(&X); mbedtls_mpi_init(&P); in mbedtls_psa_ffdh_export_public_key() 172 status = mbedtls_psa_ffdh_set_prime_generator(key_len, &P, &G); in mbedtls_psa_ffdh_export_public_key() 181 MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&GX, &G, &X, &P, NULL)); in mbedtls_psa_ffdh_export_public_key() 188 mbedtls_mpi_free(&P); mbedtls_mpi_free(&G); in mbedtls_psa_ffdh_export_public_key() 205 mbedtls_mpi X, P; in mbedtls_psa_ffdh_generate_key() local [all …]
|
| H A D | dhm.c | 79 static int dhm_check_range(const mbedtls_mpi *param, const mbedtls_mpi *P) in dhm_check_range() argument 86 MBEDTLS_MPI_CHK(mbedtls_mpi_sub_int(&U, P, 2)); in dhm_check_range() 105 return mbedtls_mpi_bitlen(&ctx->P); in mbedtls_dhm_get_bitlen() 110 return mbedtls_mpi_size(&ctx->P); in mbedtls_dhm_get_len() 120 src = &ctx->P; in mbedtls_dhm_get_value() 152 if ((ret = dhm_read_bignum(&ctx->P, p, end)) != 0 || in mbedtls_dhm_read_params() 158 if ((ret = dhm_check_range(&ctx->GY, &ctx->P)) != 0) { in mbedtls_dhm_read_params() 186 if (mbedtls_mpi_cmp_int(&ctx->P, 0) == 0) { in dhm_make_common() 193 if ((unsigned) x_size < mbedtls_mpi_size(&ctx->P)) { in dhm_make_common() 197 ret = dhm_random_below(&ctx->X, &ctx->P, f_rng, p_rng); in dhm_make_common() [all …]
|
| H A D | ecp.c | 519 mbedtls_mpi_init(&grp->P); in mbedtls_ecp_group_init() 590 mbedtls_mpi_free(&grp->P); in mbedtls_ecp_group_free() 621 int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q) in mbedtls_ecp_copy() argument 624 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->X, &Q->X)); in mbedtls_ecp_copy() 625 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->Y, &Q->Y)); in mbedtls_ecp_copy() 626 MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&P->Z, &Q->Z)); in mbedtls_ecp_copy() 665 int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, in mbedtls_ecp_point_cmp() argument 668 if (mbedtls_mpi_cmp_mpi(&P->X, &Q->X) == 0 && in mbedtls_ecp_point_cmp() 669 mbedtls_mpi_cmp_mpi(&P->Y, &Q->Y) == 0 && in mbedtls_ecp_point_cmp() 670 mbedtls_mpi_cmp_mpi(&P->Z, &Q->Z) == 0) { in mbedtls_ecp_point_cmp() [all …]
|
| H A D | rsa_alt_helpers.h | 79 mbedtls_mpi *P, mbedtls_mpi *Q); 102 int mbedtls_rsa_deduce_private_exponent(mbedtls_mpi const *P, 128 int mbedtls_rsa_deduce_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q, 163 int mbedtls_rsa_validate_params(const mbedtls_mpi *N, const mbedtls_mpi *P, 198 int mbedtls_rsa_validate_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q,
|
| H A D | ecp_internal_alt.h | 156 mbedtls_ecp_point *R, const mbedtls_ecp_point *P, 181 mbedtls_ecp_point *R, const mbedtls_ecp_point *P); 240 const mbedtls_ecp_point *P, 262 mbedtls_ecp_point *P, int (*f_rng)(void *, 280 mbedtls_ecp_point *P);
|
| H A D | rsa.c | 576 const mbedtls_mpi *P, const mbedtls_mpi *Q, in mbedtls_rsa_import() argument 582 (P != NULL && (ret = mbedtls_mpi_copy(&ctx->P, P)) != 0) || in mbedtls_rsa_import() 598 unsigned char const *P, size_t P_len, in mbedtls_rsa_import_raw() argument 610 if (P != NULL) { in mbedtls_rsa_import_raw() 611 MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->P, P, P_len)); in mbedtls_rsa_import_raw() 670 (mbedtls_mpi_cmp_int(&ctx->P, 0) <= 0 || in rsa_check_context() 671 mbedtls_mpi_get_bit(&ctx->P, 0) == 0 || in rsa_check_context() 706 (mbedtls_mpi_cmp_int(&ctx->P, 0) <= 0 || in rsa_check_context() 734 have_P = (mbedtls_mpi_cmp_int(&ctx->P, 0) != 0); in mbedtls_rsa_complete() 772 if ((ret = mbedtls_mpi_mul_mpi(&ctx->N, &ctx->P, in mbedtls_rsa_complete() [all …]
|
| H A D | sha256.c | 477 #define P(a, b, c, d, e, f, g, h, x, K) \ macro 514 P(local.A[0], local.A[1], local.A[2], local.A[3], local.A[4], in mbedtls_internal_sha256_process_c() 529 P(local.A[0], local.A[1], local.A[2], local.A[3], local.A[4], in mbedtls_internal_sha256_process_c() 531 P(local.A[7], local.A[0], local.A[1], local.A[2], local.A[3], in mbedtls_internal_sha256_process_c() 533 P(local.A[6], local.A[7], local.A[0], local.A[1], local.A[2], in mbedtls_internal_sha256_process_c() 535 P(local.A[5], local.A[6], local.A[7], local.A[0], local.A[1], in mbedtls_internal_sha256_process_c() 537 P(local.A[4], local.A[5], local.A[6], local.A[7], local.A[0], in mbedtls_internal_sha256_process_c() 539 P(local.A[3], local.A[4], local.A[5], local.A[6], local.A[7], in mbedtls_internal_sha256_process_c() 541 P(local.A[2], local.A[3], local.A[4], local.A[5], local.A[6], in mbedtls_internal_sha256_process_c() 543 P(local.A[1], local.A[2], local.A[3], local.A[4], local.A[5], in mbedtls_internal_sha256_process_c() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| H A D | ltc_ecc_map.c | 20 int ltc_ecc_map(ecc_point *P, void *modulus, void *mp) in ltc_ecc_map() argument 25 LTC_ARGCHK(P != NULL); in ltc_ecc_map() 29 if (mp_iszero(P->z)) { in ltc_ecc_map() 30 return ltc_ecc_set_point_xyz(0, 0, 1, P); in ltc_ecc_map() 38 if ((err = mp_montgomery_reduce(P->z, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 41 if ((err = mp_invmod(P->z, modulus, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 50 if ((err = mp_mul(P->x, t2, P->x)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 51 if ((err = mp_montgomery_reduce(P->x, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 52 if ((err = mp_mul(P->y, t1, P->y)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 53 if ((err = mp_montgomery_reduce(P->y, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_map() [all …]
|
| H A D | ltc_ecc_is_point_at_infinity.c | 12 int ltc_ecc_is_point_at_infinity(const ecc_point *P, void *modulus, int *retval) in ltc_ecc_is_point_at_infinity() argument 18 if (!mp_iszero(P->z)) { in ltc_ecc_is_point_at_infinity() 24 if (mp_iszero(P->x) && mp_iszero(P->y)) { in ltc_ecc_is_point_at_infinity() 33 if ((err = mp_mulmod(P->y, P->y, modulus, y2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point_at_infinity() 36 if ((err = mp_mulmod(P->x, P->x, modulus, x3)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point_at_infinity() 37 if ((err = mp_mulmod(P->x, x3, modulus, x3)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point_at_infinity()
|
| H A D | ltc_ecc_projective_add_point.c | 23 int ltc_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, vo… in ltc_ecc_projective_add_point() argument 28 LTC_ARGCHK(P != NULL); in ltc_ecc_projective_add_point() 38 if ((err = ltc_ecc_is_point_at_infinity(P, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_projective_add_point() 48 err = ltc_ecc_copy_point(P, R); in ltc_ecc_projective_add_point() 52 if ((mp_cmp(P->x, Q->x) == LTC_MP_EQ) && (mp_cmp(P->z, Q->z) == LTC_MP_EQ)) { in ltc_ecc_projective_add_point() 53 if (mp_cmp(P->y, Q->y) == LTC_MP_EQ) { in ltc_ecc_projective_add_point() 56 return ltc_ecc_projective_dbl_point(P, R, ma, modulus, mp); in ltc_ecc_projective_add_point() 59 if (mp_cmp(P->y, t1) == LTC_MP_EQ) { in ltc_ecc_projective_add_point() 66 if ((err = mp_copy(P->x, x)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 67 if ((err = mp_copy(P->y, y)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/encauth/ocb3/ |
| H A D | ocb3_test.c | 186 const unsigned char P[] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, in ocb3_test() 251 P, sizeof(P), in ocb3_test() 257 compare_testvector(outct, sizeof(P), C, sizeof(C), "OCB3 CT", x)) { in ocb3_test() 269 if ((res != 1) || compare_testvector(outct, sizeof(C), P, sizeof(P), "OCB3", x)) { in ocb3_test() 280 if ((err = ocb3_encrypt(&ocb, P, 32, outct)) != CRYPT_OK) return err; in ocb3_test() 281 if ((err = ocb3_encrypt_last(&ocb, P+32, sizeof(P)-32, outct+32)) != CRYPT_OK) return err; in ocb3_test() 284 …if (compare_testvector(outct, sizeof(P), C, sizeof(C), "OCB3 CT", x)) return CRYPT_FAIL_T… in ocb3_test() 292 …if (compare_testvector(outct, sizeof(C), P, sizeof(P), "OCB3 PT", x)) return CRYPT_FAIL_T… in ocb3_test()
|
| /optee_os/core/lib/libtomcrypt/src/modes/xts/ |
| H A D | xts_decrypt.c | 11 static int s_tweak_uncrypt(const unsigned char *C, unsigned char *P, unsigned char *T, const symmet… in s_tweak_uncrypt() argument 19 …*(LTC_FAST_TYPE_PTR_CAST(&P[x])) = *(LTC_FAST_TYPE_PTR_CAST(&C[x])) ^ *(LTC_FAST_TYPE_PTR_CAST(&T[… in s_tweak_uncrypt() 23 P[x] = C[x] ^ T[x]; in s_tweak_uncrypt() 27 err = cipher_descriptor[xts->cipher]->ecb_decrypt(P, P, &xts->key1); in s_tweak_uncrypt() 31 *(LTC_FAST_TYPE_PTR_CAST(&P[x])) ^= *(LTC_FAST_TYPE_PTR_CAST(&T[x])); in s_tweak_uncrypt() 35 P[x] = P[x] ^ T[x]; in s_tweak_uncrypt()
|
| H A D | xts_encrypt.c | 11 static int s_tweak_crypt(const unsigned char *P, unsigned char *C, unsigned char *T, const symmetri… in s_tweak_crypt() argument 19 …*(LTC_FAST_TYPE_PTR_CAST(&C[x])) = *(LTC_FAST_TYPE_PTR_CAST(&P[x])) ^ *(LTC_FAST_TYPE_PTR_CAST(&T[… in s_tweak_crypt() 23 C[x] = P[x] ^ T[x]; in s_tweak_crypt()
|
| /optee_os/lib/libmbedtls/mbedtls/include/mbedtls/ |
| H A D | ecp.h | 237 mbedtls_mpi P; /*!< The prime modulus of the base field. */ member 682 int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q); 732 int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, 747 int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix, 776 const mbedtls_ecp_point *P, 806 mbedtls_ecp_point *P, 970 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1004 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1065 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1110 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
|
| H A D | rsa.h | 96 mbedtls_mpi MBEDTLS_PRIVATE(P); /*!< The first prime factor. */ 231 const mbedtls_mpi *P, const mbedtls_mpi *Q, 270 unsigned char const *P, size_t P_len, 350 mbedtls_mpi *N, mbedtls_mpi *P, mbedtls_mpi *Q, 402 unsigned char *P, size_t P_len,
|
| /optee_os/core/lib/libtomcrypt/src/misc/pkcs5/ |
| H A D | pkcs_5_test.c | 32 const char* P; in pkcs_5_test() 168 if((err = pkcs_5_alg2((unsigned char*)cases_5_2[i].P, cases_5_2[i].P_len, in pkcs_5_test() 186 if((err = pkcs_5_alg1((unsigned char*)cases_5_1[i].P, cases_5_1[i].P_len, in pkcs_5_test() 204 if ((err = pkcs_5_alg1_openssl((unsigned char*)cases_5_1o[i].P, cases_5_1o[i].P_len, in pkcs_5_test()
|
| /optee_os/core/lib/libtomcrypt/src/modes/lrw/ |
| H A D | lrw_test.c | 22 unsigned char key[16], tweak[16], IV[16], P[16], expected_tweak[16], C[16]; in lrw_test() 89 if ((err = lrw_encrypt(tests[x].P, buf[0], 16, &lrw)) != CRYPT_OK) { in lrw_test() 110 if (compare_testvector(buf[1], 16, tests[x].P, 16, "LRW Decrypt", x)) { in lrw_test()
|
| /optee_os/core/lib/libtomcrypt/src/hashes/ |
| H A D | blake2s.c | 174 static int s_blake2s_init_param(hash_state *md, const unsigned char *P) in s_blake2s_init_param() argument 183 LOAD32L(tmp, P + i * 4); in s_blake2s_init_param() 187 md->blake2s.outlen = P[O_DIGEST_LENGTH]; in s_blake2s_init_param() 206 unsigned char P[BLAKE2S_PARAM_SIZE]; in blake2s_init() local 218 XMEMSET(P, 0, sizeof(P)); in blake2s_init() 220 P[O_DIGEST_LENGTH] = (unsigned char)outlen; in blake2s_init() 221 P[O_KEY_LENGTH] = (unsigned char)keylen; in blake2s_init() 222 P[O_FANOUT] = 1; in blake2s_init() 223 P[O_DEPTH] = 1; in blake2s_init() 225 err = s_blake2s_init_param(md, P); in blake2s_init()
|
| H A D | blake2b.c | 180 static int s_blake2b_init_param(hash_state *md, const unsigned char *P) in s_blake2b_init_param() argument 189 LOAD64L(tmp, P + i * 8); in s_blake2b_init_param() 193 md->blake2b.outlen = P[O_DIGEST_LENGTH]; in s_blake2b_init_param() 212 unsigned char P[BLAKE2B_PARAM_SIZE]; in blake2b_init() local 224 XMEMSET(P, 0, sizeof(P)); in blake2b_init() 226 P[O_DIGEST_LENGTH] = (unsigned char)outlen; in blake2b_init() 227 P[O_KEY_LENGTH] = (unsigned char)keylen; in blake2b_init() 228 P[O_FANOUT] = 1; in blake2b_init() 229 P[O_DEPTH] = 1; in blake2b_init() 231 err = s_blake2b_init_param(md, P); in blake2b_init()
|
| /optee_os/core/lib/libtomcrypt/src/math/ |
| H A D | tfm_desc.c | 423 static int tfm_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, … in tfm_ecc_projective_dbl_point() argument 429 LTC_ARGCHK(P != NULL); in tfm_ecc_projective_dbl_point() 439 if (P != R) { in tfm_ecc_projective_dbl_point() 440 fp_copy(P->x, R->x); in tfm_ecc_projective_dbl_point() 441 fp_copy(P->y, R->y); in tfm_ecc_projective_dbl_point() 442 fp_copy(P->z, R->z); in tfm_ecc_projective_dbl_point() 445 if ((err = ltc_ecc_is_point_at_infinity(P, modulus, &inf)) != CRYPT_OK) return err; in tfm_ecc_projective_dbl_point() 578 static int tfm_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void … in tfm_ecc_projective_add_point() argument 584 LTC_ARGCHK(P != NULL); in tfm_ecc_projective_add_point() 598 if ((err = ltc_ecc_is_point_at_infinity(P, modulus, &inf)) != CRYPT_OK) return err; in tfm_ecc_projective_add_point() [all …]
|
| /optee_os/lib/libmbedtls/core/ |
| H A D | dh.c | 60 dhm.P = *(mbedtls_mpi *)key->p; in crypto_acipher_gen_dh_key() 92 mbedtls_mpi_init(&dhm.P); in crypto_acipher_gen_dh_key() 112 dhm.P = *(mbedtls_mpi *)private_key->p; in crypto_acipher_dh_shared_secret() 138 mbedtls_mpi_init(&dhm.P); in crypto_acipher_dh_shared_secret()
|