Home GnuPG

const-time: Add ct_memmov_cond, fix _gcry_mpih_set_cond.

Description

const-time: Add ct_memmov_cond, fix _gcry_mpih_set_cond.

* src/const-time.c (ct_memmov_cond): New.
* src/const-time.h (ct_memmov_cond): New.
* mpi/mpih-const-time.c (_gcry_mpih_set_cond): Use XOR and a MASK.

ct_memmov_cond is like memcpy, but it allows use with overlapping
memory area when DST <= SRC. It's not like memmove because it doesn't
allow overlapping memory area when DST > SRC.

  • Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>

Details

Provenance
gniibeAuthored on Oct 31 2023, 5:43 AM
Parents
rCc31b70b2660c: const-time: Use ct_not_memequal, instead. Tested with AVR.
Branches
Unknown
Tags
Unknown