Skip to content

Commit 25f8d6d

Browse files
committed
f282 harden wc_SrpComputeKey
1 parent f28a660 commit 25f8d6d

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

wolfcrypt/src/srp.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -908,30 +908,30 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
908908
XFREE(digest, srp->heap, DYNAMIC_TYPE_SRP);
909909
if (u) {
910910
if (r != WC_NO_ERR_TRACE(MP_INIT_E))
911-
mp_clear(u);
911+
mp_forcezero(u);
912912
XFREE(u, srp->heap, DYNAMIC_TYPE_SRP);
913913
}
914914
if (s) {
915915
if (r != WC_NO_ERR_TRACE(MP_INIT_E))
916-
mp_clear(s);
916+
mp_forcezero(s);
917917
XFREE(s, srp->heap, DYNAMIC_TYPE_SRP);
918918
}
919919
if (temp1) {
920920
if (r != WC_NO_ERR_TRACE(MP_INIT_E))
921-
mp_clear(temp1);
921+
mp_forcezero(temp1);
922922
XFREE(temp1, srp->heap, DYNAMIC_TYPE_SRP);
923923
}
924924
if (temp2) {
925925
if (r != WC_NO_ERR_TRACE(MP_INIT_E))
926-
mp_clear(temp2);
926+
mp_forcezero(temp2);
927927
XFREE(temp2, srp->heap, DYNAMIC_TYPE_SRP);
928928
}
929929
#else
930930
if (r != WC_NO_ERR_TRACE(MP_INIT_E)) {
931-
mp_clear(u);
932-
mp_clear(s);
933-
mp_clear(temp1);
934-
mp_clear(temp2);
931+
mp_forcezero(u);
932+
mp_forcezero(s);
933+
mp_forcezero(temp1);
934+
mp_forcezero(temp2);
935935
}
936936
#endif
937937

0 commit comments

Comments
 (0)