/optee_os/lib/libmbedtls/mbedtls/library/ |
A D | ecp_curves.c | 955 p = N->p; in ecp_mod_p192() 1078 N->p[i] = ~(mbedtls_mpi_uint)0 - N->p[i]; in mbedtls_ecp_fix_negative() 1083 ++N->p[i]; in mbedtls_ecp_fix_negative() 1087 N->s = -1; in mbedtls_ecp_fix_negative() 1262 MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) ); in ecp_mod_p521() 1311 MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) ); in ecp_mod_p255() 1365 MBEDTLS_MPI_CHK( mbedtls_mpi_add_mpi( N, N, &M ) ); in ecp_mod_p448() 1372 MBEDTLS_MPI_CHK( mbedtls_mpi_add_mpi( N, N, &Q ) ); in ecp_mod_p448() 1382 MBEDTLS_MPI_CHK( mbedtls_mpi_add_mpi( N, N, &M ) ); in ecp_mod_p448() 1439 MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) ); in ecp_mod_koblitz() [all …]
|
A D | rsa_internal.c | 62 int mbedtls_rsa_deduce_primes( mbedtls_mpi const *N, in mbedtls_rsa_deduce_primes() argument 91 if( mbedtls_mpi_cmp_int( N, 0 ) <= 0 || in mbedtls_rsa_deduce_primes() 93 mbedtls_mpi_cmp_mpi( D, N ) >= 0 || in mbedtls_rsa_deduce_primes() 95 mbedtls_mpi_cmp_mpi( E, N ) >= 0 ) in mbedtls_rsa_deduce_primes() 126 if( N->p[0] % 8 == 1 ) in mbedtls_rsa_deduce_primes() 375 if( P != NULL && Q != NULL && N != NULL ) in mbedtls_rsa_validate_params() 378 if( mbedtls_mpi_cmp_int( N, 1 ) <= 0 || in mbedtls_rsa_validate_params() 379 mbedtls_mpi_cmp_mpi( &K, N ) != 0 ) in mbedtls_rsa_validate_params() 390 if( N != NULL && D != NULL && E != NULL ) in mbedtls_rsa_validate_params() 394 mbedtls_mpi_cmp_mpi( D, N ) >= 0 || in mbedtls_rsa_validate_params() [all …]
|
A D | rsa.c | 92 const mbedtls_mpi *N, in mbedtls_rsa_import() argument 99 if( ( N != NULL && ( ret = mbedtls_mpi_copy( &ctx->N, N ) ) != 0 ) || in mbedtls_rsa_import() 108 if( N != NULL ) in mbedtls_rsa_import() 124 if( N != NULL ) in mbedtls_rsa_import_raw() 126 MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &ctx->N, N, N_len ) ); in mbedtls_rsa_import_raw() 375 if( N != NULL ) in mbedtls_rsa_export_raw() 376 MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( &ctx->N, N, N_len ) ); in mbedtls_rsa_export_raw() 422 if( ( N != NULL && ( ret = mbedtls_mpi_copy( N, &ctx->N ) ) != 0 ) || in mbedtls_rsa_export() 719 if( mbedtls_mpi_cmp_mpi( &pub->N, &prv->N ) != 0 || in mbedtls_rsa_check_pub_priv() 2548 MBEDTLS_MPI_CHK( mbedtls_mpi_copy( &dst->N, &src->N ) ); in mbedtls_rsa_copy() [all …]
|
A D | bignum.c | 2193 mpi_montg_init( mm, N ); in mbedtls_mpi_montg_init() 2227 n = N->n; in mpi_montmul() 2268 mpi_montmul( A, B, N, mm, T); in mbedtls_mpi_montmul() 2291 mpi_montred( A, N, mm, T ); in mbedtls_mpi_montred() 2379 MPI_VALIDATE_RET( N != NULL ); in mbedtls_mpi_exp_mod() 2381 if( mbedtls_mpi_cmp_int( N, 0 ) <= 0 || ( N->p[0] & 1 ) == 0 ) in mbedtls_mpi_exp_mod() 2394 mpi_montg_init( &mm, N ); in mbedtls_mpi_exp_mod() 2409 j = N->n + 1; in mbedtls_mpi_exp_mod() 2477 mpi_montred( X, N, mm, &T ); in mbedtls_mpi_exp_mod() 2585 mpi_montred( X, N, mm, &T ); in mbedtls_mpi_exp_mod() [all …]
|
A D | ecdsa.c | 239 if( mbedtls_mpi_cmp_mpi( x, &grp->N ) >= 0 ) in derive_mpi() 240 MBEDTLS_MPI_CHK( mbedtls_mpi_sub_mpi( x, x, &grp->N ) ); in derive_mpi() 267 if( ! mbedtls_ecdsa_can_do( grp->id ) || grp->N.p == NULL ) in ecdsa_sign_restartable() 365 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( pk, pk, &grp->N ) ); in ecdsa_sign_restartable() 366 MBEDTLS_MPI_CHK( mbedtls_mpi_inv_mod( s, pk, &grp->N ) ); in ecdsa_sign_restartable() 368 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( s, s, &grp->N ) ); in ecdsa_sign_restartable() 614 if( ! mbedtls_ecdsa_can_do( grp->id ) || grp->N.p == NULL ) in ecdsa_verify_restartable() 652 MBEDTLS_MPI_CHK( mbedtls_mpi_inv_mod( &s_inv, s, &grp->N ) ); in ecdsa_verify_restartable() 655 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( pu1, pu1, &grp->N ) ); in ecdsa_verify_restartable() 658 MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( pu2, pu2, &grp->N ) ); in ecdsa_verify_restartable() [all …]
|
/optee_os/core/lib/libtomcrypt/src/math/ |
A D | rand_bn.c | 17 int rand_bn_bits(void *N, int bits, prng_state *prng, int wprng) in rand_bn_bits() argument 22 LTC_ARGCHK(N != NULL); in rand_bn_bits() 42 if ((res = mp_read_unsigned_bin(N, buf, bytes)) != CRYPT_OK) goto cleanup; in rand_bn_bits() 57 int rand_bn_upto(void *N, void *limit, prng_state *prng, int wprng) in rand_bn_upto() argument 61 LTC_ARGCHK(N != NULL); in rand_bn_upto() 66 res = rand_bn_bits(N, bits, prng, wprng); in rand_bn_upto() 68 } while (mp_cmp_d(N, 0) != LTC_MP_GT || mp_cmp(N, limit) != LTC_MP_LT); in rand_bn_upto()
|
A D | rand_prime.c | 21 int rand_prime(void *N, long len, prng_state *prng, int wprng) in rand_prime() argument 26 LTC_ARGCHK(N != NULL); in rand_prime() 64 if ((err = mp_read_unsigned_bin(N, buf, len)) != CRYPT_OK) { in rand_prime() 70 if ((err = mp_prime_is_prime(N, LTC_MILLER_RABIN_REPS, &res)) != CRYPT_OK) { in rand_prime()
|
/optee_os/core/lib/libtomcrypt/src/pk/rsa/ |
A D | rsa_exptmod.c | 68 if (mp_cmp(key->N, tmp) == LTC_MP_LT) { in rsa_exptmod() 77 err = mp_rand(rnd, mp_get_digit_count(key->N)); in rsa_exptmod() 83 err = mp_invmod(rnd, key->N, rndi); in rsa_exptmod() 89 err = mp_exptmod( rnd, key->e, key->N, rnd); in rsa_exptmod() 95 err = mp_mulmod( tmp, rnd, key->N, tmp); in rsa_exptmod() 112 …if ((err = mp_exptmod(tmp, key->d, key->N, tmp)) != CRYPT_OK) { goto … in rsa_exptmod() 131 err = mp_mulmod( tmp, rndi, key->N, tmp); in rsa_exptmod() 139 …if ((err = mp_exptmod(tmp, key->e, key->N, tmpa)) != CRYPT_OK) { goto… in rsa_exptmod() 146 …if ((err = mp_exptmod(tmp, key->e, key->N, tmp)) != CRYPT_OK) { got… in rsa_exptmod() 150 x = (unsigned long)mp_unsigned_bin_size(key->N); in rsa_exptmod() [all …]
|
A D | rsa_import.c | 38 if ((err = mp_init_multi(&key->e, &key->d, &key->N, &key->dQ, in rsa_import() 60 LTC_ASN1_INTEGER, 1UL, key->N, in rsa_import() 71 err = der_decode_sequence_multi(in, inlen, LTC_ASN1_INTEGER, 1UL, key->N, in rsa_import() 78 if (mp_cmp_d(key->N, 0) == LTC_MP_EQ) { in rsa_import() 85 LTC_ASN1_INTEGER, 1UL, key->N, in rsa_import() 99 } else if (mp_cmp_d(key->N, 1) == LTC_MP_EQ) { in rsa_import() 106 LTC_ASN1_INTEGER, 1UL, key->N, in rsa_import() 117 mp_clear_multi(key->d, key->e, key->N, key->dQ, key->dP, key->qP, key->p, key->q, NULL); in rsa_import()
|
A D | rsa_set.c | 27 int rsa_set_key(const unsigned char *N, unsigned long Nlen, in rsa_set_key() argument 35 LTC_ARGCHK(N != NULL); in rsa_set_key() 39 …err = mp_init_multi(&key->e, &key->d, &key->N, &key->dQ, &key->dP, &key->qP, &key->p, &key->q, NUL… in rsa_set_key() 42 …if ((err = mp_read_unsigned_bin(key->N , (unsigned char *)N , Nlen)) != CRYPT_OK) { goto LBL_ER… in rsa_set_key()
|
A D | rsa_export.c | 49 LTC_ASN1_INTEGER, 1UL, key->N, in rsa_export() 66 tmplen = (unsigned long)(mp_count_bits(key->N) / 8) * 2 + 8; in rsa_export() 79 LTC_ASN1_INTEGER, 1UL, key->N, in rsa_export()
|
/optee_os/core/lib/libtomcrypt/src/encauth/ocb3/ |
A D | ocb3_test.c | 186 const unsigned char N[] = { 0xBB,0xAA,0x99,0x88,0x77,0x66,0x55,0x44, in ocb3_test() 256 N, sizeof(N), in ocb3_test() 270 N, sizeof(N), in ocb3_test() 285 if ((err = ocb3_init(&ocb, idx, K, sizeof(K), N, sizeof(N), 12)) != CRYPT_OK) return err; in ocb3_test() 293 if ((err = ocb3_init(&ocb, idx, K, sizeof(K), N, sizeof(N), 12)) != CRYPT_OK) return err; in ocb3_test()
|
/optee_os/core/lib/libtomcrypt/src/ciphers/ |
A D | anubis.c | 891 int N, R, i, pos, r; in _anubis_setup() local 909 N = skey->anubis.keyBits >> 5; in _anubis_setup() 914 skey->anubis.R = R = 8 + N; in _anubis_setup() 923 for (i = 0, pos = 0; i < N; i++, pos += 4) { in _anubis_setup() 938 K0 = T4[(kappa[N - 1] >> 24) & 0xff]; in _anubis_setup() 939 K1 = T4[(kappa[N - 1] >> 16) & 0xff]; in _anubis_setup() 940 K2 = T4[(kappa[N - 1] >> 8) & 0xff]; in _anubis_setup() 941 K3 = T4[(kappa[N - 1] ) & 0xff]; in _anubis_setup() 942 for (i = N - 2; i >= 0; i--) { in _anubis_setup() 985 for (i = 0; i < N; i++) { in _anubis_setup() [all …]
|
A D | multi2.c | 81 static void encrypt(ulong32 *p, int N, const ulong32 *uk) in encrypt() argument 85 pi1(p); if (++n == N) break; in encrypt() 86 pi2(p, uk+t); if (++n == N) break; in encrypt() 87 pi3(p, uk+t); if (++n == N) break; in encrypt() 88 pi4(p, uk+t); if (++n == N) break; in encrypt() 93 static void decrypt(ulong32 *p, int N, const ulong32 *uk) in decrypt() argument 96 for (t = 4*(((N-1)>>2)&1), n = N; ; ) { in decrypt() 132 skey->multi2.N = num_rounds; in multi2_setup() 160 encrypt(p, skey->multi2.N, skey->multi2.uk); in multi2_ecb_encrypt() 181 decrypt(p, skey->multi2.N, skey->multi2.uk); in multi2_ecb_decrypt()
|
/optee_os/lib/libmbedtls/core/ |
A D | sm2-dsa.c | 67 res = mbed_gen_random_upto(&k, &grp.N); in sm2_mbedtls_dsa_sign() 86 mres = mbedtls_mpi_mod_mpi(&r, &r, &grp.N); in sm2_mbedtls_dsa_sign() 96 !mbedtls_mpi_cmp_mpi(&tmp, &grp.N)); in sm2_mbedtls_dsa_sign() 103 mres = mbedtls_mpi_inv_mod(&s, &s, &grp.N); in sm2_mbedtls_dsa_sign() 109 mres = mbedtls_mpi_mod_mpi(&tmp, &tmp, &grp.N); in sm2_mbedtls_dsa_sign() 118 mres = mbedtls_mpi_mod_mpi(&s, &s, &grp.N); in sm2_mbedtls_dsa_sign() 194 mbedtls_mpi_cmp_mpi(&rprime, &grp.N) >= 0) { in sm2_mbedtls_dsa_verify() 202 mbedtls_mpi_cmp_mpi(&sprime, &grp.N) >= 0) { in sm2_mbedtls_dsa_verify() 217 mres = mbedtls_mpi_mod_mpi(&t, &t, &grp.N); in sm2_mbedtls_dsa_verify() 249 mres = mbedtls_mpi_mod_mpi(&R, &R, &grp.N); in sm2_mbedtls_dsa_verify()
|
A D | rsa.c | 101 rsa->N = *(mbedtls_mpi *)key->n; in rsa_init_from_key_pair() 110 rsa->len = mbedtls_mpi_size(&rsa->N); in rsa_init_from_key_pair() 117 mbedtls_mpi_init(&rsa->N); in mbd_rsa_free() 226 crypto_bignum_copy(key->n, (void *)&rsa.N); in crypto_acipher_gen_rsa_key() 257 rsa.N = *(mbedtls_mpi *)key->n; in crypto_acipher_rsanopad_encrypt() 259 rsa.len = crypto_bignum_num_bytes((void *)&rsa.N); in crypto_acipher_rsanopad_encrypt() 294 mbedtls_mpi_init(&rsa.N); in crypto_acipher_rsanopad_encrypt() 457 rsa.N = *(mbedtls_mpi *)key->n; in crypto_acipher_rsaes_encrypt() 504 mbedtls_mpi_init(&rsa.N); in crypto_acipher_rsaes_encrypt() 616 rsa.N = *(mbedtls_mpi *)key->n; in crypto_acipher_rsassa_verify() [all …]
|
/optee_os/core/lib/libtomcrypt/src/stream/sober128/ |
A D | sober128_stream.c | 24 #define N 17 macro 47 #define OFF(zero, i) (((zero)+(i)) % N) 61 for (i = 1; i < N; ++i) { in cycle() 64 R[N-1] = t; in cycle() 91 for (i = 0; i < N; ++i) { in s128_savestate() 102 for (i = 0; i < N; ++i) { in s128_reloadstate() 176 for (i = 2; i < N; ++i) { in sober128_stream_setup() 270 while (inlen >= N*4) { in sober128_stream_crypt() 288 out += 4*N; in sober128_stream_crypt() 289 in += 4*N; in sober128_stream_crypt() [all …]
|
/optee_os/core/lib/libtomcrypt/src/pk/dsa/ |
A D | dsa_generate_pqg.c | 32 unsigned long L, N, n, outbytes, seedbytes, counter, j, i; in _dsa_make_params() local 77 N = (unsigned long)group_size * 8; in _dsa_make_params() 83 if (N <= 160) { mr_tests_q = 19; } in _dsa_make_params() 84 else if (N <= 224) { mr_tests_q = 24; } in _dsa_make_params() 92 if (N <= 160) { mr_tests_q = 40; } in _dsa_make_params() 93 else if (N <= 224) { mr_tests_q = 56; } in _dsa_make_params() 97 if (N <= 256) { in _dsa_make_params() 100 else if (N <= 384) { in _dsa_make_params() 103 else if (N <= 512) { in _dsa_make_params() 123 if ((err = mp_2expt(t2N1, N-1)) != CRYPT_OK) { goto cleanup; } in _dsa_make_params()
|
/optee_os/core/lib/libtomcrypt/src/misc/hkdf/ |
A D | hkdf.c | 44 unsigned char N; in hkdf_expand() local 79 N = 0; in hkdf_expand() 83 T[Tlen - 1] = ++N; in hkdf_expand() 97 XMEMCPY(T, out + hashsize * (N-1), hashsize); in hkdf_expand() 98 if (N == 1) { in hkdf_expand()
|
/optee_os/core/lib/libtomcrypt/ |
A D | rsa.c | 165 ltc_mp.copy(ltc_tmp_key.N, key->n); in crypto_acipher_gen_rsa_key() 250 ltc_key.N = key->n; in crypto_acipher_rsanopad_encrypt() 265 ltc_key.N = key->n; in crypto_acipher_rsanopad_decrypt() 294 ltc_key.N = key->n; in crypto_acipher_rsaes_decrypt() 316 mod_size = ltc_mp.unsigned_size((void *)(ltc_key.N)); in crypto_acipher_rsaes_decrypt() 387 .N = key->n in crypto_acipher_rsaes_encrypt() 390 mod_size = ltc_mp.unsigned_size((void *)(ltc_key.N)); in crypto_acipher_rsaes_encrypt() 445 ltc_key.N = key->n; in crypto_acipher_rsassa_sign() 497 mod_size = ltc_mp.unsigned_size((void *)(ltc_key.N)); in crypto_acipher_rsassa_sign() 536 .N = key->n in crypto_acipher_rsassa_verify() [all …]
|
/optee_os/out/arm/export-ta_arm32/host_include/mbedtls/ |
A D | bignum.h | 854 const mbedtls_mpi *E, const mbedtls_mpi *N, 912 const mbedtls_mpi *N, 947 const mbedtls_mpi *N ); 1050 void mbedtls_mpi_montg_init( mbedtls_mpi_uint *mm, const mbedtls_mpi *N ); 1061 const mbedtls_mpi *N, mbedtls_mpi_uint mm, 1071 void mbedtls_mpi_montred( mbedtls_mpi *A, const mbedtls_mpi *N,
|
/optee_os/out/arm/export-ta_arm32/include/mbedtls/ |
A D | bignum.h | 854 const mbedtls_mpi *E, const mbedtls_mpi *N, 912 const mbedtls_mpi *N, 947 const mbedtls_mpi *N ); 1050 void mbedtls_mpi_montg_init( mbedtls_mpi_uint *mm, const mbedtls_mpi *N ); 1061 const mbedtls_mpi *N, mbedtls_mpi_uint mm, 1071 void mbedtls_mpi_montred( mbedtls_mpi *A, const mbedtls_mpi *N,
|
/optee_os/lib/libmbedtls/mbedtls/include/mbedtls/ |
A D | bignum.h | 854 const mbedtls_mpi *E, const mbedtls_mpi *N, 912 const mbedtls_mpi *N, 947 const mbedtls_mpi *N ); 1050 void mbedtls_mpi_montg_init( mbedtls_mpi_uint *mm, const mbedtls_mpi *N ); 1061 const mbedtls_mpi *N, mbedtls_mpi_uint mm, 1071 void mbedtls_mpi_montred( mbedtls_mpi *A, const mbedtls_mpi *N,
|
/optee_os/out/arm/export-ta_arm64/include/mbedtls/ |
A D | bignum.h | 854 const mbedtls_mpi *E, const mbedtls_mpi *N, 912 const mbedtls_mpi *N, 947 const mbedtls_mpi *N ); 1050 void mbedtls_mpi_montg_init( mbedtls_mpi_uint *mm, const mbedtls_mpi *N ); 1061 const mbedtls_mpi *N, mbedtls_mpi_uint mm, 1071 void mbedtls_mpi_montred( mbedtls_mpi *A, const mbedtls_mpi *N,
|
/optee_os/out/arm/export-ta_arm64/host_include/mbedtls/ |
A D | bignum.h | 854 const mbedtls_mpi *E, const mbedtls_mpi *N, 912 const mbedtls_mpi *N, 947 const mbedtls_mpi *N ); 1050 void mbedtls_mpi_montg_init( mbedtls_mpi_uint *mm, const mbedtls_mpi *N ); 1061 const mbedtls_mpi *N, mbedtls_mpi_uint mm, 1071 void mbedtls_mpi_montred( mbedtls_mpi *A, const mbedtls_mpi *N,
|