| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| H A D | ltc_ecc_is_point.c | 17 void *prime, *a, *b, *t1, *t2; in ltc_ecc_is_point() local 20 prime = dp->prime; in ltc_ecc_is_point() 31 if ((err = mp_mod(t2, prime, t2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 38 if ((err = mp_submod(prime, a, prime, t2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 39 if ((err = mp_mulmod(t2, x, prime, t2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 40 if ((err = mp_addmod(t1, t2, prime, t1)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 44 if ((err = mp_add(t1, prime, t1)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point() 46 while (mp_cmp(t1, prime) != LTC_MP_LT) { in ltc_ecc_is_point() 47 if ((err = mp_sub(t1, prime, t1)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point()
|
| H A D | ecc_sizes.c | 16 void *prime; in ecc_sizes() local 24 if (mp_init(&prime) == CRYPT_OK) { in ecc_sizes() 25 for (i = 0; ltc_ecc_curves[i].prime != NULL; i++) { in ecc_sizes() 26 if (mp_read_radix(prime, ltc_ecc_curves[i].prime, 16) == CRYPT_OK) { in ecc_sizes() 27 size = mp_unsigned_bin_size(prime); in ecc_sizes() 32 mp_clear(prime); in ecc_sizes()
|
| H A D | ltc_ecc_import_point.c | 8 int ltc_ecc_import_point(const unsigned char *in, unsigned long inlen, void *prime, void *a, void *… in ltc_ecc_import_point() argument 19 size = mp_unsigned_bin_size(prime); in ltc_ecc_import_point() 34 …if ((err = mp_mulmod(t1, x, prime, t1)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 36 …if ((err = mp_mulmod(a, x, prime, t2)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 41 …if ((err = mp_sqrtmod_prime(t1, prime, t2)) != CRYPT_OK) { goto cleanup;… in ltc_ecc_import_point() 44 … if ((err = mp_mod(t2, prime, y)) != CRYPT_OK) { goto cleanup; } in ltc_ecc_import_point() 47 … if ((err = mp_submod(prime, t2, prime, y)) != CRYPT_OK) { goto cleanup; } in ltc_ecc_import_point()
|
| H A D | ltc_ecc_verify_key.c | 20 void *prime = key->dp.prime; in ltc_ecc_verify_key() local 26 if ((ltc_mp.compare(key->pubkey.x, prime) != LTC_MP_LT) || in ltc_ecc_verify_key() 27 (ltc_mp.compare(key->pubkey.y, prime) != LTC_MP_LT) || in ltc_ecc_verify_key() 43 …if ((err = ltc_ecc_mulmod(order, &(key->pubkey), point, a, prime, 1)) != CRYPT_OK) { goto done… in ltc_ecc_verify_key() 45 err = ltc_ecc_is_point_at_infinity(point, prime, &inf); in ltc_ecc_verify_key()
|
| H A D | ecc_set_curve_internal.c | 22 for (curve = ltc_ecc_curves; curve->prime != NULL; curve++) { in s_ecc_oid_lookup() 23 if (s_ecc_cmp_hex_bn(curve->prime, key->dp.prime, bn) != 1) continue; in s_ecc_oid_lookup() 33 if (curve->prime && curve->OID) { in s_ecc_oid_lookup() 47 if ((err = mp_init_multi(&key->dp.prime, &key->dp.order, &key->dp.A, &key->dp.B, in ecc_copy_curve() 55 if ((err = mp_copy(srckey->dp.prime, key->dp.prime )) != CRYPT_OK) { goto error; } in ecc_copy_curve() 79 int ecc_set_curve_from_mpis(void *a, void *b, void *prime, void *order, void *gx, void *gy, unsigne… in ecc_set_curve_from_mpis() argument 86 LTC_ARGCHK(prime != NULL); in ecc_set_curve_from_mpis() 91 if ((err = mp_init_multi(&key->dp.prime, &key->dp.order, &key->dp.A, &key->dp.B, in ecc_set_curve_from_mpis() 99 if ((err = mp_copy(prime, key->dp.prime )) != CRYPT_OK) { goto error; } in ecc_set_curve_from_mpis() 108 key->dp.size = mp_unsigned_bin_size(prime); in ecc_set_curve_from_mpis()
|
| H A D | ecc_shared_secret.c | 26 void *prime, *a; in ecc_shared_secret() local 45 prime = private_key->dp.prime; in ecc_shared_secret() 48 …if ((err = ltc_mp.ecc_ptmul(private_key->k, &public_key->pubkey, result, a, prime, 1)) != CRYPT_OK… in ecc_shared_secret() 50 x = (unsigned long)mp_unsigned_bin_size(prime); in ecc_shared_secret()
|
| H A D | ecc_set_key.c | 11 void *prime, *a, *b; in ecc_set_key() local 17 prime = key->dp.prime; in ecc_set_key() 31 …if ((err = ltc_mp.ecc_ptmul(key->k, &key->dp.base, &key->pubkey, a, prime, 1)) != CRYPT_OK) … in ecc_set_key() 35 …if ((err = ltc_ecc_import_point(in, inlen, prime, a, b, key->pubkey.x, key->pubkey.y)) != CRYPT_OK… in ecc_set_key()
|
| H A D | ecc_import_x509.c | 35 void *prime, *order, *a, *b, *gx, *gy; in s_ecc_import_x509_with_curve() local 43 if ((err = mp_init_multi(&prime, &order, &a, &b, &gx, &gy, LTC_NULL)) != CRYPT_OK) { in s_ecc_import_x509_with_curve() 57 LTC_SET_ASN1(seq_fieldid, 1, LTC_ASN1_INTEGER, prime, 1UL); in s_ecc_import_x509_with_curve() 75 …if ((err = ltc_ecc_import_point(bin_g, len_g, prime, a, b, gx, gy)) != CRYPT_OK) { goto er… in s_ecc_import_x509_with_curve() 77 …if ((err = ecc_set_curve_from_mpis(a, b, prime, order, gx, gy, cofactor, key)) != CRYPT_OK) { goto… in s_ecc_import_x509_with_curve() 82 mp_clear_multi(prime, order, a, b, gx, gy, LTC_NULL); in s_ecc_import_x509_with_curve()
|
| H A D | ecc_import_openssl.c | 44 void *prime, *order, *a, *b, *gx, *gy; in s_ecc_import_private_with_curve() local 52 if ((err = mp_init_multi(&prime, &order, &a, &b, &gx, &gy, LTC_NULL)) != CRYPT_OK) { in s_ecc_import_private_with_curve() 75 LTC_SET_ASN1(seq_fieldid, 1, LTC_ASN1_INTEGER, prime, 1UL); in s_ecc_import_private_with_curve() 91 …if ((err = ltc_ecc_import_point(bin_g, len_g, prime, a, b, gx, gy)) != CRYPT_OK) { goto er… in s_ecc_import_private_with_curve() 93 …if ((err = ecc_set_curve_from_mpis(a, b, prime, order, gx, gy, cofactor, key)) != CRYPT_OK) { goto… in s_ecc_import_private_with_curve() 98 mp_clear_multi(prime, order, a, b, gx, gy, LTC_NULL); in s_ecc_import_private_with_curve()
|
| H A D | ecc_set_curve.c | 15 if ((err = mp_init_multi(&key->dp.prime, &key->dp.order, &key->dp.A, &key->dp.B, in ecc_set_curve() 23 if ((err = mp_read_radix(key->dp.prime, cu->prime, 16)) != CRYPT_OK) { goto error; } in ecc_set_curve() 32 key->dp.size = mp_unsigned_bin_size(key->dp.prime); in ecc_set_curve()
|
| H A D | ecc_export_openssl.c | 20 void *prime, *order, *a, *b, *gx, *gy; in ecc_export_openssl() local 47 prime = key->dp.prime; in ecc_export_openssl() 100 LTC_SET_ASN1(seq_fieldid, 1, LTC_ASN1_INTEGER, prime, 1UL); in ecc_export_openssl()
|
| /optee_os/core/drivers/crypto/caam/acipher/ |
| H A D | caam_prime_dsa.c | 47 struct prime_data_dsa *prime, in do_desc_prime_q() argument 59 caam_desc_add_word(desc, prime->q->length); in do_desc_prime_q() 61 caam_desc_add_word(desc, prime->q->length); in do_desc_prime_q() 116 hash_func->size - prime->q->length, 8)); in do_desc_prime_q() 129 hash_func->size - prime->q->length + 8, in do_desc_prime_q() 130 prime->q->length - 16)); in do_desc_prime_q() 143 caam_desc_add_word(desc, prime->q->length); in do_desc_prime_q() 146 caam_desc_add_word(desc, FIFO_ST(CLASS_NO, PKHA_N, prime->q->length)); in do_desc_prime_q() 147 caam_desc_add_ptr(desc, prime->q->paddr); in do_desc_prime_q() 155 if (prime->p->length <= 1024 / 8) in do_desc_prime_q() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/pk/dh/ |
| H A D | dh_set.c | 29 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_set_pg() 34 …if ((err = mp_read_unsigned_bin(key->prime, (unsigned char*)p, plen)) != CRYPT_OK) { goto LBL_ERR… in dh_set_pg() 61 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_set_pg_groupsize() 65 if ((err = mp_read_radix(key->prime, ltc_dh_sets[i].prime, 16)) != CRYPT_OK) { goto LBL_ERR; } in dh_set_pg_groupsize() 95 … if ((err = mp_exptmod(key->base, key->x, key->prime, key->y)) != CRYPT_OK) { goto LBL_ERR; } in dh_set_key()
|
| H A D | dh_import.c | 25 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_import() 44 LTC_ASN1_INTEGER, 1UL, key->prime, in dh_import() 51 if ((err = mp_exptmod(key->base, key->x, key->prime, key->y)) != CRYPT_OK) { in dh_import() 60 LTC_ASN1_INTEGER, 1UL, key->prime, in dh_import()
|
| H A D | dh_make_key.c | 63 LTC_ARGCHK(key->prime != NULL); in dh_make_key() 75 key_size_p = mp_unsigned_bin_size(key->prime); in dh_make_key() 93 arg_mod = key->prime; in dh_make_key() 127 err = mp_exptmod(key->base, key->x, key->prime, key->y); in dh_make_key()
|
| H A D | dh_shared_secret.c | 34 … if (mp_cmp(private_key->prime, public_key->prime) != LTC_MP_EQ) { return CRYPT_PK_TYPE_MISMATCH; } in dh_shared_secret() 48 if ((err = mp_exptmod(public_key->y, private_key->x, private_key->prime, tmp)) != CRYPT_OK) { in dh_shared_secret()
|
| H A D | dh_set_pg_dhparam.c | 27 if ((err = mp_init_multi(&key->x, &key->y, &key->base, &key->prime, LTC_NULL)) != CRYPT_OK) { in dh_set_pg_dhparam() 31 LTC_ASN1_INTEGER, 1UL, key->prime, in dh_set_pg_dhparam()
|
| H A D | dh_export.c | 32 LTC_ASN1_INTEGER, 1UL, key->prime, in dh_export() 43 LTC_ASN1_INTEGER, 1UL, key->prime, in dh_export()
|
| H A D | dh_generate_key.c | 51 keysize = s_dh_groupsize_to_keysize(mp_unsigned_bin_size(key->prime)); in dh_generate_key() 76 if ((err = mp_exptmod(key->base, key->x, key->prime, key->y)) != CRYPT_OK) { in dh_generate_key()
|
| H A D | dh_free.c | 15 mp_cleanup_multi(&key->prime, &key->base, &key->y, &key->x, LTC_NULL); in dh_free()
|
| /optee_os/core/lib/libtomcrypt/src/math/ |
| H A D | gmp_desc.c | 284 static int sqrtmod_prime(void *n, void *prime, void *ret) in sqrtmod_prime() argument 290 LTC_ARGCHK(prime != NULL); in sqrtmod_prime() 298 if (mpz_cmp_ui(((__mpz_struct *)prime), 2) == 0) return CRYPT_ERROR; /* prime must be odd */ in sqrtmod_prime() 299 legendre = mpz_legendre(n, prime); in sqrtmod_prime() 310 i = mpz_mod_ui(t1, prime, 4); /* t1 is ignored here */ in sqrtmod_prime() 312 mpz_add_ui(t1, prime, 1); in sqrtmod_prime() 314 mpz_powm(ret, n, t1, prime); in sqrtmod_prime() 322 mpz_set(Q, prime); in sqrtmod_prime() 338 legendre = mpz_legendre(Z, prime); in sqrtmod_prime() 344 mpz_powm(C, Z, Q, prime); in sqrtmod_prime() [all …]
|
| /optee_os/core/lib/libtomcrypt/ |
| H A D | sm2-pke.c | 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() 202 ltc_key.dp.prime, 1); in sm2_ltc_pke_decrypt() 376 ltc_key.dp.prime, 1); in sm2_ltc_pke_encrypt() 398 ltc_key.dp.prime, 1); in sm2_ltc_pke_encrypt() 404 ltc_res = ltc_ecc_is_point_at_infinity(S, ltc_key.dp.prime, in sm2_ltc_pke_encrypt() 408 ltc_key.dp.prime, &inf); in sm2_ltc_pke_encrypt() 428 ltc_key.dp.prime, 1); in sm2_ltc_pke_encrypt()
|
| H A D | sm2-dsa.c | 72 ltc_key.dp.prime, 1); in sm2_ltc_dsa_sign() 211 ltc_res = mp_montgomery_setup(ltc_key.dp.prime, &mp); in sm2_ltc_dsa_verify() 216 ltc_res = mp_montgomery_normalization(mu, ltc_key.dp.prime); in sm2_ltc_dsa_verify() 221 ltc_res = mp_mulmod(ltc_key.dp.A, mu, ltc_key.dp.prime, ma); in sm2_ltc_dsa_verify() 227 x1y1p, ma, ltc_key.dp.prime); in sm2_ltc_dsa_verify()
|
| H A D | dh.c | 48 ltc_res = mp_init_multi(<c_tmp_key.base, <c_tmp_key.prime, NULL); in crypto_acipher_gen_dh_key() 54 mp_copy(key->p, ltc_tmp_key.prime); in crypto_acipher_gen_dh_key()
|
| H A D | sm2-kep.c | 286 ltc_res = mp_montgomery_setup(peer_key->dp.prime, &mp); in sm2_kep_derive() 290 ltc_res = mp_montgomery_normalization(mu, peer_key->dp.prime); in sm2_kep_derive() 294 ltc_res = mp_mulmod(peer_key->dp.A, mu, peer_key->dp.prime, ma); in sm2_kep_derive() 303 x2bar, U, ma, peer_key->dp.prime); in sm2_kep_derive() 315 ltc_res = ltc_ecc_mulmod(htA, U, U, peer_key->dp.A, peer_key->dp.prime, in sm2_kep_derive() 320 ltc_res = ltc_ecc_is_point_at_infinity(U, peer_key->dp.prime, &inf); in sm2_kep_derive()
|