Explicit API redirects for FIPS moving forward

This commit is contained in:
kaleb-himes
2025-04-07 11:06:52 -06:00
parent 0e27b3e8c8
commit 8c0ef0b1f5
3 changed files with 12 additions and 0 deletions

View File

@@ -177,6 +177,9 @@ int mp_init (mp_int * a)
/* clear one (frees) */
void mp_clear (mp_int * a)
{
#ifdef HAVE_FIPS
mp_forcezero(a);
#else
int i;
if (a == NULL)
@@ -202,6 +205,7 @@ void mp_clear (mp_int * a)
a->alloc = a->used = 0;
a->sign = MP_ZPOS;
}
#endif
}
void mp_free (mp_int * a)

View File

@@ -5272,6 +5272,9 @@ void sp_zero(sp_int* a)
*/
void sp_clear(sp_int* a)
{
#ifdef HAVE_FIPS
sp_forcezero(a);
#else
/* Clear when valid pointer passed in. */
if (a != NULL) {
unsigned int i;
@@ -5284,6 +5287,7 @@ void sp_clear(sp_int* a)
_sp_zero(a);
sp_free(a);
}
#endif
}
#if !defined(NO_RSA) || !defined(NO_DH) || defined(HAVE_ECC) || \

View File

@@ -4575,6 +4575,9 @@ void fp_zero(fp_int *a)
void fp_clear(fp_int *a)
{
#ifdef HAVE_FIPS
fp_forcezero(a);
#else
int size;
a->used = 0;
a->sign = FP_ZPOS;
@@ -4585,6 +4588,7 @@ void fp_clear(fp_int *a)
#endif
XMEMSET(a->dp, 0, size * sizeof(fp_digit));
fp_free(a);
#endif
}
void fp_forcezero (mp_int * a)