Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/configs/os-check-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@
"comment": "The user_settings.h header-driven build path is distinct from the autotools-driven --enable-all path; full make check.",
"user_settings": "examples/configs/user_settings_all.h",
"configure": ["--enable-usersettings"]},
{"name": "fastmath-alt-ecc-check-mem-zero", "minutes": 2.0,
"comment": "Only entry that checks mem-zero with ALT_ECC_SIZE fast math, where ECC integers are alt_fp_ints smaller than an fp_int.",
"configure": ["--enable-fastmath",
"CPPFLAGS=-DALT_ECC_SIZE -DWOLFSSL_CHECK_MEM_ZERO"]},
{"name": "she-ext-cryptocb-sw-default", "minutes": 1.9,
"configure": ["--enable-she=extended", "--enable-cryptocb", "--enable-cryptocbutils",
"CPPFLAGS=-DWC_SHE_SW_DEFAULT"]},
Expand Down
20 changes: 18 additions & 2 deletions wolfcrypt/src/tfm.c
Original file line number Diff line number Diff line change
Expand Up @@ -6061,14 +6061,30 @@ int mp_lshd (mp_int * a, int b)
}

#ifdef WOLFSSL_CHECK_MEM_ZERO
/* Number of bytes of digits in the integer. With ALT_ECC_SIZE, an ECC integer
* is an alt_fp_int with fewer digits than an fp_int, so use the size it was
* initialized with, as fp_forcezero() does, to stay inside it. */
static size_t mp_memzero_len(mp_int* a)
{
#if defined(ALT_ECC_SIZE) || defined(HAVE_WOLF_BIGINT)
return (size_t)a->size * sizeof(fp_digit);
#else
return sizeof(a->dp);
#endif
}

void mp_memzero_add(const char* name, mp_int* a)
{
wc_MemZero_Add(name, a->dp, sizeof(a->dp));
if (a != NULL) {
wc_MemZero_Add(name, a->dp, mp_memzero_len(a));
}
}

void mp_memzero_check(mp_int* a)
{
wc_MemZero_Check(a->dp, sizeof(a->dp));
if (a != NULL) {
wc_MemZero_Check(a->dp, mp_memzero_len(a));
}
}
#endif /* WOLFSSL_CHECK_MEM_ZERO */

Expand Down
Loading