Skip to content

Commit a1442cf

Browse files
authored
Merge pull request #8643 from kaleb-himes/KH-SRTP-REVIEW-rev1
Explicit API redirects for FIPS moving forward
2 parents 6d299ea + 8c0ef0b commit a1442cf

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

wolfcrypt/src/integer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ int mp_init (mp_int * a)
169169
/* clear one (frees) */
170170
void mp_clear (mp_int * a)
171171
{
172+
#ifdef HAVE_FIPS
173+
mp_forcezero(a);
174+
#else
172175
int i;
173176

174177
if (a == NULL)
@@ -194,6 +197,7 @@ void mp_clear (mp_int * a)
194197
a->alloc = a->used = 0;
195198
a->sign = MP_ZPOS;
196199
}
200+
#endif
197201
}
198202

199203
void mp_free (mp_int * a)

wolfcrypt/src/sp_int.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5268,6 +5268,9 @@ void sp_zero(sp_int* a)
52685268
*/
52695269
void sp_clear(sp_int* a)
52705270
{
5271+
#ifdef HAVE_FIPS
5272+
sp_forcezero(a);
5273+
#else
52715274
/* Clear when valid pointer passed in. */
52725275
if (a != NULL) {
52735276
unsigned int i;
@@ -5280,6 +5283,7 @@ void sp_clear(sp_int* a)
52805283
_sp_zero(a);
52815284
sp_free(a);
52825285
}
5286+
#endif
52835287
}
52845288

52855289
#if !defined(NO_RSA) || !defined(NO_DH) || defined(HAVE_ECC) || \

wolfcrypt/src/tfm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4568,6 +4568,9 @@ void fp_zero(fp_int *a)
45684568

45694569
void fp_clear(fp_int *a)
45704570
{
4571+
#ifdef HAVE_FIPS
4572+
fp_forcezero(a);
4573+
#else
45714574
int size;
45724575
a->used = 0;
45734576
a->sign = FP_ZPOS;
@@ -4578,6 +4581,7 @@ void fp_clear(fp_int *a)
45784581
#endif
45794582
XMEMSET(a->dp, 0, size * sizeof(fp_digit));
45804583
fp_free(a);
4584+
#endif
45814585
}
45824586

45834587
void fp_forcezero (mp_int * a)

0 commit comments

Comments
 (0)