-
Notifications
You must be signed in to change notification settings - Fork 56
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
Fixes for Issue #204. #205
Conversation
besser82
commented
Jan 15, 2025
•
edited
Loading
edited
- crypt: Zeroize initialized and reserved data members after computation.
- crypt: Zeroize and initialize (re)allocated memory in crypt_ra.
- test/short-outbuf: Add two more cases for crypt_ra.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #205 +/- ##
===========================================
+ Coverage 90.12% 90.15% +0.02%
===========================================
Files 32 32
Lines 3627 3626 -1
Branches 690 689 -1
===========================================
Hits 3269 3269
+ Misses 227 226 -1
Partials 131 131 ☔ View full report in Codecov by Sentry. |
BTW, |
36618ad
to
043f5df
Compare
ac873d4
to
5a0547b
Compare
I've taken that into account in the rebased commits. |
The code on its own looks good to me now, although I suggest to use a simple While at it, I once again notice that we have some unfortunate (in my opinion) recommendations in the man page: "Applications are encouraged, but not required, to use the phrase and setting fields to store the strings that they will pass as phrase and setting to crypt_r." I think it's very wrong that we don't just keep this struct opaque to the callers (except maybe for the |
Also unify the codepaths for (re)allocation.
* outbuf != NULL with negative size parameter, and * outbuf == NULL with valid size parameter.
5a0547b
to
fe5b8b8
Compare
Fixed in merged commits.
Let's do this in a seperate PR. |
@@ -181,6 +181,8 @@ do_crypt (const char *phrase, const char *setting, struct crypt_data *data) | |||
cint->alg_specific, sizeof cint->alg_specific); | |||
|
|||
explicit_bzero (data->internal, sizeof data->internal); | |||
explicit_bzero (data->reserved, sizeof data->reserved); |
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.
I suggest we don't zeroize reserved
. This serves no purpose with current libxcrypt, and it could unnecessarily limit how we're able to use the reserved space in future/mixed versions.
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.
Oh, I didn't realize you merged this already. Nevermind, then.
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.
I suggest we don't zeroize
reserved
. This serves no purpose with current libxcrypt, and it could unnecessarily limit how we're able to use the reserved space in future/mixed versions.
I think we can drop it, if we decide to use that field to store a state or sth. in later versions.