diff --git a/yubihsm-shell-2.0.0-gcc9.patch b/yubihsm-shell-2.0.0-gcc9.patch new file mode 100644 index 0000000..71d5898 --- /dev/null +++ b/yubihsm-shell-2.0.0-gcc9.patch @@ -0,0 +1,36 @@ +diff -up yubihsm-shell-2.0.0/pkcs11/tests/ecdh_derive_test.c.gcc9 yubihsm-shell-2.0.0/pkcs11/tests/ecdh_derive_test.c +--- yubihsm-shell-2.0.0/pkcs11/tests/ecdh_derive_test.c.gcc9 2019-02-13 14:40:19.972274817 +0100 ++++ yubihsm-shell-2.0.0/pkcs11/tests/ecdh_derive_test.c 2019-02-13 14:40:54.957601833 +0100 +@@ -365,7 +365,10 @@ static bool test_ecdh_value(const char * + } + + // Compare values +- unsigned char ecdh1_bytes[ecdh1_len]; // public key in DER ++ unsigned char *ecdh1_bytes = malloc(ecdh1_len); // public key in DER ++ if (ecdh1_bytes == NULL) { ++ return false; ++ } + if (get_yhvalue(*ecdh1, ecdh1_bytes, ecdh1_len) == 0) { + fail("Failed to retrieve derived key from Yubi library"); + return false; +@@ -378,6 +381,7 @@ static bool test_ecdh_value(const char * + break; + } + } ++ free(ecdh1_bytes); + if (!equal) { + fail("ECDH keys derived with yubi library and with openssl do not have the " + "same value"); +@@ -416,7 +420,11 @@ static bool test_dublicate_ecdh(const ch + return false; + } + +- unsigned char ecdh1_value[ecdh1_len], ecdh2_value[ecdh2_len]; ++ unsigned char *ecdh1_value = malloc(ecdh1_len); ++ unsigned char *ecdh2_value = malloc(ecdh2_len); ++ if (ecdh1_value == NULL || ecdh2_value == NULL) { ++ return false; ++ } + if (get_yhvalue(*ecdh2, ecdh1_value, ecdh1_len) == 0) { + return false; + } diff --git a/yubihsm-shell.spec b/yubihsm-shell.spec index 1d76e90..10731c8 100644 --- a/yubihsm-shell.spec +++ b/yubihsm-shell.spec @@ -10,6 +10,7 @@ Source1: https://developers.yubico.com/%{name}/Releases/%{name}-%{version}.tar.g Source2: gpgkey-B2168C0A.gpg # https://github.com/Yubico/yubihsm-shell/pull/7 Patch1: %{name}-2.0.0-install-to-lib64.patch +Patch2: %{name}-2.0.0-gcc9.patch BuildRequires: cmake BuildRequires: cppcheck @@ -42,6 +43,7 @@ Development libraries for working with yubihsm 2. gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0} %setup -q %patch1 -p1 +%patch2 -p1 -b .gcc9 %build