Skip to content

Commit

Permalink
libsecureboot: be more verbose about validation failures
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-rochoy-stormshield committed Dec 4, 2023
1 parent 99b8c0c commit 5415237
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/libbearssl/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

BEARSSL?= ${SRCTOP}/contrib/bearssl
BEARSSL_SRC= ${BEARSSL}/src
BEARSSL_TOOLS= ${BEARSSL}/tools

CFLAGS+= -I${BEARSSL}/inc
CFLAGS+= ${NO_WDEPRECATED_NON_PROTOTYPE}
3 changes: 3 additions & 0 deletions lib/libbearssl/Makefile.libsa.inc
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ SRCS+= \
x509/x509_decoder.c \
x509/x509_minimal.c \

# We want find_error_name().
SRCS+= \
${BEARSSL_TOOLS}/errors.c \
12 changes: 9 additions & 3 deletions lib/libsecureboot/vets.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,15 @@ verify_signer_xcs(br_x509_certificate *xcs,
ve_error_set("Validation failed, certificate not valid as of %s",
gdate(date, sizeof(date), ve_utc));
break;
default:
ve_error_set("Validation failed, err = %d", err);
break;
default: {
const char *err_desc = NULL;
const char *err_name = find_error_name(err, &err_desc);

if (err_name == NULL)
ve_error_set("Validation failed, err = %d", err);
else
ve_error_set("Validation failed, %s (%s)", err_desc, err_name);
break; }
}
} else {
tpk = mc.vtable->get_pkey(&mc.vtable, &usages);
Expand Down

0 comments on commit 5415237

Please sign in to comment.