| /optee_os/core/lib/libtomcrypt/ |
| H A D | sm2-dsa.c | 28 int ltc_res = 0; in sm2_ltc_dsa_sign() local 40 ltc_res = mp_init_multi(&k, &e, &r, &s, &tmp, NULL); in sm2_ltc_dsa_sign() 41 if (ltc_res != CRYPT_OK) in sm2_ltc_dsa_sign() 62 ltc_res = rand_bn_upto(k, ltc_key.dp.order, NULL, in sm2_ltc_dsa_sign() 64 if (ltc_res != CRYPT_OK) { 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() 73 if (ltc_res != CRYPT_OK) { in sm2_ltc_dsa_sign() 81 ltc_res = mp_addmod(e, x1y1p->x, ltc_key.dp.order, r); in sm2_ltc_dsa_sign() 82 if (ltc_res != CRYPT_OK) { in sm2_ltc_dsa_sign() 86 ltc_res = mp_add(r, k, tmp); in sm2_ltc_dsa_sign() [all …]
|
| H A D | sm2-pke.c | 30 int ltc_res = 0; in sm2_uncompressed_bytes_to_point() local 35 ltc_res = mp_read_unsigned_bin(p->x, ptr, SM2_INT_SIZE_BYTES); in sm2_uncompressed_bytes_to_point() 36 if (ltc_res != CRYPT_OK) in sm2_uncompressed_bytes_to_point() 41 ltc_res = mp_read_unsigned_bin(p->y, ptr, SM2_INT_SIZE_BYTES); in sm2_uncompressed_bytes_to_point() 42 if (ltc_res != CRYPT_OK) in sm2_uncompressed_bytes_to_point() 45 ltc_res = ltc_ecc_is_point(dp, p->x, p->y); in sm2_uncompressed_bytes_to_point() 46 if (ltc_res != CRYPT_OK) in sm2_uncompressed_bytes_to_point() 120 int ltc_res = 0; in sm2_ltc_pke_decrypt() local 163 ltc_res = mp_init_multi(&h, NULL); in sm2_ltc_pke_decrypt() 164 if (ltc_res != CRYPT_OK) { in sm2_ltc_pke_decrypt() [all …]
|
| H A D | gcm.c | 68 int ltc_res = 0; in crypto_aes_gcm_init() local 79 ltc_res = gcm_init(&gcm->ctx, ltc_cipherindex, key, key_len); in crypto_aes_gcm_init() 80 if (ltc_res != CRYPT_OK) in crypto_aes_gcm_init() 84 ltc_res = gcm_add_iv(&gcm->ctx, nonce, nonce_len); in crypto_aes_gcm_init() 85 if (ltc_res != CRYPT_OK) in crypto_aes_gcm_init() 95 int ltc_res = 0; in crypto_aes_gcm_update_aad() local 98 ltc_res = gcm_add_aad(&gcm->ctx, data, len); in crypto_aes_gcm_update_aad() 99 if (ltc_res != CRYPT_OK) in crypto_aes_gcm_update_aad() 111 int ltc_res = 0; in crypto_aes_gcm_update_payload() local 135 ltc_res = gcm_process(&gcm->ctx, pt, len, ct, dir); in crypto_aes_gcm_update_payload() [all …]
|
| H A D | ccm.c | 69 int ltc_res = 0; in crypto_aes_ccm_init() local 97 ltc_res = ccm_init(&ccm->ctx, ltc_cipherindex, key, key_len, in crypto_aes_ccm_init() 99 if (ltc_res != CRYPT_OK) in crypto_aes_ccm_init() 103 ltc_res = ccm_add_nonce(&ccm->ctx, nonce, nonce_len); in crypto_aes_ccm_init() 104 if (ltc_res != CRYPT_OK) in crypto_aes_ccm_init() 114 int ltc_res = 0; in crypto_aes_ccm_update_aad() local 117 ltc_res = ccm_add_aad(&ccm->ctx, data, len); in crypto_aes_ccm_update_aad() 118 if (ltc_res != CRYPT_OK) in crypto_aes_ccm_update_aad() 129 int ltc_res = 0; in crypto_aes_ccm_update_payload() local 144 ltc_res = ccm_process(&ccm->ctx, pt, len, ct, dir); in crypto_aes_ccm_update_payload() [all …]
|
| H A D | dsa.c | 64 int ltc_res = 0; in crypto_acipher_gen_dsa_key() local 69 ltc_res = mp_init_multi(<c_tmp_key.g, <c_tmp_key.p, <c_tmp_key.q, in crypto_acipher_gen_dsa_key() 71 if (ltc_res) in crypto_acipher_gen_dsa_key() 80 ltc_res = dsa_generate_key(NULL, find_prng("prng_crypto"), in crypto_acipher_gen_dsa_key() 82 if (ltc_res) in crypto_acipher_gen_dsa_key() 101 int ltc_res; in crypto_acipher_dsa_sign() local 137 ltc_res = mp_init_multi(&r, &s, NULL); in crypto_acipher_dsa_sign() 138 if (ltc_res != CRYPT_OK) { in crypto_acipher_dsa_sign() 143 ltc_res = dsa_sign_hash_raw(msg, msg_len, r, s, NULL, in crypto_acipher_dsa_sign() 146 if (ltc_res == CRYPT_OK) { in crypto_acipher_dsa_sign() [all …]
|
| H A D | sm2-kep.c | 232 int ltc_res = 0; in sm2_kep_derive() local 235 ltc_res = mp_init_multi(&x1bar, &x2bar, &tA, &h, &htA, &mu, &ma, &one, in sm2_kep_derive() 237 if (ltc_res != CRYPT_OK) { in sm2_kep_derive() 261 ltc_res = mp_mulmod(x1bar, my_eph_key->k, n, tA); in sm2_kep_derive() 262 if (ltc_res != CRYPT_OK) in sm2_kep_derive() 265 ltc_res = mp_addmod(tA, my_key->k, n, tA); in sm2_kep_derive() 266 if (ltc_res != CRYPT_OK) in sm2_kep_derive() 271 ltc_res = ltc_ecc_is_point(&peer_eph_key->dp, peer_eph_key->pubkey.x, in sm2_kep_derive() 273 if (ltc_res != CRYPT_OK) in sm2_kep_derive() 286 ltc_res = mp_montgomery_setup(peer_key->dp.prime, &mp); in sm2_kep_derive() [all …]
|
| H A D | rsa.c | 185 int ltc_res; in sw_crypto_acipher_gen_rsa_key() local 188 ltc_res = rsa_make_key_bn_e(NULL, find_prng("prng_crypto"), in sw_crypto_acipher_gen_rsa_key() 190 if (ltc_res != CRYPT_OK) { in sw_crypto_acipher_gen_rsa_key() 219 int ltc_res; in rsadorep() local 233 ltc_res = rsa_exptmod(src, src_len, buf, &blen, ltc_key->type, in rsadorep() 235 switch (ltc_res) { in rsadorep() 240 EMSG("rsa_exptmod() returned %d", ltc_res); in rsadorep() 247 EMSG("rsa_exptmod() returned %d", ltc_res); in rsadorep() 347 int ltc_hashindex, ltc_mgfindex, ltc_res, ltc_stat, ltc_rsa_algo; in sw_crypto_acipher_rsaes_decrypt() local 401 ltc_res = rsa_decrypt_key_ex(src, src_len, buf, &blen, in sw_crypto_acipher_rsaes_decrypt() [all …]
|
| H A D | ecc.c | 117 int ltc_res = 0; in ecc_set_curve_from_name() local 119 ltc_res = ecc_find_curve(curve_name, &curve); in ecc_set_curve_from_name() 120 if (ltc_res != CRYPT_OK) in ecc_set_curve_from_name() 123 ltc_res = ecc_set_curve(curve, ltc_key); in ecc_set_curve_from_name() 124 if (ltc_res != CRYPT_OK) in ecc_set_curve_from_name() 135 int ltc_res; in _ltc_ecc_generate_keypair() local 153 ltc_res = ecc_generate_key(NULL, find_prng("prng_crypto"), in _ltc_ecc_generate_keypair() 155 if (ltc_res != CRYPT_OK) in _ltc_ecc_generate_keypair() 250 int ltc_res = 0; in _ltc_ecc_sign() local 270 ltc_res = ecc_sign_hash_rfc7518(msg, msg_len, sig, <c_sig_len, in _ltc_ecc_sign() [all …]
|
| H A D | dh.c | 43 int ltc_res = 0; in crypto_acipher_gen_dh_key() local 48 ltc_res = mp_init_multi(<c_tmp_key.base, <c_tmp_key.prime, NULL); in crypto_acipher_gen_dh_key() 49 if (ltc_res != CRYPT_OK) in crypto_acipher_gen_dh_key() 55 ltc_res = dh_make_key(NULL, find_prng("prng_crypto"), q, xbits, in crypto_acipher_gen_dh_key() 57 if (ltc_res != CRYPT_OK) { in crypto_acipher_gen_dh_key()
|
| H A D | acipher_helpers.h | 22 static inline TEE_Result convert_ltc_verify_status(int ltc_res, int ltc_stat) in convert_ltc_verify_status() argument 24 switch (ltc_res) { in convert_ltc_verify_status()
|