-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
rfbEncryptAndStorePasswd: fail if encryption fails #611
base: master
Are you sure you want to change the base?
Conversation
7af9b2b
to
bb00049
Compare
bb00049
to
e2d3130
Compare
@@ -1557,7 +1557,7 @@ typedef union { | |||
extern int rfbEncryptAndStorePasswd(char *passwd, char *fname); | |||
extern char *rfbDecryptPasswdFromFile(char *fname); | |||
extern void rfbRandomBytes(unsigned char *bytes); | |||
extern void rfbEncryptBytes(unsigned char *bytes, char *passwd); | |||
extern int rfbEncryptBytes(unsigned char *bytes, char *passwd); |
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.
API change but I think it's OK ABI-wise. https://stackoverflow.com/questions/15626579/c-abi-is-changing-a-void-function-to-return-an-int-a-breaking-change also indicates so.
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.
What's the semantics of the return value? If it's boolean why not use the rfbBool type?
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.
Only a few comments about semantics and return values!
@@ -1557,7 +1557,7 @@ typedef union { | |||
extern int rfbEncryptAndStorePasswd(char *passwd, char *fname); | |||
extern char *rfbDecryptPasswdFromFile(char *fname); | |||
extern void rfbRandomBytes(unsigned char *bytes); | |||
extern void rfbEncryptBytes(unsigned char *bytes, char *passwd); | |||
extern int rfbEncryptBytes(unsigned char *bytes, char *passwd); |
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.
What's the semantics of the return value? If it's boolean why not use the rfbBool type?
@@ -197,19 +200,27 @@ rfbEncryptBytes(unsigned char *bytes, char *passwd) | |||
} | |||
} | |||
|
|||
encrypt_rfbdes(bytes, &out_len, key, bytes, CHALLENGESIZE); | |||
if (encrypt_rfbdes(bytes, &out_len, key, bytes, CHALLENGESIZE) == 0) { |
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.
Maybe just return the return value of encrypt_rfbdes() or use a ternary op?
} | ||
|
||
void | ||
int |
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.
Comment here about return value semantics would be good!
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.
Also, maybe rfbBool?
No description provided.