From f5c42cef894f212f88ee413f55bd7f8ef2ed3ffa Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Sat, 10 Feb 2018 19:35:12 +0100 Subject: [PATCH 1/3] Do not build test if HW_TESTS is not enabled (to avoid warnings) --- lib/tests/api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/tests/api.c b/lib/tests/api.c index 7e2cf13..3c47962 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; @@ -926,6 +927,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"); From dfca8e2e553b1fe488babfce580e979155787ede Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Sat, 10 Feb 2018 19:36:07 +0100 Subject: [PATCH 2/3] Remove unused variables --- lib/tests/api.c | 1 - lib/util.c | 3 --- tool/util.c | 1 - 3 files changed, 5 deletions(-) diff --git a/lib/tests/api.c b/lib/tests/api.c index 3c47962..bd2437d 100644 --- a/lib/tests/api.c +++ b/lib/tests/api.c @@ -272,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]; 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]; From bbd92009fc77b65f9fe3875725734dc72afc70cd Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 27 Feb 2018 15:40:22 +0100 Subject: [PATCH 3/3] libcheck 0.9 compatibility for RHEL7 --- lib/tests/api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tests/api.c b/lib/tests/api.c index bd2437d..a41e08c 100644 --- a/lib/tests/api.c +++ b/lib/tests/api.c @@ -52,6 +52,10 @@ int destruction_confirmed(void); #ifndef ck_assert_mem_eq #define ck_assert_mem_eq(a,b,n) ck_assert(memcmp((a), (b), (n)) == 0) #endif +// only defined in libcheck 0.10+ (RHEL7 is still shipping 0.9) +#ifndef ck_assert_ptr_eq +#define ck_assert_ptr_eq(a,b) ck_assert((void *)(a) == (void *)(b)) +#endif ykpiv_state *g_state; const uint8_t g_cert[] = {