Blame SOURCES/Check-key-derivation-key-is-available.patch

04a7a1
From 8b707e8bfcbfd073579ee553b982b4784490f5ea Mon Sep 17 00:00:00 2001
04a7a1
From: Daniel Kopecek <dkopecek@redhat.com>
04a7a1
Date: Wed, 5 Dec 2018 13:18:59 +0100
04a7a1
Subject: [PATCH] clevis-encrypt-tang: check key derivation key is available
04a7a1
 before encryption
04a7a1
04a7a1
---
04a7a1
 src/pins/tang/clevis-encrypt-tang | 6 +++++-
04a7a1
 1 file changed, 5 insertions(+), 1 deletion(-)
04a7a1
04a7a1
diff --git a/src/pins/tang/clevis-encrypt-tang b/src/pins/tang/clevis-encrypt-tang
04a7a1
index e65a7d1..7fc55ca 100755
04a7a1
--- a/src/pins/tang/clevis-encrypt-tang
04a7a1
+++ b/src/pins/tang/clevis-encrypt-tang
04a7a1
@@ -114,7 +114,11 @@ elif [ "$thp" != "any" ] && \
04a7a1
 fi
04a7a1
 
04a7a1
 ### Perform encryption
04a7a1
-enc=`jose jwk use -i- -r -u deriveKey -o- <<< "$jwks"`
04a7a1
+if ! enc=`jose jwk use -i- -r -u deriveKey -o- <<< "$jwks"`; then
04a7a1
+    echo "Key derivation key not available!" >&2
04a7a1
+    exit 1
04a7a1
+fi
04a7a1
+
04a7a1
 jose fmt -j "$enc" -Og keys -A || enc="{\"keys\":[$enc]}"
04a7a1
 
04a7a1
 for jwk in `jose fmt -j- -Og keys -Af- <<< "$enc"`; do
04a7a1
-- 
04a7a1
2.13.6
04a7a1