mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-04-18 13:48:05 -05:00
Postpone stripping old signature after it is extracted (#260)
This commit is contained in:
parent
7bb21c3539
commit
e0eb331baf
16
pe.c
16
pe.c
@ -410,14 +410,6 @@ static PKCS7 *pe_pkcs7_prepare(FILE_FORMAT_CTX *ctx, BIO *hash, BIO *outdata)
|
|||||||
{
|
{
|
||||||
PKCS7 *cursig = NULL, *p7 = NULL;
|
PKCS7 *cursig = NULL, *p7 = NULL;
|
||||||
|
|
||||||
/* Strip current signature */
|
|
||||||
if (ctx->pe_ctx->sigpos > 0) {
|
|
||||||
ctx->pe_ctx->fileend = ctx->pe_ctx->sigpos;
|
|
||||||
}
|
|
||||||
if (!pe_modify_header(ctx, hash, outdata)) {
|
|
||||||
printf("Unable to modify file header\n");
|
|
||||||
return NULL; /* FAILED */
|
|
||||||
}
|
|
||||||
/* Obtain a current signature from previously-signed file */
|
/* Obtain a current signature from previously-signed file */
|
||||||
if ((ctx->options->cmd == CMD_SIGN && ctx->options->nest)
|
if ((ctx->options->cmd == CMD_SIGN && ctx->options->nest)
|
||||||
|| (ctx->options->cmd == CMD_ATTACH && ctx->options->nest)
|
|| (ctx->options->cmd == CMD_ATTACH && ctx->options->nest)
|
||||||
@ -429,6 +421,14 @@ static PKCS7 *pe_pkcs7_prepare(FILE_FORMAT_CTX *ctx, BIO *hash, BIO *outdata)
|
|||||||
}
|
}
|
||||||
if (ctx->options->cmd == CMD_ADD)
|
if (ctx->options->cmd == CMD_ADD)
|
||||||
p7 = cursig;
|
p7 = cursig;
|
||||||
|
}
|
||||||
|
if (ctx->pe_ctx->sigpos > 0) {
|
||||||
|
/* Strip current signature */
|
||||||
|
ctx->pe_ctx->fileend = ctx->pe_ctx->sigpos;
|
||||||
|
}
|
||||||
|
if (!pe_modify_header(ctx, hash, outdata)) {
|
||||||
|
printf("Unable to modify file header\n");
|
||||||
|
return NULL; /* FAILED */
|
||||||
}
|
}
|
||||||
if (ctx->options->cmd == CMD_ATTACH) {
|
if (ctx->options->cmd == CMD_ATTACH) {
|
||||||
/* Obtain an existing PKCS#7 signature */
|
/* Obtain an existing PKCS#7 signature */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user