mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-05-20 18:34:29 -05:00
fix compilation warnings
This commit is contained in:
parent
b96f440b03
commit
5abe856e77
@ -998,6 +998,9 @@ static unsigned char nib2val(unsigned char c) {
|
|||||||
} else if (c >= 'A' && c <= 'F') {
|
} else if (c >= 'A' && c <= 'F') {
|
||||||
return c - 'A' + 10;
|
return c - 'A' + 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Illegal hex value: '%x'\n", c);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int verify_leaf_hash(X509 *leaf, char *leafhash) {
|
static int verify_leaf_hash(X509 *leaf, char *leafhash) {
|
||||||
@ -1337,8 +1340,12 @@ static gboolean msi_handle_dir(GsfInfile *infile, GsfOutfile *outole, BIO *hash)
|
|||||||
static int msi_verify_file(GsfInfile *infile, char *leafhash) {
|
static int msi_verify_file(GsfInfile *infile, char *leafhash) {
|
||||||
GsfInput *sig = NULL;
|
GsfInput *sig = NULL;
|
||||||
GsfInput *exsig = NULL;
|
GsfInput *exsig = NULL;
|
||||||
|
unsigned char *exdata = NULL;
|
||||||
|
unsigned char *indata = NULL;
|
||||||
gchar decoded[0x40];
|
gchar decoded[0x40];
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
|
X509_STORE *store = NULL;
|
||||||
|
PKCS7 *p7 = NULL;
|
||||||
|
|
||||||
for (i = 0; i < gsf_infile_num_children(infile); i++) {
|
for (i = 0; i < gsf_infile_num_children(infile); i++) {
|
||||||
GsfInput *child = gsf_infile_child_by_index(infile, i);
|
GsfInput *child = gsf_infile_child_by_index(infile, i);
|
||||||
@ -1356,13 +1363,12 @@ static int msi_verify_file(GsfInfile *infile, char *leafhash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned long inlen = (unsigned long) gsf_input_remaining(sig);
|
unsigned long inlen = (unsigned long) gsf_input_remaining(sig);
|
||||||
unsigned char *indata = malloc(inlen);
|
indata = malloc(inlen);
|
||||||
if (gsf_input_read(sig, inlen, indata) == NULL) {
|
if (gsf_input_read(sig, inlen, indata) == NULL) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *exdata = NULL;
|
|
||||||
unsigned long exlen = 0;
|
unsigned long exlen = 0;
|
||||||
if (exsig != NULL) {
|
if (exsig != NULL) {
|
||||||
exlen = (unsigned long) gsf_input_remaining(exsig);
|
exlen = (unsigned long) gsf_input_remaining(exsig);
|
||||||
@ -1376,9 +1382,10 @@ static int msi_verify_file(GsfInfile *infile, char *leafhash) {
|
|||||||
int mdtype = -1;
|
int mdtype = -1;
|
||||||
unsigned char mdbuf[EVP_MAX_MD_SIZE];
|
unsigned char mdbuf[EVP_MAX_MD_SIZE];
|
||||||
unsigned char cmdbuf[EVP_MAX_MD_SIZE];
|
unsigned char cmdbuf[EVP_MAX_MD_SIZE];
|
||||||
|
#ifdef GSF_CAN_READ_MSI_METADATA
|
||||||
unsigned char cexmdbuf[EVP_MAX_MD_SIZE];
|
unsigned char cexmdbuf[EVP_MAX_MD_SIZE];
|
||||||
|
#endif
|
||||||
unsigned char hexbuf[EVP_MAX_MD_SIZE*2+1];
|
unsigned char hexbuf[EVP_MAX_MD_SIZE*2+1];
|
||||||
PKCS7 *p7 = NULL;
|
|
||||||
BIO *bio = NULL;
|
BIO *bio = NULL;
|
||||||
|
|
||||||
ASN1_OBJECT *indir_objid = OBJ_txt2obj(SPC_INDIRECT_DATA_OBJID, 1);
|
ASN1_OBJECT *indir_objid = OBJ_txt2obj(SPC_INDIRECT_DATA_OBJID, 1);
|
||||||
@ -1472,9 +1479,9 @@ static int msi_verify_file(GsfInfile *infile, char *leafhash) {
|
|||||||
if (exsig && exdata) {
|
if (exsig && exdata) {
|
||||||
tohex(cexmdbuf, hexbuf, EVP_MD_size(md));
|
tohex(cexmdbuf, hexbuf, EVP_MD_size(md));
|
||||||
int exok = !memcmp(exdata, cexmdbuf, MIN(EVP_MD_size(md), exlen));
|
int exok = !memcmp(exdata, cexmdbuf, MIN(EVP_MD_size(md), exlen));
|
||||||
if (!mdok) ret = 1;
|
if (!exok) ret = 1;
|
||||||
printf("Calculated MsiDigitalSignatureEx : %s", hexbuf);
|
printf("Calculated MsiDigitalSignatureEx : %s", hexbuf);
|
||||||
if (mdok) {
|
if (exok) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else {
|
} else {
|
||||||
tohex(exdata, hexbuf, EVP_MD_size(md));
|
tohex(exdata, hexbuf, EVP_MD_size(md));
|
||||||
@ -1489,7 +1496,7 @@ static int msi_verify_file(GsfInfile *infile, char *leafhash) {
|
|||||||
p7->d.sign->contents->d.other->value.sequence->length);
|
p7->d.sign->contents->d.other->value.sequence->length);
|
||||||
bio = BIO_new_mem_buf(p7->d.sign->contents->d.other->value.sequence->data + seqhdrlen,
|
bio = BIO_new_mem_buf(p7->d.sign->contents->d.other->value.sequence->data + seqhdrlen,
|
||||||
p7->d.sign->contents->d.other->value.sequence->length - seqhdrlen);
|
p7->d.sign->contents->d.other->value.sequence->length - seqhdrlen);
|
||||||
X509_STORE *store = X509_STORE_new();
|
store = X509_STORE_new();
|
||||||
int verok = PKCS7_verify(p7, p7->d.sign->cert, store, bio, NULL, PKCS7_NOVERIFY);
|
int verok = PKCS7_verify(p7, p7->d.sign->cert, store, bio, NULL, PKCS7_NOVERIFY);
|
||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
/* XXX: add more checks here (attributes, timestamp, etc) */
|
/* XXX: add more checks here (attributes, timestamp, etc) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user