From df966892ce5caefda4cd276ad0923d9a50f26510 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Mon, 2 Mar 2020 13:36:16 +0100
Subject: [PATCH] community/cesnet-tcs-cli: fix openssl command for generating
 EC key

---
 community/cesnet-tcs-cli/APKBUILD            |  9 +++++---
 community/cesnet-tcs-cli/fix-genkey-ec.patch | 24 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 community/cesnet-tcs-cli/fix-genkey-ec.patch

diff --git a/community/cesnet-tcs-cli/APKBUILD b/community/cesnet-tcs-cli/APKBUILD
index 9285b9816e35..9cbfe9217374 100644
--- a/community/cesnet-tcs-cli/APKBUILD
+++ b/community/cesnet-tcs-cli/APKBUILD
@@ -2,18 +2,21 @@
 # Maintainer: Jakub Jirutka <jakub@jirutka.cz>
 pkgname=cesnet-tcs-cli
 pkgver=0.2.0
-pkgrel=0
+pkgrel=1
 pkgdesc="Client utility for CESNET TCS API"
 url="https://github.com/jirutka/cesnet-tcs-cli"
 arch="noarch"
 license="MIT"
 depends="ca-certificates curl openssl"
 options="!check"  # no tests provided
-source="https://github.com/jirutka/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
+source="https://github.com/jirutka/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz
+	fix-genkey-ec.patch
+	"
 builddir="$srcdir/$pkgname-$pkgver"
 
 package() {
 	make install DESTDIR="$pkgdir" prefix=/usr
 }
 
-sha512sums="006015d8f0ba0f2696c6801258afe9ef62c4a2d55cfa1a1300e9d1a80fef6f5bc62f283e5f8deffe48773b1ac9369c59bacf6ab9a127c152133ecfc314ed52e8  cesnet-tcs-cli-0.2.0.tar.gz"
+sha512sums="006015d8f0ba0f2696c6801258afe9ef62c4a2d55cfa1a1300e9d1a80fef6f5bc62f283e5f8deffe48773b1ac9369c59bacf6ab9a127c152133ecfc314ed52e8  cesnet-tcs-cli-0.2.0.tar.gz
+429e689ec782e7e5ef3e36d5c7038c9a17a5da72f96aac00ea2f878151d8ec4dca52f78fa0347a0acb046a1134b22c4345d2b13203ea59336e5d62a44ec56703  fix-genkey-ec.patch"
diff --git a/community/cesnet-tcs-cli/fix-genkey-ec.patch b/community/cesnet-tcs-cli/fix-genkey-ec.patch
new file mode 100644
index 000000000000..b81a3273f472
--- /dev/null
+++ b/community/cesnet-tcs-cli/fix-genkey-ec.patch
@@ -0,0 +1,24 @@
+From f5e5519a04da0cf198c77756adb339e3d202cd78 Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Mon, 2 Mar 2020 13:24:47 +0100
+Subject: [PATCH] Fix openssl command for generating EC key
+
+The current command generates PEM file with both EC parameters and the
+key and it results in an invalid CSR.
+---
+ cesnet-tcs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cesnet-tcs b/cesnet-tcs
+index 35f093a..9ff1457 100755
+--- a/cesnet-tcs
++++ b/cesnet-tcs
+@@ -193,7 +193,7 @@
+ 
+ 	case "$key_alg" in
+ 		rsa:*) openssl genrsa -out "$outfile" ${key_alg#*:};;
+-		*) openssl ecparam -name "$key_alg" -genkey -param_enc explicit -out "$outfile";;
++		*) openssl ecparam -genkey -name "$key_alg" -noout -out "$outfile";;
+ 	esac
+ 
+ 	umask "$orig_umask"
-- 
GitLab