Skip to content

evp: pass a zero salt length when EVP_BytesToKey has no salt - #12102

Closed
lealem47 wants to merge 1 commit into
masterfrom
evp_pbkdf1
Closed

lealem47 wants to merge 1 commit into
masterfrom
evp_pbkdf1

Conversation

@lealem47

Copy link
Copy Markdown
Contributor

Description

Account for the tightening of args in #12059.

This PR fixes general openssl compat for 0 salt encrypt's. Observed through wolfCLU failures.

Testing

./configure --enable-wolfclu && make & make install in wolfSSL

./configure && make check in wolfclu

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@lealem47 lealem47 self-assigned this Nov 11, 2026
Copilot AI balanced review requested due to automatic review settings November 11, 2026 22:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The NULL-salt path lacks a regression test with non-NULL input that verifies the returned key length and expected key/IV bytes, so existing tests would not catch a reversion.

1 open issue
What changed in this PR

Restores unsalted EVP_BytesToKey compatibility after #12059 tightened wc_PBKDF1_ex argument validation, addressing the reported wolfCLU failures.

Changes:

  • Passes a zero salt length when the salt pointer is NULL.
  • Preserves EVP_SALT_SIZE when a salt is supplied.
File Description
wolfcrypt/​src/​evp.c Makes the PBKDF1 salt length conditional on whether a salt is supplied.

Review effort: Balanced

Comment thread wolfcrypt/src/evp.c

ret = wc_PBKDF1_ex(key, (int)info->keySz, iv, (int)info->ivSz, data, sz,
salt, EVP_SALT_SIZE, count, hashType, NULL);
salt, saltSz, count, hashType, NULL);
@lealem47

Copy link
Copy Markdown
Contributor Author

Closing this in favor of #12106

@lealem47 lealem47 closed this Nov 12, 2026
@lealem47
lealem47 deleted the evp_pbkdf1 branch November 12, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants