| /optee_os/core/lib/libtomcrypt/ |
| H A D | sm2-dsa.c | 27 ecc_key ltc_key = { }; in sm2_ltc_dsa_sign() local 50 res = ecc_populate_ltc_private_key(<c_key, key, algo, NULL); in sm2_ltc_dsa_sign() 62 ltc_res = rand_bn_upto(k, ltc_key.dp.order, NULL, in sm2_ltc_dsa_sign() 71 ltc_res = ltc_ecc_mulmod(k, <c_key.dp.base, x1y1p, ltc_key.dp.A, in sm2_ltc_dsa_sign() 72 ltc_key.dp.prime, 1); in sm2_ltc_dsa_sign() 81 ltc_res = mp_addmod(e, x1y1p->x, ltc_key.dp.order, r); in sm2_ltc_dsa_sign() 92 mp_cmp(tmp, ltc_key.dp.order) == LTC_MP_EQ) in sm2_ltc_dsa_sign() 97 ltc_res = mp_add_d(ltc_key.k, 1, s); in sm2_ltc_dsa_sign() 102 ltc_res = mp_invmod(s, ltc_key.dp.order, s); in sm2_ltc_dsa_sign() 107 ltc_res = mp_mul(r, ltc_key.k, tmp); in sm2_ltc_dsa_sign() [all …]
|
| H A D | rsa.c | 213 static TEE_Result rsadorep(rsa_key *ltc_key, const uint8_t *src, in rsadorep() argument 233 ltc_res = rsa_exptmod(src, src_len, buf, &blen, ltc_key->type, in rsadorep() 234 ltc_key); in rsadorep() 285 rsa_key ltc_key = { 0, }; in sw_crypto_acipher_rsanopad_encrypt() local 287 ltc_key.type = PK_PUBLIC; in sw_crypto_acipher_rsanopad_encrypt() 288 ltc_key.e = key->e; in sw_crypto_acipher_rsanopad_encrypt() 289 ltc_key.N = key->n; in sw_crypto_acipher_rsanopad_encrypt() 291 res = rsadorep(<c_key, src, src_len, dst, dst_len); in sw_crypto_acipher_rsanopad_encrypt() 307 rsa_key ltc_key = { 0, }; in sw_crypto_acipher_rsanopad_decrypt() local 309 ltc_key.type = PK_PRIVATE; in sw_crypto_acipher_rsanopad_decrypt() [all …]
|
| H A D | sm2-pke.c | 114 ecc_key ltc_key = { }; in sm2_ltc_pke_decrypt() local 137 res = ecc_populate_ltc_private_key(<c_key, key, TEE_ALG_SM2_PKE, in sm2_ltc_pke_decrypt() 150 res = sm2_bytes_to_point(C1, <c_key.dp, src, src_len, &C1_len); in sm2_ltc_pke_decrypt() 156 if (ltc_key.dp.cofactor != 1) { in sm2_ltc_pke_decrypt() 169 ltc_res = mp_set_int(h, ltc_key.dp.cofactor); in sm2_ltc_pke_decrypt() 175 ltc_res = ltc_ecc_mulmod(h, C1, S, ltc_key.dp.A, in sm2_ltc_pke_decrypt() 176 ltc_key.dp.prime, 1); in sm2_ltc_pke_decrypt() 182 ltc_res = ltc_ecc_is_point_at_infinity(S, ltc_key.dp.prime, in sm2_ltc_pke_decrypt() 185 ltc_res = ltc_ecc_is_point_at_infinity(C1, ltc_key.dp.prime, in sm2_ltc_pke_decrypt() 201 ltc_res = ltc_ecc_mulmod(ltc_key.k, C1, x2y2p, ltc_key.dp.A, in sm2_ltc_pke_decrypt() [all …]
|
| H A D | ecc.c | 113 static TEE_Result ecc_set_curve_from_name(ecc_key *ltc_key, in ecc_set_curve_from_name() argument 123 ltc_res = ecc_set_curve(curve, ltc_key); in ecc_set_curve_from_name() 188 TEE_Result ecc_populate_ltc_private_key(ecc_key *ltc_key, in ecc_populate_ltc_private_key() argument 199 memset(ltc_key, 0, sizeof(*ltc_key)); in ecc_populate_ltc_private_key() 201 res = ecc_set_curve_from_name(ltc_key, name); in ecc_populate_ltc_private_key() 205 ltc_key->type = PK_PRIVATE; in ecc_populate_ltc_private_key() 206 mp_copy(key->d, ltc_key->k); in ecc_populate_ltc_private_key() 207 mp_copy(key->x, ltc_key->pubkey.x); in ecc_populate_ltc_private_key() 208 mp_copy(key->y, ltc_key->pubkey.y); in ecc_populate_ltc_private_key() 209 mp_set_int(ltc_key->pubkey.z, 1); in ecc_populate_ltc_private_key() [all …]
|
| H A D | dsa.c | 103 dsa_key ltc_key = { in crypto_acipher_dsa_sign() local 124 if (mp_unsigned_bin_size(ltc_key.q) < hash_size) in crypto_acipher_dsa_sign() 125 hash_size = mp_unsigned_bin_size(ltc_key.q); in crypto_acipher_dsa_sign() 131 if (*sig_len < 2 * mp_unsigned_bin_size(ltc_key.q)) { in crypto_acipher_dsa_sign() 132 *sig_len = 2 * mp_unsigned_bin_size(ltc_key.q); in crypto_acipher_dsa_sign() 144 find_prng("prng_crypto"), <c_key); in crypto_acipher_dsa_sign() 147 *sig_len = 2 * mp_unsigned_bin_size(ltc_key.q); in crypto_acipher_dsa_sign() 171 dsa_key ltc_key = { in crypto_acipher_dsa_verify() local 194 ltc_res = dsa_verify_hash_raw(r, s, msg, msg_len, <c_stat, <c_key); in crypto_acipher_dsa_verify()
|
| H A D | acipher_helpers.h | 39 TEE_Result ecc_populate_ltc_private_key(ecc_key *ltc_key, 42 TEE_Result ecc_populate_ltc_public_key(ecc_key *ltc_key,
|