Skip to content
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

Correct readability-non-const-parameter warning #444

Merged
merged 3 commits into from
Nov 5, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion encfs/SSL_Cipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ CipherKey SSL_Cipher::newRandomKey() {
compute a 64-bit check value for the data using HMAC.
*/
static uint64_t _checksum_64(SSLKey *key, const unsigned char *data,
int dataLen, uint64_t *const chainedIV) {
int dataLen, const uint64_t *chainedIV) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

const uint64_t *const chainedIV ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any reason why we need a *const here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just as a security, to be sure not to accidentally modify chainedIV pointer later in the function's code ?
Which is not the case actually.
Thx 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes. More const is more better, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Your commit does two things:

  1. It makes one variable const (the variable chainedIV points to)
  2. Makes another non-const (the pointer itself).
    I agree with (1) but I don't understand (2).

rAssert(dataLen > 0);
Lock lock(key->mutex);

Expand Down