[3/4] ipa: ipa-sign: Sign IPA according to the signature algorithm of the key
diff mbox series

Message ID 20260408075540.53309-4-hpa@redhat.com
State New
Headers show
Series
  • Implement ML-DSA-65 for Post-Quantum Cryptographic compliance
Related show

Commit Message

Kate Hsuan April 8, 2026, 7:55 a.m. UTC
Sign IPA according to the signature algorithm of the key.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
---
 src/ipa/ipa-sign.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/ipa/ipa-sign.sh b/src/ipa/ipa-sign.sh
index 69024213..aa9c7d31 100755
--- a/src/ipa/ipa-sign.sh
+++ b/src/ipa/ipa-sign.sh
@@ -10,4 +10,9 @@  key="$1"
 input="$2"
 output="$3"
 
-openssl dgst -sha256 -sign "${key}" -out "${output}" "${input}"
+if openssl pkey -text -noout -in "${key}" 2>/dev/null | grep -q "ML-DSA"; then
+	openssl pkeyutl -sign -inkey "${key}" -rawin \
+		-in "${input}" -out "${output}"
+else
+	openssl dgst -sha256 -sign "${key}" -out "${output}" "${input}"
+fi