-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
maint(gpg2john.c): add missing prototypes #5603
Merged
claudioandre-br
merged 1 commit into
openwall:bleeding-jumbo
from
claudioandre-br:fix/clang
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1208,7 +1208,7 @@ Private_Packet(int len) | |
*/ | ||
|
||
|
||
typedef void (*funcptr)(); | ||
typedef void (*funcptr)(int); | ||
|
||
private int get_new_len(int); | ||
private int is_partial(int); | ||
|
@@ -1294,8 +1294,8 @@ TAG[] = { | |
}; | ||
#define TAG_NUM (sizeof(TAG) * sizeof(string)) | ||
|
||
private void | ||
(*tag_func[])() = { | ||
private funcptr | ||
tag_func[] = { | ||
Reserved, | ||
Public_Key_Encrypted_Session_Key_Packet, | ||
Signature_Packet, | ||
|
@@ -1305,7 +1305,7 @@ private void | |
Public_Key_Packet, | ||
Secret_Subkey_Packet, | ||
Compressed_Data_Packet, | ||
Symmetrically_Encrypted_Data_Packet, | ||
NULL, | ||
Marker_Packet, | ||
Literal_Data_Packet, | ||
Trust_Packet, | ||
|
@@ -1314,7 +1314,7 @@ private void | |
NULL, | ||
NULL, | ||
User_Attribute_Packet, | ||
Symmetrically_Encrypted_and_MDC_Packet, | ||
NULL, | ||
Modification_Detection_Code_Packet, | ||
NULL, | ||
NULL, | ||
|
@@ -1363,6 +1363,75 @@ private void | |
Private_Packet, | ||
}; | ||
|
||
private void | ||
(*tag_func4[])(int, int, int, char *) = { | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
Symmetrically_Encrypted_Data_Packet, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
Symmetrically_Encrypted_and_MDC_Packet, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL, | ||
}; | ||
|
||
char *pkt_type(int tag) { | ||
switch(tag) { | ||
case 0: return "Reserved"; | ||
|
@@ -1626,10 +1695,13 @@ parse_packet(char *hash) | |
} | ||
// else printf("(%d bytes)\n", len); | ||
|
||
if (tag < TAG_NUM && tag_func[tag] != NULL) { | ||
if (tag < TAG_NUM && (tag_func[tag] != NULL || tag_func4[tag] != NULL)) { | ||
if (gpg_dbg) | ||
fprintf(stderr, "Packet type %d, len %d at offset %d (Processing) (pkt-type %s) (Partial %s)\n", tag, len, offset, pkt_type(tag), partial?"yes":"no"); | ||
(*tag_func[tag])(len, 1, partial, hash); // first packet (possibly only one if partial is false). | ||
if (tag_func[tag] != NULL) | ||
(*tag_func[tag])(len); | ||
else | ||
(*tag_func4[tag])(len, 1, partial, hash); // first packet (possibly only one if partial is false). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None of the |
||
} else { | ||
if (gpg_dbg) | ||
fprintf(stderr, "Packet type %d, len %d at offset %d (Skipping) (Partial %s)\n", tag, len, offset, partial?"yes":"no"); | ||
|
@@ -1648,10 +1720,13 @@ parse_packet(char *hash) | |
if (gpg_dbg) | ||
fprintf(stderr, "\t(%d bytes) partial end\n", len); | ||
} | ||
if (tag < TAG_NUM && tag_func[tag] != NULL) { | ||
if (tag < TAG_NUM && (tag_func[tag] != NULL || tag_func4[tag] != NULL)) { | ||
if (gpg_dbg) | ||
fprintf(stderr, "Packet type %d, len %d at offset %d (Processing) (pkt-type %s) (Partial %s)\n", tag, len, offset, pkt_type(tag), partial?"yes":"no"); | ||
(*tag_func[tag])(len, 0, partial, hash); // subsquent packets. | ||
if (tag_func[tag] != NULL) | ||
(*tag_func[tag])(len); | ||
else | ||
(*tag_func4[tag])(len, 0, partial, hash); // subsquent packets. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idem. |
||
} else | ||
skip(len); | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The functions removed from the old/first array are separated by 8 other pointers, but here they're separated by only 7 NULLs. A bug?
Separately (but maybe related), I notice that the old array initializer had 65 lines, whereas the tag mask is such that there should probably be only 64 - a bug? Harmless?
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.
The first commit (f4df772) of gpg2john had that non-multiple of 4. Jim added a second typedef in 2fee9ee for #477.