mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-07-03 11:42:47 -05:00
APPX support (#303)
Co-authored-by: Maciej Panek <Maciej.panek@punxworks.com> Co-authored-by: olszomal <Malgorzata.Olszowka@stunnel.org>
This commit is contained in:
12
pe.c
12
pe.c
@ -44,6 +44,7 @@ struct pe_ctx_st {
|
||||
/* FILE_FORMAT method prototypes */
|
||||
static FILE_FORMAT_CTX *pe_ctx_new(GLOBAL_OPTIONS *options, BIO *hash, BIO *outdata);
|
||||
static ASN1_OBJECT *pe_spc_image_data_get(u_char **p, int *plen, FILE_FORMAT_CTX *ctx);
|
||||
static int pe_hash_length_get(FILE_FORMAT_CTX *ctx);
|
||||
static int pe_check_file(FILE_FORMAT_CTX *ctx, int detached);
|
||||
static u_char *pe_digest_calc(FILE_FORMAT_CTX *ctx, const EVP_MD *md);
|
||||
static int pe_verify_digests(FILE_FORMAT_CTX *ctx, PKCS7 *p7);
|
||||
@ -59,6 +60,7 @@ static void pe_ctx_cleanup(FILE_FORMAT_CTX *ctx, BIO *hash, BIO *outdata);
|
||||
FILE_FORMAT file_format_pe = {
|
||||
.ctx_new = pe_ctx_new,
|
||||
.data_blob_get = pe_spc_image_data_get,
|
||||
.hash_length_get = pe_hash_length_get,
|
||||
.check_file = pe_check_file,
|
||||
.digest_calc = pe_digest_calc,
|
||||
.verify_digests = pe_verify_digests,
|
||||
@ -168,6 +170,15 @@ static ASN1_OBJECT *pe_spc_image_data_get(u_char **p, int *plen, FILE_FORMAT_CTX
|
||||
return dtype; /* OK */
|
||||
}
|
||||
|
||||
/*
|
||||
* [in] ctx: structure holds input and output data
|
||||
* [returns] the size of the message digest when passed an EVP_MD structure (the size of the hash)
|
||||
*/
|
||||
static int pe_hash_length_get(FILE_FORMAT_CTX *ctx)
|
||||
{
|
||||
return EVP_MD_size(ctx->options->md);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print current and calculated PE checksum,
|
||||
* check if the signature exists.
|
||||
@ -918,7 +929,6 @@ static u_char *pe_page_hash_calc(int *rphlen, FILE_FORMAT_CTX *ctx, int phtype)
|
||||
|
||||
/* NumberOfSections indicates the size of the section table,
|
||||
* which immediately follows the headers, can be up to 65535 under Vista and later */
|
||||
/* coverity[byte_swapping] */
|
||||
nsections = GET_UINT16_LE(ctx->options->indata + ctx->pe_ctx->header_size + 6);
|
||||
if (nsections == 0) {
|
||||
printf("Corrupted number of sections: 0x%08X\n", nsections);
|
||||
|
Reference in New Issue
Block a user