From 11b4ff4fc11fda2bce15c2688c19b7dfa2ca60bd Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Feb 10 2018 18:47:18 +0000 Subject: EPEL7 compatibility --- diff --git a/yubico-piv-tool-1.5.0-compat.patch b/yubico-piv-tool-1.5.0-compat.patch new file mode 100644 index 0000000..7e04da1 --- /dev/null +++ b/yubico-piv-tool-1.5.0-compat.patch @@ -0,0 +1,91 @@ +diff --git a/lib/tests/api.c b/lib/tests/api.c +index 7e2cf13..d335a14 100644 +--- a/lib/tests/api.c ++++ b/lib/tests/api.c +@@ -92,6 +92,7 @@ void teardown(void) { + ck_assert_int_eq(res, YKPIV_OK); + } + ++#ifdef HW_TESTS + START_TEST(test_devicemodel) { + ykpiv_rc res; + ykpiv_devmodel model; +@@ -271,7 +272,6 @@ static bool set_component(unsigned char *in_ptr, const BIGNUM *bn, int element_l + static bool prepare_rsa_signature(const unsigned char *in, unsigned int in_len, unsigned char *out, unsigned int *out_len, int nid) { + X509_SIG *digestInfo; + X509_ALGOR *algor; +- ASN1_TYPE parameter; + ASN1_OCTET_STRING *digest; + unsigned char data[1024]; + +@@ -790,19 +790,19 @@ struct t_alloc_data{ + } g_alloc_data; + + static void* _test_alloc(void *data, size_t cb) { +- ck_assert_ptr_eq(data, &g_alloc_data); ++ ck_assert(data == &g_alloc_data); + ((struct t_alloc_data*)data)->count++; + return calloc(cb, 1); + } + + static void * _test_realloc(void *data, void *p, size_t cb) { +- ck_assert_ptr_eq(data, &g_alloc_data); ++ ck_assert(data == &g_alloc_data); + return realloc(p, cb); + } + + static void _test_free(void *data, void *p) { + fflush(stderr); +- ck_assert_ptr_eq(data, &g_alloc_data); ++ ck_assert(data == &g_alloc_data); + ((struct t_alloc_data*)data)->count--; + free(p); + } +@@ -926,6 +926,7 @@ START_TEST(test_pin_cache) { + ck_assert_int_eq(res, YKPIV_OK); + } + END_TEST ++#endif + + int destruction_confirmed(void) { + char *confirmed = getenv("YKPIV_ENV_HWTESTS_CONFIRMED"); +diff --git a/lib/util.c b/lib/util.c +index 9b83eb7..27e3bcd 100644 +--- a/lib/util.c ++++ b/lib/util.c +@@ -221,7 +221,6 @@ ykpiv_rc ykpiv_util_list_keys(ykpiv_state *state, uint8_t *key_count, ykpiv_key + size_t offset = 0; + uint8_t buf[CB_BUF_MAX]; + size_t cbBuf = 0; +- bool transaction = false; + size_t i = 0; + size_t cbRealloc = 0; + +@@ -491,7 +490,6 @@ Cleanup: + ykpiv_rc ykpiv_util_write_mscmap(ykpiv_state *state, ykpiv_container *containers, size_t n_containers) { + ykpiv_rc res = YKPIV_OK; + uint8_t buf[CB_OBJ_MAX]; +- size_t cbBuf = sizeof(buf); + size_t offset = 0; + size_t req_len = 0; + size_t data_len = n_containers * sizeof(ykpiv_container); +@@ -1343,7 +1341,6 @@ static ykpiv_rc _read_certificate(ykpiv_state *state, uint8_t slot, uint8_t *buf + + static ykpiv_rc _write_certificate(ykpiv_state *state, uint8_t slot, uint8_t *data, size_t data_len, uint8_t certinfo) { + uint8_t buf[CB_OBJ_MAX]; +- size_t cbBuf = sizeof(buf); + int object_id = ykpiv_util_slot_object(slot); + size_t offset = 0; + size_t req_len = 0; +diff --git a/tool/util.c b/tool/util.c +index de6b071..103d1d4 100644 +--- a/tool/util.c ++++ b/tool/util.c +@@ -336,7 +336,6 @@ bool set_component(unsigned char *in_ptr, const BIGNUM *bn, int element_len) { + bool prepare_rsa_signature(const unsigned char *in, unsigned int in_len, unsigned char *out, unsigned int *out_len, int nid) { + X509_SIG *digestInfo; + X509_ALGOR *algor; +- ASN1_TYPE parameter; + ASN1_OCTET_STRING *digest; + unsigned char data[1024]; + diff --git a/yubico-piv-tool.spec b/yubico-piv-tool.spec index fe2d68d..18b1a90 100644 --- a/yubico-piv-tool.spec +++ b/yubico-piv-tool.spec @@ -8,6 +8,8 @@ URL: https://developers.yubico.com/yubico-piv-tool/ Source0: https://developers.yubico.com/yubico-piv-tool/Releases/yubico-piv-tool-%{version}.tar.gz Source1: https://developers.yubico.com/yubico-piv-tool/Releases/yubico-piv-tool-%{version}.tar.gz.sig Source2: gpgkey-D41C0DCB.gpg +# https://github.com/Yubico/yubico-piv-tool/pull/138 +Patch0: yubico-piv-tool-1.5.0-compat.patch BuildRequires: pcsc-lite-devel openssl-devel chrpath BuildRequires: gnupg2 gengetopt help2man @@ -35,6 +37,7 @@ This package includes development files. %prep gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0} %setup -q +%patch0 -p1 -b .compat %build %configure --with-backend="pcsc"