| /optee_os/lib/libmbedtls/mbedtls/include/mbedtls/ |
| H A D | bignum.h | 208 typedef struct mbedtls_mpi { struct 243 mbedtls_mpi; argument 255 void mbedtls_mpi_init(mbedtls_mpi *X); 256 void mbedtls_mpi_init_mempool(mbedtls_mpi *X); 265 void mbedtls_mpi_free(mbedtls_mpi *X); 280 int mbedtls_mpi_grow(mbedtls_mpi *X, size_t nblimbs); 297 int mbedtls_mpi_shrink(mbedtls_mpi *X, size_t nblimbs); 312 int mbedtls_mpi_copy(mbedtls_mpi *X, const mbedtls_mpi *Y); 320 void mbedtls_mpi_swap(mbedtls_mpi *X, mbedtls_mpi *Y); 350 int mbedtls_mpi_safe_cond_assign(mbedtls_mpi *X, const mbedtls_mpi *Y, unsigned char assign); [all …]
|
| H A D | rsa.h | 92 mbedtls_mpi MBEDTLS_PRIVATE(N); /*!< The public modulus. */ 93 mbedtls_mpi MBEDTLS_PRIVATE(E); /*!< The public exponent. */ 95 mbedtls_mpi MBEDTLS_PRIVATE(D); /*!< The private exponent. */ 96 mbedtls_mpi MBEDTLS_PRIVATE(P); /*!< The first prime factor. */ 97 mbedtls_mpi MBEDTLS_PRIVATE(Q); /*!< The second prime factor. */ 99 mbedtls_mpi MBEDTLS_PRIVATE(DP); /*!< <code>D % (P - 1)</code>. */ 100 mbedtls_mpi MBEDTLS_PRIVATE(DQ); /*!< <code>D % (Q - 1)</code>. */ 101 mbedtls_mpi MBEDTLS_PRIVATE(QP); /*!< <code>1 / (Q % P)</code>. */ 103 mbedtls_mpi MBEDTLS_PRIVATE(RN); /*!< cached <code>R^2 mod N</code>. */ 105 mbedtls_mpi MBEDTLS_PRIVATE(RP); /*!< cached <code>R^2 mod P</code>. */ [all …]
|
| H A D | dhm.h | 102 mbedtls_mpi MBEDTLS_PRIVATE(P); /*!< The prime modulus. */ 103 mbedtls_mpi MBEDTLS_PRIVATE(G); /*!< The generator. */ 104 mbedtls_mpi MBEDTLS_PRIVATE(X); /*!< Our secret value. */ 105 mbedtls_mpi MBEDTLS_PRIVATE(GX); /*!< Our public key = \c G^X mod \c P. */ 106 mbedtls_mpi MBEDTLS_PRIVATE(GY); /*!< The public key of the peer = \c G^Y mod \c P. */ 107 mbedtls_mpi MBEDTLS_PRIVATE(K); /*!< The shared secret = \c G^(XY) mod \c P. */ 108 mbedtls_mpi MBEDTLS_PRIVATE(RP); /*!< The cached value = \c R^2 mod \c P. */ 109 mbedtls_mpi MBEDTLS_PRIVATE(Vi); /*!< The blinding value. */ 110 mbedtls_mpi MBEDTLS_PRIVATE(Vf); /*!< The unblinding value. */ 111 mbedtls_mpi MBEDTLS_PRIVATE(pX); /*!< The previous \c X. */ [all …]
|
| H A D | ecdsa.h | 162 int mbedtls_ecdsa_sign(mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, 163 const mbedtls_mpi *d, const unsigned char *buf, size_t blen, 207 int mbedtls_ecdsa_sign_det_ext(mbedtls_ecp_group *grp, mbedtls_mpi *r, 208 mbedtls_mpi *s, const mbedtls_mpi *d, 273 mbedtls_mpi *r, mbedtls_mpi *s, 274 const mbedtls_mpi *d, 336 mbedtls_mpi *r, mbedtls_mpi *s, 337 const mbedtls_mpi *d, const unsigned char *buf, size_t blen, 377 const mbedtls_ecp_point *Q, const mbedtls_mpi *r, 378 const mbedtls_mpi *s); [all …]
|
| H A D | ecp.h | 161 mbedtls_mpi MBEDTLS_PRIVATE(X); /*!< The X coordinate of the ECP point. */ 162 mbedtls_mpi MBEDTLS_PRIVATE(Y); /*!< The Y coordinate of the ECP point. */ 163 mbedtls_mpi MBEDTLS_PRIVATE(Z); /*!< The Z coordinate of the ECP point. */ 237 mbedtls_mpi P; /*!< The prime modulus of the base field. */ 238 mbedtls_mpi A; /*!< For Short Weierstrass: \p A in the equation. Note that 243 mbedtls_mpi B; /*!< For Short Weierstrass: \p B in the equation. 246 mbedtls_mpi N; /*!< The order of \p G. */ 254 int(*MBEDTLS_PRIVATE(modp))(mbedtls_mpi *); /*!< The function for fast pseudo-reduction 432 mbedtls_mpi MBEDTLS_PRIVATE(d); /*!< our secret value */ 970 const mbedtls_mpi *m, const mbedtls_ecp_point *P, [all …]
|
| H A D | ecdh.h | 88 mbedtls_mpi MBEDTLS_PRIVATE(d); /*!< The private key. */ 91 mbedtls_mpi MBEDTLS_PRIVATE(z); /*!< The shared secret. */ 108 mbedtls_mpi MBEDTLS_PRIVATE(d); /*!< The private key. */ 111 mbedtls_mpi MBEDTLS_PRIVATE(z); /*!< The shared secret. */ 115 mbedtls_mpi MBEDTLS_PRIVATE(_d); /*!< The previous \p d. */ 191 int mbedtls_ecdh_gen_public(mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q, 226 int mbedtls_ecdh_compute_shared(mbedtls_ecp_group *grp, mbedtls_mpi *z, 227 const mbedtls_ecp_point *Q, const mbedtls_mpi *d,
|
| H A D | ecjpake.h | 72 mbedtls_mpi MBEDTLS_PRIVATE(xm1); /**< My private key 1 C: x1, S: x3 */ 73 mbedtls_mpi MBEDTLS_PRIVATE(xm2); /**< My private key 2 C: x2, S: x4 */ 75 mbedtls_mpi MBEDTLS_PRIVATE(s); /**< Pre-shared secret (passphrase) */
|
| /optee_os/lib/libmbedtls/mbedtls/library/ |
| H A D | rsa_alt_helpers.h | 77 int mbedtls_rsa_deduce_primes(mbedtls_mpi const *N, mbedtls_mpi const *E, 78 mbedtls_mpi const *D, 79 mbedtls_mpi *P, mbedtls_mpi *Q); 102 int mbedtls_rsa_deduce_private_exponent(mbedtls_mpi const *P, 103 mbedtls_mpi const *Q, 104 mbedtls_mpi const *E, 105 mbedtls_mpi *D); 128 int mbedtls_rsa_deduce_crt(const mbedtls_mpi *P, const mbedtls_mpi *Q, 129 const mbedtls_mpi *D, mbedtls_mpi *DP, 130 mbedtls_mpi *DQ, mbedtls_mpi *QP); [all …]
|
| H A D | rsa_alt_helpers.c | 50 int mbedtls_rsa_deduce_primes(mbedtls_mpi const *N, in mbedtls_rsa_deduce_primes() 51 mbedtls_mpi const *E, mbedtls_mpi const *D, in mbedtls_rsa_deduce_primes() 52 mbedtls_mpi *P, mbedtls_mpi *Q) in mbedtls_rsa_deduce_primes() 61 mbedtls_mpi T; /* Holds largest odd divisor of DE - 1 */ in mbedtls_rsa_deduce_primes() 62 mbedtls_mpi K; /* Temporary holding the current candidate */ in mbedtls_rsa_deduce_primes() 182 int mbedtls_rsa_deduce_private_exponent(mbedtls_mpi const *P, in mbedtls_rsa_deduce_private_exponent() 183 mbedtls_mpi const *Q, in mbedtls_rsa_deduce_private_exponent() 184 mbedtls_mpi const *E, in mbedtls_rsa_deduce_private_exponent() 185 mbedtls_mpi *D) in mbedtls_rsa_deduce_private_exponent() 188 mbedtls_mpi K, L; in mbedtls_rsa_deduce_private_exponent() [all …]
|
| H A D | bignum.c | 60 int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X, in mbedtls_mpi_lt_mpi_ct() 61 const mbedtls_mpi *Y, in mbedtls_mpi_lt_mpi_ct() 121 int mbedtls_mpi_safe_cond_assign(mbedtls_mpi *X, in mbedtls_mpi_safe_cond_assign() 122 const mbedtls_mpi *Y, in mbedtls_mpi_safe_cond_assign() 152 int mbedtls_mpi_safe_cond_swap(mbedtls_mpi *X, in mbedtls_mpi_safe_cond_swap() 153 mbedtls_mpi *Y, in mbedtls_mpi_safe_cond_swap() 190 static void mpi_init(mbedtls_mpi *X, short use_mempool) in mpi_init() 198 void mbedtls_mpi_init(mbedtls_mpi *X) in mbedtls_mpi_init() 203 void mbedtls_mpi_init_mempool(mbedtls_mpi *X) in mbedtls_mpi_init_mempool() 211 void mbedtls_mpi_free(mbedtls_mpi *X) in mbedtls_mpi_free() [all …]
|
| H A D | bignum_internal.h | 46 int mbedtls_mpi_exp_mod_unsafe(mbedtls_mpi *X, const mbedtls_mpi *A, 47 const mbedtls_mpi *E, const mbedtls_mpi *N, 48 mbedtls_mpi *prec_RR);
|
| H A D | ecdsa.c | 38 mbedtls_mpi u1, u2; /* intermediate values */ 76 mbedtls_mpi k; /* per-signature random */ 77 mbedtls_mpi r; /* r value */ 203 static int derive_mpi(const mbedtls_ecp_group *grp, mbedtls_mpi *x, in derive_mpi() 244 mbedtls_mpi *r, mbedtls_mpi *s, in mbedtls_ecdsa_sign_restartable() 245 const mbedtls_mpi *d, const unsigned char *buf, size_t blen, in mbedtls_ecdsa_sign_restartable() 254 mbedtls_mpi k, e, t; in mbedtls_ecdsa_sign_restartable() 255 mbedtls_mpi *pk = &k, *pr = r; in mbedtls_ecdsa_sign_restartable() 380 int mbedtls_ecdsa_sign(mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s, in mbedtls_ecdsa_sign() 381 const mbedtls_mpi *d, const unsigned char *buf, size_t blen, in mbedtls_ecdsa_sign() [all …]
|
| H A D | ecp.c | 317 static void mpi_init_many(mbedtls_mpi *arr, size_t size) in mpi_init_many() 324 static void mpi_free_many(mbedtls_mpi *arr, size_t size) in mpi_free_many() 765 const mbedtls_mpi *X, 766 mbedtls_mpi *Y, 1003 static int ecp_modp(mbedtls_mpi *N, const mbedtls_ecp_group *grp) in ecp_modp() 1060 mbedtls_mpi *X, in mbedtls_mpi_mul_mod() 1061 const mbedtls_mpi *A, in mbedtls_mpi_mul_mod() 1062 const mbedtls_mpi *B) in mbedtls_mpi_mul_mod() 1083 mbedtls_mpi *X, in mbedtls_mpi_sub_mod() 1084 const mbedtls_mpi *A, in mbedtls_mpi_sub_mod() [all …]
|
| H A D | dhm.c | 41 static int dhm_read_bignum(mbedtls_mpi *X, in dhm_read_bignum() 79 static int dhm_check_range(const mbedtls_mpi *param, const mbedtls_mpi *P) in dhm_check_range() 81 mbedtls_mpi U; in dhm_check_range() 115 mbedtls_mpi *dest) in mbedtls_dhm_get_value() 117 const mbedtls_mpi *src = NULL; in mbedtls_dhm_get_value() 168 static int dhm_random_below(mbedtls_mpi *R, const mbedtls_mpi *M, in dhm_random_below() 273 const mbedtls_mpi *P, in mbedtls_dhm_set_group() 274 const mbedtls_mpi *G) in mbedtls_dhm_set_group() 347 mbedtls_mpi R; in dhm_update_blinding() 411 mbedtls_mpi GYb; in mbedtls_dhm_calc_secret() [all …]
|
| H A D | ecjpake.c | 199 mbedtls_mpi *h) in ecjpake_hash() 254 mbedtls_mpi r, h; in ecjpake_zkp_read() 317 const mbedtls_mpi *x, in ecjpake_zkp_write() 327 mbedtls_mpi v; in ecjpake_zkp_write() 328 mbedtls_mpi h; /* later recycled to hold r */ in ecjpake_zkp_write() 415 mbedtls_mpi *x, in ecjpake_kkp_write() 487 mbedtls_mpi *xm1, in ecjpake_kkpp_write() 489 mbedtls_mpi *xm2, in ecjpake_kkpp_write() 549 mbedtls_mpi one; in ecjpake_ecp_add3() 621 static int ecjpake_mul_secret(mbedtls_mpi *R, int sign, in ecjpake_mul_secret() [all …]
|
| /optee_os/lib/libmbedtls/core/ |
| H A D | bignum.c | 22 return mbedtls_mpi_size((const mbedtls_mpi *)a); in crypto_bignum_num_bytes() 28 return mbedtls_mpi_bitlen((const mbedtls_mpi *)a); in crypto_bignum_num_bits() 37 ret = mbedtls_mpi_cmp_mpi((const mbedtls_mpi *)a, in crypto_bignum_compare() 38 (const mbedtls_mpi *)b); in crypto_bignum_compare() 49 if (mbedtls_mpi_write_binary((mbedtls_mpi *)from, to, len)) in crypto_bignum_bn2bin() 58 if (mbedtls_mpi_read_binary((mbedtls_mpi *)to, from, fromsize)) in crypto_bignum_bin2bn() 67 if (mbedtls_mpi_copy((mbedtls_mpi *)to, (const mbedtls_mpi *)from)) in crypto_bignum_copy() 73 mbedtls_mpi *bn = NULL; in crypto_bignum_allocate() 78 bn = calloc(1, sizeof(mbedtls_mpi)); in crypto_bignum_allocate() 94 mbedtls_mpi_free((mbedtls_mpi *)*s); in crypto_bignum_free() [all …]
|
| H A D | sm2-dsa.c | 33 mbedtls_mpi k = { }; in sm2_mbedtls_dsa_sign() 34 mbedtls_mpi e = { }; in sm2_mbedtls_dsa_sign() 35 mbedtls_mpi r = { }; in sm2_mbedtls_dsa_sign() 36 mbedtls_mpi s = { }; in sm2_mbedtls_dsa_sign() 37 mbedtls_mpi tmp = { }; in sm2_mbedtls_dsa_sign() 100 mres = mbedtls_mpi_add_int(&s, (mbedtls_mpi *)key->d, 1); in sm2_mbedtls_dsa_sign() 106 mres = mbedtls_mpi_mul_mpi(&tmp, &r, (mbedtls_mpi *)key->d); in sm2_mbedtls_dsa_sign() 156 mbedtls_mpi rprime = { }; in sm2_mbedtls_dsa_verify() 157 mbedtls_mpi sprime = { }; in sm2_mbedtls_dsa_verify() 158 mbedtls_mpi t = { }; in sm2_mbedtls_dsa_verify() [all …]
|
| H A D | sm2-kep.c | 21 mbedtls_mpi *x; 22 mbedtls_mpi *y; 258 xy->x = (mbedtls_mpi *)pair->x; in extract_xy_from_keypair() 259 xy->y = (mbedtls_mpi *)pair->y; in extract_xy_from_keypair() 266 xy->x = (mbedtls_mpi *)from->x; in extract_xy_from_public_key() 267 xy->y = (mbedtls_mpi *)from->y; in extract_xy_from_public_key() 296 mbedtls_mpi x1bar = { }; in crypto_acipher_sm2_kep_derive() 297 mbedtls_mpi x2bar = { }; in crypto_acipher_sm2_kep_derive() 298 mbedtls_mpi tA = { }; in crypto_acipher_sm2_kep_derive() 299 mbedtls_mpi h = { }; in crypto_acipher_sm2_kep_derive() [all …]
|
| H A D | dh.c | 59 dhm.G = *(mbedtls_mpi *)key->g; in crypto_acipher_gen_dh_key() 60 dhm.P = *(mbedtls_mpi *)key->p; in crypto_acipher_gen_dh_key() 111 dhm.G = *(mbedtls_mpi *)private_key->g; in crypto_acipher_dh_shared_secret() 112 dhm.P = *(mbedtls_mpi *)private_key->p; in crypto_acipher_dh_shared_secret() 113 dhm.GX = *(mbedtls_mpi *)private_key->y; in crypto_acipher_dh_shared_secret() 114 dhm.X = *(mbedtls_mpi *)private_key->x; in crypto_acipher_dh_shared_secret() 115 dhm.GY = *(mbedtls_mpi *)public_key; in crypto_acipher_dh_shared_secret()
|
| H A D | mbed_helpers.h | 30 TEE_Result mbed_gen_random_upto(mbedtls_mpi *n, mbedtls_mpi *max);
|
| H A D | mbed_helpers.c | 16 TEE_Result mbed_gen_random_upto(mbedtls_mpi *n, mbedtls_mpi *max) in mbed_gen_random_upto()
|
| H A D | ecc.c | 175 mbedtls_mpi r; in ecc_sign() 176 mbedtls_mpi s; in ecc_sign() 198 ecdsa.d = *(mbedtls_mpi *)key->d; in ecc_sign() 253 mbedtls_mpi r; in ecc_verify() 254 mbedtls_mpi s; in ecc_verify() 276 ecdsa.Q.X = *(mbedtls_mpi *)key->x; in ecc_verify() 277 ecdsa.Q.Y = *(mbedtls_mpi *)key->y; in ecc_verify() 334 ecdh.ctx.mbed_ecdh.d = *(mbedtls_mpi *)private_key->d; in ecc_shared_secret() 335 ecdh.ctx.mbed_ecdh.Qp.X = *(mbedtls_mpi *)public_key->x; in ecc_shared_secret() 336 ecdh.ctx.mbed_ecdh.Qp.Y = *(mbedtls_mpi *)public_key->y; in ecc_shared_secret()
|
| H A D | rsa.c | 105 rsa->E = *(mbedtls_mpi *)key->e; in rsa_complete_from_key_pair() 106 rsa->N = *(mbedtls_mpi *)key->n; in rsa_complete_from_key_pair() 107 rsa->D = *(mbedtls_mpi *)key->d; in rsa_complete_from_key_pair() 111 rsa->P = *(mbedtls_mpi *)key->p; in rsa_complete_from_key_pair() 112 rsa->Q = *(mbedtls_mpi *)key->q; in rsa_complete_from_key_pair() 113 rsa->QP = *(mbedtls_mpi *)key->qp; in rsa_complete_from_key_pair() 114 rsa->DP = *(mbedtls_mpi *)key->dp; in rsa_complete_from_key_pair() 115 rsa->DQ = *(mbedtls_mpi *)key->dq; in rsa_complete_from_key_pair() 300 mbedtls_mpi_write_binary((mbedtls_mpi *)key->e, in sw_crypto_acipher_gen_rsa_key() 352 rsa.E = *(mbedtls_mpi *)key->e; in sw_crypto_acipher_rsanopad_encrypt() [all …]
|
| /optee_os/lib/libutee/ |
| H A D | tee_api_arith_mpi.c | 60 static TEE_Result copy_mpi_to_bigint(mbedtls_mpi *mpi, TEE_BigInt *bigInt) in copy_mpi_to_bigint() 85 static void get_mpi(mbedtls_mpi *mpi, const TEE_BigInt *bigInt) in get_mpi() 144 mbedtls_mpi mpi_dest; in TEE_BigIntConvertFromOctetString() 176 mbedtls_mpi mpi; in TEE_BigIntConvertToOctetString() 208 mbedtls_mpi mpi; in TEE_BigIntConvertFromS32() 221 mbedtls_mpi mpi; in TEE_BigIntConvertToS32() 247 mbedtls_mpi mpi1; in TEE_BigIntCmp() 248 mbedtls_mpi mpi2; in TEE_BigIntCmp() 264 mbedtls_mpi mpi; in TEE_BigIntCmpS32() 278 mbedtls_mpi mpi_des in TEE_BigIntShiftRight() [all...] |
| /optee_os/core/lib/libtomcrypt/ |
| H A D | mpi_desc.c | 65 mbedtls_mpi *bn = mempool_alloc(mbedtls_mpi_mempool, sizeof(*bn)); in init() 82 mbedtls_mpi_free((mbedtls_mpi *)a); in deinit() 90 ((mbedtls_mpi *)b)->s *= -1; in neg() 118 mbedtls_mpi bn = { .s = 1, .n = 1, .p = &p }; in set_int() 127 mbedtls_mpi *bn = a; in get_int() 137 mbedtls_mpi *bn = a; in get_digit() 170 mbedtls_mpi bn; in compare_d() 285 mbedtls_mpi bn = { .s = 1, .n = 1, .p = &p }; in addi() 307 mbedtls_mpi bn = { .s = 1, .n = 1, .p = &p }; in subi() 365 mbedtls_mpi bn_b; in modi() [all …]
|