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

rfbEncryptAndStorePasswd: fail if encryption fails #611

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chhitz
Copy link
Contributor

@chhitz chhitz commented Mar 28, 2024

No description provided.

@chhitz chhitz force-pushed the fail-if-encryption-fails branch 2 times, most recently from 7af9b2b to bb00049 Compare March 28, 2024 14:32
@@ -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);
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

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?

Copy link
Member

@bk138 bk138 left a 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);
Copy link
Member

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) {
Copy link
Member

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
Copy link
Member

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!

Copy link
Member

Choose a reason for hiding this comment

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

Also, maybe rfbBool?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants