Skip to content

Commit

Permalink
add disable ms-valiation
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Tseng <dennis.tseng@suse.com>
Co-authored-by: Kamil Aronowski <kamil.aronowski@yahoo.com>
  • Loading branch information
dennis-tseng99 and aronowski committed May 9, 2023
1 parent 9912cbc commit 1b4f664
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions post-process-pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,12 @@ ms_validation(PE_COFF_LOADER_IMAGE_CONTEXT *ctx)

Section = ctx->FirstSection;
//printf("NumberOfSections=%d\n",ctx->NumberOfSections);
for (i = 0; i < ctx->NumberOfSections; i++, Section++) {
for (i=0, Section = ctx->FirstSection; i < ctx->NumberOfSections; i++, Section++) {
//printf("name=%s, Charact=0x%04x\n",Section->Name,Section->Characteristics);
if ((Section->Characteristics & EFI_IMAGE_SCN_MEM_WRITE) &&
(Section->Characteristics & EFI_IMAGE_SCN_MEM_EXECUTE)) {
debug(INFO, "%14s: %s\n","Section-Wr-Exe", "FAIL");
return;
return;
}
}
debug(INFO, "%14s: %s\n","Section-Wr-Exe", "PASS");
Expand Down Expand Up @@ -518,7 +518,8 @@ static void __attribute__((__noreturn__)) usage(int status)
fprintf(out, " -v Be more verbose\n");
fprintf(out, " -N Disable the NX compatibility flag\n");
fprintf(out, " -n Enable the NX compatibility flag\n");
fprintf(out, " -m Microsoft validation\n");
fprintf(out, " -M Disable test for Microsoft's signing requirements\n");
fprintf(out, " -m Enable test for Microsoft's signing requirements\n");
fprintf(out, " -h Print this help text and exit\n");

exit(status);
Expand Down Expand Up @@ -553,7 +554,7 @@ int main(int argc, char **argv)
};
int longindex = -1;

while ((i = getopt_long(argc, argv, "hNnmqv", options, &longindex)) != -1) {
while ((i = getopt_long(argc, argv, "hNnMmqv", options, &longindex)) != -1) {
switch (i) {
case 'h':
case '?':
Expand All @@ -565,6 +566,9 @@ int main(int argc, char **argv)
case 'n':
set_nx_compat = true;
break;
case 'M':
set_ms_validation = false;
break;
case 'm':
set_ms_validation = true;
break;
Expand Down

0 comments on commit 1b4f664

Please sign in to comment.