mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-04-05 09:08:04 -05:00
free up BIO outdata only for MSI files
This commit is contained in:
parent
e26a50a618
commit
64e7e26eba
@ -4334,6 +4334,8 @@ static PKCS7 *create_new_signature(file_type_t type,
|
|||||||
* the consistency of a private key with the public key in an X509 certificate
|
* the consistency of a private key with the public key in an X509 certificate
|
||||||
*/
|
*/
|
||||||
si = PKCS7_add_signature(sig, cparams->cert, cparams->pkey, options->md);
|
si = PKCS7_add_signature(sig, cparams->cert, cparams->pkey, options->md);
|
||||||
|
if (si == NULL)
|
||||||
|
return NULL; /* FAILED */
|
||||||
} else {
|
} else {
|
||||||
/* find the signer's certificate located somewhere in the whole certificate chain */
|
/* find the signer's certificate located somewhere in the whole certificate chain */
|
||||||
for (i=0; i<sk_X509_num(cparams->certs); i++) {
|
for (i=0; i<sk_X509_num(cparams->certs); i++) {
|
||||||
@ -4344,11 +4346,12 @@ static PKCS7 *create_new_signature(file_type_t type,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (si == NULL) {
|
if (si == NULL) {
|
||||||
printf("PKCS7_add_signature failed\n");
|
printf("Failed to checking the consistency of a private key: %s\n", options->keyfile);
|
||||||
|
printf(" with a public key in any X509 certificate: %s\n\n", options->certfile);
|
||||||
return NULL; /* FAILED */
|
return NULL; /* FAILED */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pkcs7_add_signing_time(si, options->signing_time);
|
pkcs7_add_signing_time(si, options->signing_time);
|
||||||
if (type == FILE_TYPE_CAT) {
|
if (type == FILE_TYPE_CAT) {
|
||||||
PKCS7_add_signed_attribute(si, NID_pkcs9_contentType,
|
PKCS7_add_signed_attribute(si, NID_pkcs9_contentType,
|
||||||
@ -5996,8 +5999,10 @@ err_cleanup:
|
|||||||
if (hash)
|
if (hash)
|
||||||
BIO_free_all(hash);
|
BIO_free_all(hash);
|
||||||
if (outdata) {
|
if (outdata) {
|
||||||
|
if (type == FILE_TYPE_MSI) {
|
||||||
BIO_free_all(outdata);
|
BIO_free_all(outdata);
|
||||||
outdata = NULL;
|
outdata = NULL;
|
||||||
|
}
|
||||||
unlink(options.outfile);
|
unlink(options.outfile);
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user