| /optee_os/core/lib/libtomcrypt/src/pk/ecc/ |
| H A D | ltc_ecc_projective_dbl_point.c | 40 int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, void *m… in ltc_ecc_projective_dbl_point() argument 47 LTC_ARGCHK(modulus != NULL); in ltc_ecc_projective_dbl_point() 58 if ((err = ltc_ecc_is_point_at_infinity(P, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_projective_dbl_point() 67 if ((err = mp_montgomery_reduce(t1, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 70 if ((err = mp_montgomery_reduce(R->z, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 73 if (mp_cmp(R->z, modulus) != LTC_MP_LT) { in ltc_ecc_projective_dbl_point() 74 if ((err = mp_sub(R->z, modulus, R->z)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 81 if ((err = mp_add(t2, modulus, t2)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() 85 if (mp_cmp(t1, modulus) != LTC_MP_LT) { in ltc_ecc_projective_dbl_point() 86 if ((err = mp_sub(t1, modulus, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_dbl_point() [all …]
|
| H A D | ltc_ecc_projective_add_point.c | 23 …_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, void *modulus, void *mp) in ltc_ecc_projective_add_point() argument 31 LTC_ARGCHK(modulus != NULL); in ltc_ecc_projective_add_point() 38 if ((err = ltc_ecc_is_point_at_infinity(P, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_projective_add_point() 45 if ((err = ltc_ecc_is_point_at_infinity(Q, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_projective_add_point() 56 return ltc_ecc_projective_dbl_point(P, R, ma, modulus, mp); in ltc_ecc_projective_add_point() 58 if ((err = mp_sub(modulus, Q->y, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 74 if ((err = mp_montgomery_reduce(t1, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 77 if ((err = mp_montgomery_reduce(x, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 80 if ((err = mp_montgomery_reduce(t1, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() 83 if ((err = mp_montgomery_reduce(y, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_projective_add_point() [all …]
|
| H A D | ltc_ecc_mulmod_timing.c | 25 int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map) in ltc_ecc_mulmod() argument 36 LTC_ARGCHK(modulus != NULL); in ltc_ecc_mulmod() 38 if ((err = ltc_ecc_is_point_at_infinity(G, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_mulmod() 45 if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 47 if ((err = mp_montgomery_normalization(mu, modulus)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 52 if (mp_cmp(a_plus3, modulus) != LTC_MP_EQ) { in ltc_ecc_mulmod() 54 if ((err = mp_mulmod(a, mu, modulus, ma)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 75 if ((err = mp_mulmod(G->x, mu, modulus, tG->x)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() 76 if ((err = mp_mulmod(G->y, mu, modulus, tG->y)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() 77 if ((err = mp_mulmod(G->z, mu, modulus, tG->z)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() [all …]
|
| H A D | ltc_ecc_mul2add.c | 29 void *modulus) in ltc_ecc_mul2add() argument 44 LTC_ARGCHK(modulus != NULL); in ltc_ecc_mul2add() 87 if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { in ltc_ecc_mul2add() 93 if ((err = mp_montgomery_normalization(mu, modulus)) != CRYPT_OK) { in ltc_ecc_mul2add() 98 …if ((err = mp_mulmod(A->x, mu, modulus, precomp[1]->x)) != CRYPT_OK) … in ltc_ecc_mul2add() 99 …if ((err = mp_mulmod(A->y, mu, modulus, precomp[1]->y)) != CRYPT_OK) … in ltc_ecc_mul2add() 100 …if ((err = mp_mulmod(A->z, mu, modulus, precomp[1]->z)) != CRYPT_OK) … in ltc_ecc_mul2add() 102 …if ((err = mp_mulmod(B->x, mu, modulus, precomp[1<<2]->x)) != CRYPT_OK) … in ltc_ecc_mul2add() 103 …if ((err = mp_mulmod(B->y, mu, modulus, precomp[1<<2]->y)) != CRYPT_OK) … in ltc_ecc_mul2add() 104 …if ((err = mp_mulmod(B->z, mu, modulus, precomp[1<<2]->z)) != CRYPT_OK) … in ltc_ecc_mul2add() [all …]
|
| H A D | ltc_ecc_mulmod.c | 26 int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map) in ltc_ecc_mulmod() argument 37 LTC_ARGCHK(modulus != NULL); in ltc_ecc_mulmod() 39 if ((err = ltc_ecc_is_point_at_infinity(G, modulus, &inf)) != CRYPT_OK) return err; in ltc_ecc_mulmod() 46 if ((err = mp_montgomery_setup(modulus, &mp)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 48 if ((err = mp_montgomery_normalization(mu, modulus)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 53 if (mp_cmp(a_plus3, modulus) != LTC_MP_EQ) { in ltc_ecc_mulmod() 55 if ((err = mp_mulmod(a, mu, modulus, ma)) != CRYPT_OK) { goto error; } in ltc_ecc_mulmod() 78 if ((err = mp_mulmod(G->x, mu, modulus, tG->x)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() 79 if ((err = mp_mulmod(G->y, mu, modulus, tG->y)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() 80 if ((err = mp_mulmod(G->z, mu, modulus, tG->z)) != CRYPT_OK) { goto done; } in ltc_ecc_mulmod() [all …]
|
| H A D | ltc_ecc_map.c | 20 int ltc_ecc_map(ecc_point *P, void *modulus, void *mp) in ltc_ecc_map() argument 26 LTC_ARGCHK(modulus != NULL); in ltc_ecc_map() 38 if ((err = mp_montgomery_reduce(P->z, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 41 if ((err = mp_invmod(P->z, modulus, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 45 if ((err = mp_mod(t2, modulus, t2)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 47 if ((err = mp_mod(t1, modulus, t1)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 51 if ((err = mp_montgomery_reduce(P->x, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_map() 53 if ((err = mp_montgomery_reduce(P->y, modulus, mp)) != CRYPT_OK) { goto done; } in ltc_ecc_map()
|
| H A D | ltc_ecc_is_point_at_infinity.c | 12 int ltc_ecc_is_point_at_infinity(const ecc_point *P, void *modulus, int *retval) in ltc_ecc_is_point_at_infinity() argument 33 if ((err = mp_mulmod(P->y, P->y, modulus, y2)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point_at_infinity() 36 if ((err = mp_mulmod(P->x, P->x, modulus, x3)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point_at_infinity() 37 if ((err = mp_mulmod(P->x, x3, modulus, x3)) != CRYPT_OK) goto cleanup; in ltc_ecc_is_point_at_infinity()
|
| /optee_os/core/lib/libtomcrypt/src/math/ |
| H A D | tfm_desc.c | 423 static int tfm_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, … in tfm_ecc_projective_dbl_point() argument 431 LTC_ARGCHK(modulus != NULL); in tfm_ecc_projective_dbl_point() 445 if ((err = ltc_ecc_is_point_at_infinity(P, modulus, &inf)) != CRYPT_OK) return err; in tfm_ecc_projective_dbl_point() 456 fp_montgomery_reduce(&t1, modulus, mp); in tfm_ecc_projective_dbl_point() 459 fp_montgomery_reduce(R->z, modulus, mp); in tfm_ecc_projective_dbl_point() 462 if (fp_cmp(R->z, modulus) != FP_LT) { in tfm_ecc_projective_dbl_point() 463 fp_sub(R->z, modulus, R->z); in tfm_ecc_projective_dbl_point() 470 fp_add(&t2, modulus, &t2); in tfm_ecc_projective_dbl_point() 474 if (fp_cmp(&t1, modulus) != FP_LT) { in tfm_ecc_projective_dbl_point() 475 fp_sub(&t1, modulus, &t1); in tfm_ecc_projective_dbl_point() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/math/fp/ |
| H A D | ltc_ecc_fp_mulmod.c | 665 static int s_build_lut(int idx, void *a, void *modulus, void *mp, void *mu) in s_build_lut() argument 679 bitlen = mp_unsigned_bin_size(modulus) << 3; in s_build_lut() 692 if ((mp_mulmod(fp_cache[idx].g->x, mu, modulus, fp_cache[idx].LUT[1]->x) != CRYPT_OK) || in s_build_lut() 693 (mp_mulmod(fp_cache[idx].g->y, mu, modulus, fp_cache[idx].LUT[1]->y) != CRYPT_OK) || in s_build_lut() 694 …(mp_mulmod(fp_cache[idx].g->z, mu, modulus, fp_cache[idx].LUT[1]->z) != CRYPT_OK)) { goto E… in s_build_lut() 704 …if ((err = ltc_mp.ecc_ptdbl(fp_cache[idx].LUT[1<<x], fp_cache[idx].LUT[1<<x], a, modulus, mp)) != … in s_build_lut() 717 fp_cache[idx].LUT[y], a, modulus, mp)) != CRYPT_OK) { in s_build_lut() 727 …if ((err = mp_montgomery_reduce(fp_cache[idx].LUT[x]->z, modulus, mp)) != CRYPT_OK) … in s_build_lut() 730 …if ((err = mp_invmod(fp_cache[idx].LUT[x]->z, modulus, fp_cache[idx].LUT[x]->z)) != CRYPT_OK) … in s_build_lut() 733 …if ((err = mp_sqrmod(fp_cache[idx].LUT[x]->z, modulus, tmp)) != CRYPT_OK) … in s_build_lut() [all …]
|
| /optee_os/core/lib/libtomcrypt/src/headers/ |
| H A D | tomcrypt_math.h | 388 void *modulus, 404 void *modulus, 418 void *modulus, 431 int (*ecc_map)(ecc_point *P, void *modulus, void *mp); 447 void *modulus);
|
| H A D | tomcrypt_private.h | 323 int ltc_ecc_is_point_at_infinity(const ecc_point *P, void *modulus, int *retval); 331 int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, void *m… 334 …add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, void *modulus, void *mp); 339 int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulus, int map); 345 int ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock); 352 int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map); 360 void *modulus); 368 void *modulus); 375 int ltc_ecc_map(ecc_point *P, void *modulus, void *mp);
|
| /optee_os/core/drivers/crypto/crypto_api/math/ |
| H A D | sub.mk | 1 srcs-y += modulus.c
|
| /optee_os/core/crypto/ |
| H A D | signed_hdr.c | 147 const struct shdr_subkey_attr *modulus = NULL; in load_rsa_key() local 154 modulus = find_attr(subkey, TEE_ATTR_RSA_MODULUS); in load_rsa_key() 155 if (!modulus) in load_rsa_key() 161 res = crypto_acipher_alloc_rsa_public_key(key, modulus->size * 8); in load_rsa_key() 168 res = crypto_bignum_bin2bn(base + modulus->offs, modulus->size, key->n); in load_rsa_key()
|
| /optee_os/lib/libutee/ |
| H A D | tee_api_arith_mpi.c | 928 const TEE_BigInt *modulus __unused) in TEE_BigIntInitFMMContext() 933 uint32_t len, const TEE_BigInt *modulus) in __GP11_TEE_BigIntInitFMMContext() argument 935 TEE_BigIntInitFMMContext(context, len, modulus); in __GP11_TEE_BigIntInitFMMContext() 940 const TEE_BigInt *modulus __unused) in TEE_BigIntInitFMMContext1()
|
| /optee_os/lib/libutee/include/ |
| H A D | tee_internal_api.h | 519 const TEE_BigInt *modulus); 521 uint32_t len, const TEE_BigInt *modulus); 524 size_t len, const TEE_BigInt *modulus);
|
| /optee_os/lib/libmbedtls/mbedtls/ |
| H A D | ChangeLog | 481 * The new function mbedtls_rsa_get_bitlen() returns the length of the modulus 2133 query the size of the modulus in a Diffie-Hellman context. 4295 modulus 1 and therefore to hang. Found by blaufish. #641.
|