const-time: add functions for generating masks from 0/1 input
* mpi/ec-nist.c (_gcry_mpi_ec_nist192_mod, _gcry_mpi_ec_nist224_mod) (_gcry_mpi_ec_nist256_mod, _gcry_mpi_ec_nist384_mod): Use mask generating functions. * mpi/mpi-internal.h (ct_limb_gen_mask, ct_limb_gen_inv_mask): New. * mpi/mpih-const-time.c (_gcry_mpih_set_cond, _gcry_mpih_add_n_cond) (_gcry_mpih_sub_n_cond, _gcry_mpih_sub_n_cond, _gcry_mpih_swap_cond): Use mask generating functions. * mpi/mpiutil.c (_gcry_mpi_set_cond, _gcry_mpi_swap_cond): Use mask generating functions. * src/const-time.h (DEFINE_CT_TYPE_GEN_MASK, ct_uintptr_gen_mask) (ct_ulong_gen_mask, DEFINE_CT_TYPE_GEN_INV_MASK) (ct_uintptr_gen_inv_mask, ct_ulong_gen_inv_mask): New. (DEFINE_CT_TYPE_SELECT_FUNC): Use mask generating functions. * src/const-time.c (_gcry_ct_memmov_cond): Use mask generating functions.
Cherry pick master commit of:
cf757cf90e9ae966b95dcebfd2f31b9212697f0c
Provide functions for generating mask for constant time operations.
- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>