diff mbox series

[v2,1/2] ima_evm_utils: Fix calculation of keyid for older distros

Message ID 20210202155625.3555769-2-stefanb@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series ima_evm_utils: Add tests for ECDSA signature checking | expand

Commit Message

Stefan Berger Feb. 2, 2021, 3:56 p.m. UTC
Older distros, such as Ubuntu Xenial or Centos 7, fail to calculate the
keyid properly in the bash script. Adding 'tail -n1' into the pipe fixes
the issue since we otherwise have two numbers in 'id' due to two
'BIT STRING's.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/sign_verify.test | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/tests/sign_verify.test b/tests/sign_verify.test
index 288e133..2477b34 100755
--- a/tests/sign_verify.test
+++ b/tests/sign_verify.test
@@ -43,6 +43,7 @@  _keyid_from_cert() {
   id=$($cmd 2>/dev/null \
     | openssl asn1parse \
     | grep BIT.STRING \
+    | tail -n1 \
     | cut -d: -f1)
   if [ -z "$id" ]; then
     echo - "$cmd" >&2