Sync with ChOma

This commit is contained in:
opa334 2023-11-27 22:40:19 +01:00
parent 33f1d47d4c
commit 160191bd34
1 changed files with 3 additions and 5 deletions

View File

@ -153,11 +153,8 @@ int apply_coretrust_bypass(const char *machoPath)
// Otherwise use the main code directory // Otherwise use the main code directory
realCodeDirBlob = mainCodeDirBlob; realCodeDirBlob = mainCodeDirBlob;
} }
CS_CodeDirectory *realCD = malloc(sizeof(CS_CodeDirectory)); if (csd_code_directory_get_hash_type(realCodeDirBlob) != CS_HASHTYPE_SHA256_256) {
csd_blob_read(realCodeDirBlob, 0, sizeof(CS_CodeDirectory), realCD);
CODE_DIRECTORY_APPLY_BYTE_ORDER(realCD, BIG_TO_HOST_APPLIER);
if (realCD->hashType != CS_HASHTYPE_SHA256_256) {
printf("Error: Alternate code directory is not SHA256, bypass won't work!\n"); printf("Error: Alternate code directory is not SHA256, bypass won't work!\n");
return -1; return -1;
} }
@ -180,6 +177,7 @@ int apply_coretrust_bypass(const char *machoPath)
csd_superblob_remove_blob(decodedSuperblob, signatureBlob); csd_superblob_remove_blob(decodedSuperblob, signatureBlob);
csd_blob_free(signatureBlob); csd_blob_free(signatureBlob);
} }
// Append new template blob // Append new template blob
signatureBlob = csd_blob_init(CSSLOT_SIGNATURESLOT, (CS_GenericBlob *)TemplateSignatureBlob); signatureBlob = csd_blob_init(CSSLOT_SIGNATURESLOT, (CS_GenericBlob *)TemplateSignatureBlob);
csd_superblob_append_blob(decodedSuperblob, signatureBlob); csd_superblob_append_blob(decodedSuperblob, signatureBlob);