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
Backport forgotten backports [1.1.1] #10094
Closed
mspncp
wants to merge
7
commits into
openssl:OpenSSL_1_1_1-stable
from
mspncp:pr-backport-forgotten-backports
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f5c5021
Ignore duplicated undocumented things
richsalz bc9d91a
Add missing EVP_MD documentation
3c62782
Document and add macros for additional DSA options
davidben ca0d329
Add documentation for the -sigopt option.
paulidale 4b3ccc1
issue-8493: Fix for filenames with newlines using openssl dgst
paulidale c00b5de
i2d_PublicKey was listed in 2 different man pages
mattcaswell 0efb388
Fix an incorrect macro
mattcaswell File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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 |
---|---|---|
|
@@ -413,13 +413,52 @@ int dgst_main(int argc, char **argv) | |
return ret; | ||
} | ||
|
||
/* | ||
* The newline_escape_filename function performs newline escaping for any | ||
* filename that contains a newline. This function also takes a pointer | ||
* to backslash. The backslash pointer is a flag to indicating whether a newline | ||
* is present in the filename. If a newline is present, the backslash flag is | ||
* set and the output format will contain a backslash at the beginning of the | ||
* digest output. This output format is to replicate the output format found | ||
* in the '*sum' checksum programs. This aims to preserve backward | ||
* compatibility. | ||
*/ | ||
static const char *newline_escape_filename(const char *file, int * backslash) | ||
{ | ||
size_t i, e = 0, length = strlen(file), newline_count = 0, mem_len = 0; | ||
char *file_cpy = NULL; | ||
|
||
for (i = 0; i < length; i++) | ||
if (file[i] == '\n') | ||
newline_count++; | ||
|
||
mem_len = length + newline_count + 1; | ||
file_cpy = app_malloc(mem_len, file); | ||
i = 0; | ||
|
||
while(e < length) { | ||
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. Missing space after while |
||
const char c = file[e]; | ||
if (c == '\n') { | ||
file_cpy[i++] = '\\'; | ||
file_cpy[i++] = 'n'; | ||
*backslash = 1; | ||
} else { | ||
file_cpy[i++] = c; | ||
} | ||
e++; | ||
} | ||
file_cpy[i] = '\0'; | ||
return (const char*)file_cpy; | ||
} | ||
|
||
|
||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, | ||
EVP_PKEY *key, unsigned char *sigin, int siglen, | ||
const char *sig_name, const char *md_name, | ||
const char *file) | ||
{ | ||
size_t len; | ||
int i; | ||
int i, backslash = 0; | ||
|
||
while (BIO_pending(bp) || !BIO_eof(bp)) { | ||
i = BIO_read(bp, (char *)buf, BUFSIZE); | ||
|
@@ -467,9 +506,16 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, | |
if (binout) { | ||
BIO_write(out, buf, len); | ||
} else if (sep == 2) { | ||
file = newline_escape_filename(file, &backslash); | ||
|
||
if (backslash == 1) | ||
BIO_puts(out, "\\"); | ||
|
||
for (i = 0; i < (int)len; i++) | ||
BIO_printf(out, "%02x", buf[i]); | ||
|
||
BIO_printf(out, " *%s\n", file); | ||
OPENSSL_free((char *)file); | ||
} else { | ||
if (sig_name != NULL) { | ||
BIO_puts(out, sig_name); | ||
|
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
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
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
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
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
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
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.
Too many spaces
int * backslash