-
Notifications
You must be signed in to change notification settings - Fork 11
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
PBKDF2 #101
base: main
Are you sure you want to change the base?
PBKDF2 #101
Conversation
if (ctx == NULL) | ||
return; | ||
|
||
SymCryptWipeKnownSize(&ctx->expandedKey, sizeof(SYMCRYPT_SRTPKDF_EXPANDED_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.
#endif | ||
|
||
// Constants defined SP800-132 that should be checked | ||
// unless the OSSL_KDF_PARAM_PKCS5 paremeter gets set |
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.
{ | ||
ctx->libctx = provctx->libctx; | ||
ctx->pMac = SymCryptHmacSha1Algorithm; | ||
ctx->iterationCount = PKCS5_DEFAULT_ITER; |
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.
ctx->libctx = provctx->libctx; | ||
ctx->pMac = SymCryptHmacSha1Algorithm; | ||
ctx->iterationCount = PKCS5_DEFAULT_ITER; | ||
ctx->checkMinSizes = TRUE; |
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.
else | ||
{ | ||
copyCtx->initialized = FALSE; | ||
} |
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.
This seems a little weird to me; when we set password / mac in p_scossl_pbkdf2_set_ctx_params
, we explicitly do not eagerly initialize expandedKey, but wait until the next call to p_scossl_pbkdf2_derive
.
This logic seems to eagerly expand the key in the destination context even if it may not yet be expanded in the source context; which just seems overcomplex vs. always setting copyCtx->initialized = FALSE?
This PR adds PBKDF2 and associated tests to the SymCrypt provider.