Changeset View
Changeset View
Standalone View
Standalone View
lib/libsecureboot/veopen.c
Show First 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | |||||
verify_fingerprint(int fd, const char *path, const char *cp, off_t off) | verify_fingerprint(int fd, const char *path, const char *cp, off_t off) | ||||
{ | { | ||||
unsigned char buf[PAGE_SIZE]; | unsigned char buf[PAGE_SIZE]; | ||||
const br_hash_class *md; | const br_hash_class *md; | ||||
br_hash_compat_context mctx; | br_hash_compat_context mctx; | ||||
size_t hlen; | size_t hlen; | ||||
int n; | int n; | ||||
if (strncmp(cp, "sha256=", 7) == 0) { | if (strncmp(cp, "no_hash", 7) == 0) { | ||||
return (VE_FINGERPRINT_IGNORE); | |||||
} else if (strncmp(cp, "sha256=", 7) == 0) { | |||||
md = &br_sha256_vtable; | md = &br_sha256_vtable; | ||||
hlen = br_sha256_SIZE; | hlen = br_sha256_SIZE; | ||||
cp += 7; | cp += 7; | ||||
#ifdef VE_SHA1_SUPPORT | #ifdef VE_SHA1_SUPPORT | ||||
} else if (strncmp(cp, "sha1=", 5) == 0) { | } else if (strncmp(cp, "sha1=", 5) == 0) { | ||||
md = &br_sha1_vtable; | md = &br_sha1_vtable; | ||||
hlen = br_sha1_SIZE; | hlen = br_sha1_SIZE; | ||||
cp += 5; | cp += 5; | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | verify_fd(int fd, const char *path, off_t off, struct stat *stp) | ||||
cp = fingerprint_info_lookup(fd, path); | cp = fingerprint_info_lookup(fd, path); | ||||
if (!cp) { | if (!cp) { | ||||
ve_error_set("%s: no entry", path); | ve_error_set("%s: no entry", path); | ||||
return (VE_FINGERPRINT_NONE); | return (VE_FINGERPRINT_NONE); | ||||
} | } | ||||
rc = verify_fingerprint(fd, path, cp, off); | rc = verify_fingerprint(fd, path, cp, off); | ||||
switch (rc) { | switch (rc) { | ||||
case VE_FINGERPRINT_OK: | case VE_FINGERPRINT_OK: | ||||
case VE_FINGERPRINT_IGNORE: | |||||
case VE_FINGERPRINT_UNKNOWN: | case VE_FINGERPRINT_UNKNOWN: | ||||
return (rc); | return (rc); | ||||
default: | default: | ||||
return (VE_FINGERPRINT_WRONG); | return (VE_FINGERPRINT_WRONG); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
Show All 25 Lines |