-
Notifications
You must be signed in to change notification settings - Fork 20
Add PBKDF2 in FIPS for password hashing #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
wolfpkcs11/internal.h
Outdated
| #define NO_MD5 | ||
| #endif | ||
|
|
||
| /* FIPSv5 has no scrypt or pbkdf2 and SHA256 is not strong enough */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just make this the default for FIPS, since scrypt won't be in the boundary in any planned version. Also FIPS v6.0 is dev now, but it will move later.
src/internal.c
Outdated
| enum wc_HashType hashT; | ||
|
|
||
| #ifdef HAVE_FIPS | ||
| if (kLen < HMAC_FIPS_MIN_KEY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some more logging here as this error will be hit often.
src/internal.c
Outdated
| #endif | ||
|
|
||
| hashT = wc_HashTypeConvert(hashType); | ||
| hLen = wc_HashGetDigestSize(hashT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error check for hLen here
SparkiDev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PBKDF2 is a FIPS algorithm.
Use wolfSSL API.
We can't, it isn't FIPSv5. It was concluded in an engineering call that this would be OK. Is it not? |
FIPS doesn't have scrypt. This implements PBKDF2 instead. Enabled by default at 600,000 rounds for FIPS. 600,000 being the current OWASP recommendation for SHA256 HMAC.
|
Moved to use wolfSSL's PBKDF2, it does actually exist in FIPSv5 builds.
|
| int hashLen, WP11_Slot* slot) | ||
| { | ||
| #ifdef HAVE_SCRYPT | ||
| #ifdef HAVE_FIPS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a new macro for force this mode as well... There are many embedded systems that would prefer this as scrypt is a memory hog (like 1 MB).
| #endif | ||
|
|
||
| /* FIPS has no scrypt and SHA256 is not strong enough */ | ||
| #if defined(HAVE_FIPS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to #ifndef PBKDF2_ITERATIONS.
|
After discussions with @kaleb-himes and @MarkAtwood, we won't be doing this. |
FIPS doesn't have scrypt. This implements PBKDF2 instead. Enabled by default at 600,000 rounds for FIPS.
600,000 being the current OWASP recommendation for SHA256 HMAC.