Lines 238-244
struct idc *IDC_get(PKCS7 *p7, BIO *bio)
Link Here
|
238 |
|
238 |
|
239 |
/* extract the idc from the signed PKCS7 'other' data */ |
239 |
/* extract the idc from the signed PKCS7 'other' data */ |
240 |
str = p7->d.sign->contents->d.other->value.asn1_string; |
240 |
str = p7->d.sign->contents->d.other->value.asn1_string; |
|
|
241 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
241 |
idcbuf = buf = ASN1_STRING_data(str); |
242 |
idcbuf = buf = ASN1_STRING_data(str); |
|
|
243 |
#else |
244 |
idcbuf = buf = ASN1_STRING_get0_data(str); |
245 |
#endif |
242 |
idc = d2i_IDC(NULL, &buf, ASN1_STRING_length(str)); |
246 |
idc = d2i_IDC(NULL, &buf, ASN1_STRING_length(str)); |
243 |
|
247 |
|
244 |
/* If we were passed a BIO, write the idc data, minus type and length, |
248 |
/* If we were passed a BIO, write the idc data, minus type and length, |
Lines 289-295
int IDC_check_hash(struct idc *idc, struct image *image)
Link Here
|
289 |
} |
293 |
} |
290 |
|
294 |
|
291 |
/* check hash against the one we calculated from the image */ |
295 |
/* check hash against the one we calculated from the image */ |
|
|
296 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
292 |
buf = ASN1_STRING_data(str); |
297 |
buf = ASN1_STRING_data(str); |
|
|
298 |
#else |
299 |
buf = ASN1_STRING_get0_data(str); |
300 |
#endif |
293 |
if (memcmp(buf, sha, sizeof(sha))) { |
301 |
if (memcmp(buf, sha, sizeof(sha))) { |
294 |
fprintf(stderr, "Hash doesn't match image\n"); |
302 |
fprintf(stderr, "Hash doesn't match image\n"); |
295 |
fprintf(stderr, " got: %s\n", sha256_str(buf)); |
303 |
fprintf(stderr, " got: %s\n", sha256_str(buf)); |