Skip to content

Commit

Permalink
[ml-functions] Use acminfo to ID sinit modules
Browse files Browse the repository at this point in the history
  New SINIT modules no longer have the well known fingerprint that
  starts with c22c443. Instead, we can use the acminfo tool and check
  the return code to know whether or not the module being processed
  is a SINIT.

Signed-off-by: Chris Rogers <[email protected]>
  • Loading branch information
Chris Rogers committed Sep 6, 2023
1 parent ef177b4 commit 1674c67
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ hash_extend() {
rm $buffer
}

is_sinit_module() {
acminfo "${1}" >/dev/null 2>&1
}

# Function to calculate PCR 17
# return 0 on success
# return 1 on failure
Expand Down Expand Up @@ -262,13 +266,9 @@ pcr19() {
cmdline=""
fi

# ACMs have a binary fingerprint, hash first 8 bytes of every .bin file
# and if it matches hash of fingerprint, skip.
if $(echo ${module} | egrep -q -e '\.bin$|\.BIN$'); then
finger=$(head -c 8 ${root}/${module}|sha1sum|head -c 7)
if [ "$finger" = "c22c443" ]; then
continue
fi
# skip SINIT modules
if is_sinit_module ${module}; then
continue
fi

case ${mod_num} in
Expand Down Expand Up @@ -331,14 +331,11 @@ hash_modules() {
cmdline=""
fi

# ACMs have a binary fingerprint, hash first 8 bytes of every .bin file
# and if it matches hash of fingerprint, skip.
if $(echo ${module} | egrep -q -e '\.bin$|\.BIN$'); then
finger=$(head -c 8 ${root}/${module}|sha1sum|head -c 7)
[ "$finger" = "c22c443" ] && continue
# skip SINIT modules
if is_sinit_module ${module}; then
continue
fi


if [[ ${mod_num} -eq 0 ]]; then
cmdline=$(echo ${cmdline} | sed -e 's/FIXME\s*//')
hash_list=$(lcp2_mlehash --create --alg $hashalg \
Expand Down

0 comments on commit 1674c67

Please sign in to comment.