Skip to content

Commit 7047991

Browse files
committed
Log when iterations LT 1000 but take no action
1 parent a9511e1 commit 7047991

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

wolfcrypt/src/pwdbased.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,15 @@ int wc_PBKDF2_ex(byte* output, const byte* passwd, int pLen, const byte* salt,
219219
return BAD_LENGTH_E;
220220
#endif
221221

222+
#if FIPS_VERSION3_GE(6,0,0) && defined(DEBUG_WOLFSSL)
223+
/* SP800-132 §5.2 recommends an iteration count of 1000 but this is not
224+
* strictly enforceable and is listed in Appendix B Table 1 as a
225+
* non-testable requirement. wolfCrypt will log it when appropriate but
226+
* take no action */
227+
if (iterations < 1000) {
228+
WOLFSSL_MSG("WARNING: Iteration < 1,000, see SP800-132 §5.2");
229+
}
230+
#endif
222231
if (iterations <= 0)
223232
iterations = 1;
224233

0 commit comments

Comments
 (0)