Skip to content

Commit b02ddde

Browse files
authored
Merge pull request #9886 from philljj/fix_f_193
wc_encrypt: add missing ForceZero for Des, Arc4, Rc2.
2 parents 18d1190 + fb8b3e7 commit b02ddde

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

wolfcrypt/src/wc_encrypt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ int wc_CryptKey(const char* password, int passwordSz, byte* salt,
518518
wc_Des_CbcDecrypt(&des, input, input, (word32)length);
519519
}
520520
}
521+
ForceZero(&des, sizeof(Des));
521522
break;
522523
}
523524
#endif /* !NO_SHA || !NO_MD5 */
@@ -561,6 +562,7 @@ int wc_CryptKey(const char* password, int passwordSz, byte* salt,
561562

562563
wc_Arc4SetKey(&dec, key, derivedLen);
563564
wc_Arc4Process(&dec, input, input, (word32)length);
565+
ForceZero(&dec, sizeof(Arc4));
564566
break;
565567
}
566568
#endif
@@ -629,9 +631,7 @@ int wc_CryptKey(const char* password, int passwordSz, byte* salt,
629631
else
630632
ret = wc_Rc2CbcDecrypt(&rc2, input, input, length);
631633
}
632-
if (ret == 0) {
633-
ForceZero(&rc2, sizeof(Rc2));
634-
}
634+
ForceZero(&rc2, sizeof(Rc2));
635635
break;
636636
}
637637
#endif

0 commit comments

Comments
 (0)