/optee_os-3.20.0/core/lib/libtomcrypt/src/ciphers/ |
A D | kseed.c | 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() 259 STORE32H(P[2], ct); in kseed_ecb_encrypt() 275 ulong32 P[4]; in kseed_ecb_decrypt() local 276 LOAD32H(P[0], ct); in kseed_ecb_decrypt() 277 LOAD32H(P[1], ct+4); in kseed_ecb_decrypt() [all …]
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/pk/ecc/ |
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 …]
|
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()
|
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-3.20.0/lib/libmbedtls/mbedtls/library/ |
A D | md5.c | 131 P( local.A, local.B, local.C, local.D, 0, 7, 0xD76AA478 ); in mbedtls_internal_md5_process() 132 P( local.D, local.A, local.B, local.C, 1, 12, 0xE8C7B756 ); in mbedtls_internal_md5_process() 133 P( local.C, local.D, local.A, local.B, 2, 17, 0x242070DB ); in mbedtls_internal_md5_process() 134 P( local.B, local.C, local.D, local.A, 3, 22, 0xC1BDCEEE ); in mbedtls_internal_md5_process() 135 P( local.A, local.B, local.C, local.D, 4, 7, 0xF57C0FAF ); in mbedtls_internal_md5_process() 136 P( local.D, local.A, local.B, local.C, 5, 12, 0x4787C62A ); in mbedtls_internal_md5_process() 137 P( local.C, local.D, local.A, local.B, 6, 17, 0xA8304613 ); in mbedtls_internal_md5_process() 138 P( local.B, local.C, local.D, local.A, 7, 22, 0xFD469501 ); in mbedtls_internal_md5_process() 139 P( local.A, local.B, local.C, local.D, 8, 7, 0x698098D8 ); in mbedtls_internal_md5_process() 140 P( local.D, local.A, local.B, local.C, 9, 12, 0x8B44F7AF ); in mbedtls_internal_md5_process() [all …]
|
A D | md4.c | 123 #define P(a,b,c,d,x,s) \ in mbedtls_internal_md4_process() macro 131 P( local.A, local.B, local.C, local.D, local.X[ 0], 3 ); in mbedtls_internal_md4_process() 132 P( local.D, local.A, local.B, local.C, local.X[ 1], 7 ); in mbedtls_internal_md4_process() 133 P( local.C, local.D, local.A, local.B, local.X[ 2], 11 ); in mbedtls_internal_md4_process() 134 P( local.B, local.C, local.D, local.A, local.X[ 3], 19 ); in mbedtls_internal_md4_process() 135 P( local.A, local.B, local.C, local.D, local.X[ 4], 3 ); in mbedtls_internal_md4_process() 148 #undef P in mbedtls_internal_md4_process() 152 #define P(a,b,c,d,x,s) \ in mbedtls_internal_md4_process() macro 176 #undef P in mbedtls_internal_md4_process() 180 #define P(a,b,c,d,x,s) \ in mbedtls_internal_md4_process() macro [all …]
|
A D | sha1.c | 173 P( local.E, local.A, local.B, local.C, local.D, R(16) ); in mbedtls_internal_sha1_process() 174 P( local.D, local.E, local.A, local.B, local.C, R(17) ); in mbedtls_internal_sha1_process() 175 P( local.C, local.D, local.E, local.A, local.B, R(18) ); in mbedtls_internal_sha1_process() 176 P( local.B, local.C, local.D, local.E, local.A, R(19) ); in mbedtls_internal_sha1_process() 184 P( local.A, local.B, local.C, local.D, local.E, R(20) ); in mbedtls_internal_sha1_process() 185 P( local.E, local.A, local.B, local.C, local.D, R(21) ); in mbedtls_internal_sha1_process() 186 P( local.D, local.E, local.A, local.B, local.C, R(22) ); in mbedtls_internal_sha1_process() 187 P( local.C, local.D, local.E, local.A, local.B, R(23) ); in mbedtls_internal_sha1_process() 188 P( local.B, local.C, local.D, local.E, local.A, R(24) ); in mbedtls_internal_sha1_process() 189 P( local.A, local.B, local.C, local.D, local.E, R(25) ); in mbedtls_internal_sha1_process() [all …]
|
A D | rsa_internal.c | 64 mbedtls_mpi *P, mbedtls_mpi *Q ) in mbedtls_rsa_deduce_primes() argument 88 if( P == NULL || Q == NULL || P->p != NULL || Q->p != NULL ) in mbedtls_rsa_deduce_primes() 135 if( mbedtls_mpi_cmp_int( P, 1 ) != 0 ) in mbedtls_rsa_deduce_primes() 154 if( mbedtls_mpi_cmp_int( P, 1 ) == 1 && in mbedtls_rsa_deduce_primes() 155 mbedtls_mpi_cmp_mpi( P, N ) == -1 ) in mbedtls_rsa_deduce_primes() 208 if( mbedtls_mpi_cmp_int( P, 1 ) <= 0 || in mbedtls_rsa_deduce_private_exponent() 256 if( P == NULL ) in mbedtls_rsa_validate_crt() 296 if( P == NULL || Q == NULL ) in mbedtls_rsa_validate_crt() 353 if( f_rng != NULL && P != NULL && in mbedtls_rsa_validate_params() 375 if( P != NULL && Q != NULL && N != NULL ) in mbedtls_rsa_validate_params() [all …]
|
A D | dhm.c | 147 ctx->len = mbedtls_mpi_size( &ctx->P ); in mbedtls_dhm_read_params() 173 if( mbedtls_mpi_cmp_int( &ctx->P, 0 ) == 0 ) in dhm_make_common() 196 &ctx->P , &ctx->RP ) ); in dhm_make_common() 239 n1 = mbedtls_mpi_size( &ctx->P ); in mbedtls_dhm_make_params() 244 DHM_MPI_EXPORT( &ctx->P , n1 ); in mbedtls_dhm_make_params() 262 const mbedtls_mpi *P, in mbedtls_dhm_set_group() argument 267 DHM_VALIDATE_RET( P != NULL ); in mbedtls_dhm_set_group() 270 if( ( ret = mbedtls_mpi_copy( &ctx->P, P ) ) != 0 || in mbedtls_dhm_set_group() 276 ctx->len = mbedtls_mpi_size( &ctx->P ); in mbedtls_dhm_set_group() 471 mbedtls_mpi_free( &ctx->P ); in mbedtls_dhm_free() [all …]
|
A D | ecp.c | 1527 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mod( grp, &S, &P->Z, &P->Z ) ); in ecp_double_jac() 1536 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mod( grp, &S, &P->X, &P->X ) ); in ecp_double_jac() 1551 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mod( grp, &T, &P->Y, &P->Y ) ); in ecp_double_jac() 1571 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mod( grp, &U, &P->Y, &P->Z ) ); in ecp_double_jac() 1639 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mod( grp, &T1, &P->Z, &P->Z ) ); in ecp_add_mixed() 2449 MBEDTLS_MPI_CHK( mbedtls_mpi_inv_mod( &P->Z, &P->Z, &grp->P ) ); in ecp_normalize_mxz() 2450 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mod( grp, &P->X, &P->X, &P->Z ) ); in ecp_normalize_mxz() 2484 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mod( grp, &P->X, &P->X, &l ) ); in ecp_randomize_mxz() 2485 MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mod( grp, &P->Z, &P->Z, &l ) ); in ecp_randomize_mxz() 2531 MBEDTLS_MPI_CHK( mbedtls_mpi_add_mod( grp, &A, &P->X, &P->Z ) ); in ecp_double_add_mxz() [all …]
|
A D | blowfish.c | 43 static const uint32_t P[MBEDTLS_BLOWFISH_ROUNDS + 2] = { variable 83 Xl = Xl ^ ctx->P[i]; in blowfish_enc() 95 Xr = Xr ^ ctx->P[MBEDTLS_BLOWFISH_ROUNDS]; in blowfish_enc() 96 Xl = Xl ^ ctx->P[MBEDTLS_BLOWFISH_ROUNDS + 1]; in blowfish_enc() 112 Xl = Xl ^ ctx->P[i]; in blowfish_dec() 124 Xr = Xr ^ ctx->P[1]; in blowfish_dec() 125 Xl = Xl ^ ctx->P[0]; in blowfish_dec() 182 ctx->P[i] = P[i] ^ data; in mbedtls_blowfish_setkey() 191 ctx->P[i] = datal; in mbedtls_blowfish_setkey() 192 ctx->P[i + 1] = datar; in mbedtls_blowfish_setkey()
|
A D | sha256.c | 165 #define P(a,b,c,d,e,f,g,h,x,K) \ macro 198 P( local.A[0], local.A[1], local.A[2], local.A[3], local.A[4], in mbedtls_internal_sha256_process() 213 P( local.A[0], local.A[1], local.A[2], local.A[3], local.A[4], in mbedtls_internal_sha256_process() 215 P( local.A[7], local.A[0], local.A[1], local.A[2], local.A[3], in mbedtls_internal_sha256_process() 217 P( local.A[6], local.A[7], local.A[0], local.A[1], local.A[2], in mbedtls_internal_sha256_process() 219 P( local.A[5], local.A[6], local.A[7], local.A[0], local.A[1], in mbedtls_internal_sha256_process() 221 P( local.A[4], local.A[5], local.A[6], local.A[7], local.A[0], in mbedtls_internal_sha256_process() 223 P( local.A[3], local.A[4], local.A[5], local.A[6], local.A[7], in mbedtls_internal_sha256_process() 225 P( local.A[2], local.A[3], local.A[4], local.A[5], local.A[6], in mbedtls_internal_sha256_process() 227 P( local.A[1], local.A[2], local.A[3], local.A[4], local.A[5], in mbedtls_internal_sha256_process() [all …]
|
A D | rsa.c | 88 ( P != NULL && ( ret = mbedtls_mpi_copy( &ctx->P, P ) ) != 0 ) || in mbedtls_rsa_import() 118 if( P != NULL ) in mbedtls_rsa_import_raw() 119 MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &ctx->P, P, P_len ) ); in mbedtls_rsa_import_raw() 366 if( P != NULL ) in mbedtls_rsa_export_raw() 367 MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( &ctx->P, P, P_len ) ); in mbedtls_rsa_export_raw() 411 ( P != NULL && ( ret = mbedtls_mpi_copy( P, &ctx->P ) ) != 0 ) || in mbedtls_rsa_export() 575 MBEDTLS_MPI_CHK( mbedtls_mpi_sub_int( &ctx->P, &ctx->P, 1 ) ); in mbedtls_rsa_gen_key() 597 MBEDTLS_MPI_CHK( mbedtls_mpi_add_int( &ctx->P, &ctx->P, 1 ) ); in mbedtls_rsa_gen_key() 1392 if( ctx->P.n == 0 ) in mbedtls_rsa_rsaes_oaep_decrypt() 1704 if( ctx->P.n == 0) in rsa_rsassa_pss_sign() [all …]
|
/optee_os-3.20.0/lib/libmbedtls/mbedtls/include/mbedtls/ |
A D | rsa_internal.h | 97 mbedtls_mpi *P, mbedtls_mpi *Q ); 120 int mbedtls_rsa_deduce_private_exponent( mbedtls_mpi const *P, 146 int mbedtls_rsa_deduce_crt( const mbedtls_mpi *P, const mbedtls_mpi *Q, 181 int mbedtls_rsa_validate_params( const mbedtls_mpi *N, const mbedtls_mpi *P, 216 int mbedtls_rsa_validate_crt( const mbedtls_mpi *P, const mbedtls_mpi *Q,
|
A D | ecp_internal.h | 170 mbedtls_ecp_point *R, const mbedtls_ecp_point *P, 195 mbedtls_ecp_point *R, const mbedtls_ecp_point *P ); 252 mbedtls_ecp_point *R, mbedtls_ecp_point *S, const mbedtls_ecp_point *P, 273 mbedtls_ecp_point *P, int (*f_rng)(void *, unsigned char *, size_t), 289 mbedtls_ecp_point *P );
|
A D | ecp.h | 267 mbedtls_mpi P; /*!< The prime modulus of the base field. */ member 672 int mbedtls_ecp_copy( mbedtls_ecp_point *P, const mbedtls_ecp_point *Q ); 722 int mbedtls_ecp_point_cmp( const mbedtls_ecp_point *P, 737 int mbedtls_ecp_point_read_string( mbedtls_ecp_point *P, int radix, 766 const mbedtls_ecp_point *P, 793 mbedtls_ecp_point *P, 964 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 998 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1039 const mbedtls_mpi *m, const mbedtls_ecp_point *P, 1084 const mbedtls_mpi *m, const mbedtls_ecp_point *P,
|
A D | rsa.h | 121 mbedtls_mpi P; /*!< The first prime factor. */ member 216 const mbedtls_mpi *P, const mbedtls_mpi *Q, 255 unsigned char const *P, size_t P_len, 335 mbedtls_mpi *N, mbedtls_mpi *P, mbedtls_mpi *Q, 387 unsigned char *P, size_t P_len,
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/encauth/ocb3/ |
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-3.20.0/core/lib/libtomcrypt/src/modes/xts/ |
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()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/misc/pkcs5/ |
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() 185 if((err = pkcs_5_alg1((unsigned char*)cases_5_1[i].P, cases_5_1[i].P_len, in pkcs_5_test() 202 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-3.20.0/core/lib/libtomcrypt/src/modes/lrw/ |
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-3.20.0/core/lib/libtomcrypt/src/hashes/ |
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()
|
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()
|
/optee_os-3.20.0/core/lib/libtomcrypt/src/math/ |
A D | tfm_desc.c | 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() 610 ltc_mp.copy(P->x, R->x); in tfm_ecc_projective_add_point() 611 ltc_mp.copy(P->y, R->y); in tfm_ecc_projective_add_point() 612 ltc_mp.copy(P->z, R->z); in tfm_ecc_projective_add_point() 620 (fp_cmp(P->y, Q->y) == FP_EQ || fp_cmp(P->y, &t1) == FP_EQ)) { in tfm_ecc_projective_add_point() 624 fp_copy(P->x, &x); in tfm_ecc_projective_add_point() 625 fp_copy(P->y, &y); in tfm_ecc_projective_add_point() [all …]
|
/optee_os-3.20.0/lib/libmbedtls/core/ |
A D | dh.c | 59 dhm.P = *(mbedtls_mpi *)key->p; in crypto_acipher_gen_dh_key() 91 mbedtls_mpi_init(&dhm.P); in crypto_acipher_gen_dh_key() 110 dhm.P = *(mbedtls_mpi *)private_key->p; in crypto_acipher_dh_shared_secret() 136 mbedtls_mpi_init(&dhm.P); in crypto_acipher_dh_shared_secret()
|