- fix build with gcc 10

This commit is contained in:
Dan Horák 2020-02-03 13:52:06 +01:00
parent 3cf0603913
commit 32de57c481
2 changed files with 260 additions and 1 deletions

View File

@ -0,0 +1,254 @@
From 33e58bc69b1c26b20b3c4a2ea6061fe15c5ffbbc Mon Sep 17 00:00:00 2001
From: Ingo Franzki <ifranzki@linux.ibm.com>
Date: Fri, 31 Jan 2020 11:06:22 +0100
Subject: [PATCH] Fix build issue with gcc 10 and -fno-common
With gcc 10 -fno-common is the default.
Fixes: https://github.com/opencryptoki/opencryptoki/issues/271
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
---
testcases/common/common.c | 8 ++++++++
testcases/include/regress.h | 12 ++++++------
testcases/login/digest_init.c | 1 -
testcases/login/init_pin.c | 1 -
testcases/login/init_tok.c | 3 ---
testcases/login/login.c | 1 -
testcases/login/login_flags.c | 1 -
testcases/login/set_pin.c | 1 -
testcases/misc_tests/speed.c | 3 ---
testcases/misc_tests/threadmkobj.c | 4 ----
testcases/misc_tests/tok_des.c | 3 ---
testcases/misc_tests/tok_obj.c | 4 ----
testcases/misc_tests/tok_obj2.c | 4 ----
testcases/misc_tests/tok_rsa.c | 2 --
testcases/pkcs11/hw_fn.c | 1 -
15 files changed, 14 insertions(+), 35 deletions(-)
diff --git a/testcases/common/common.c b/testcases/common/common.c
index 5302bc1b..5451a52e 100644
--- a/testcases/common/common.c
+++ b/testcases/common/common.c
@@ -16,6 +16,14 @@
#include "pkcs11types.h"
#include "regress.h"
+CK_FUNCTION_LIST *funcs;
+CK_SLOT_ID SLOT_ID;
+
+CK_BBOOL skip_token_obj;
+CK_BBOOL no_stop;
+CK_BBOOL no_init;
+CK_BBOOL securekey;
+
CK_ULONG t_total = 0; // total test assertions
CK_ULONG t_ran = 0; // number of assertions ran
CK_ULONG t_passed = 0; // number of assertions passed
diff --git a/testcases/include/regress.h b/testcases/include/regress.h
index 610f7339..8c7c5360 100644
--- a/testcases/include/regress.h
+++ b/testcases/include/regress.h
@@ -79,8 +79,8 @@ CK_RV DummyFunction(CK_SLOT_ID id);
int digest_functions(void);
-CK_FUNCTION_LIST *funcs;
-CK_SLOT_ID SLOT_ID;
+extern CK_FUNCTION_LIST *funcs;
+extern CK_SLOT_ID SLOT_ID;
void usage(char *fct);
int do_ParseArgs(int argc, char **argv);
@@ -93,10 +93,10 @@ extern CK_BYTE DSA_PUBL_PRIME[128];
extern CK_BYTE DSA_PUBL_SUBPRIME[20];
extern CK_BYTE DSA_PUBL_BASE[128];
-CK_BBOOL skip_token_obj;
-CK_BBOOL no_stop;
-CK_BBOOL no_init;
-CK_BBOOL securekey;
+extern CK_BBOOL skip_token_obj;
+extern CK_BBOOL no_stop;
+extern CK_BBOOL no_init;
+extern CK_BBOOL securekey;
int get_so_pin(CK_BYTE_PTR);
int get_user_pin(CK_BYTE_PTR);
diff --git a/testcases/login/digest_init.c b/testcases/login/digest_init.c
index b1f21a19..aebc826f 100644
--- a/testcases/login/digest_init.c
+++ b/testcases/login/digest_init.c
@@ -21,7 +21,6 @@
#include "regress.h"
#include "common.c"
-CK_FUNCTION_LIST *funcs;
int do_GetFunctionList(void);
int do_digestInit(CK_FUNCTION_LIST * funcs, CK_SLOT_ID slot_id,
diff --git a/testcases/login/init_pin.c b/testcases/login/init_pin.c
index 4b310d48..6cca186d 100644
--- a/testcases/login/init_pin.c
+++ b/testcases/login/init_pin.c
@@ -21,7 +21,6 @@
#include "regress.h"
#include "common.c"
-CK_FUNCTION_LIST *funcs;
int do_GetFunctionList(void);
int do_InitPIN(CK_FUNCTION_LIST * funcs, CK_SLOT_ID slot_id, char *sologinpass,
diff --git a/testcases/login/init_tok.c b/testcases/login/init_tok.c
index c91fc098..a1703caf 100644
--- a/testcases/login/init_tok.c
+++ b/testcases/login/init_tok.c
@@ -24,14 +24,11 @@
#include "regress.h"
#include "common.c"
-CK_FUNCTION_LIST *funcs;
int do_GetInfo(void);
CK_RV C_GetFunctionList(CK_FUNCTION_LIST **);
int do_GetFunctionList(void);
-CK_SLOT_ID SLOT_ID;
-
int do_inittoken(CK_FUNCTION_LIST * funcs, CK_BYTE * sopass)
{
CK_BYTE label[32];
diff --git a/testcases/login/login.c b/testcases/login/login.c
index 4ebf8667..7de4a079 100644
--- a/testcases/login/login.c
+++ b/testcases/login/login.c
@@ -20,7 +20,6 @@
#include "regress.h"
#include "common.c"
-CK_FUNCTION_LIST *funcs;
int do_GetFunctionList(void);
int do_LoginLogout(CK_FUNCTION_LIST * funcs, CK_SLOT_ID slot_id,
diff --git a/testcases/login/login_flags.c b/testcases/login/login_flags.c
index 187261a1..5fdd9815 100644
--- a/testcases/login/login_flags.c
+++ b/testcases/login/login_flags.c
@@ -36,7 +36,6 @@ int do_GetFunctionList(void);
int clean_up(void);
CK_SLOT_ID slot_id;
-CK_FUNCTION_LIST *funcs;
CK_SESSION_HANDLE session_handle;
CK_SESSION_INFO si;
CK_TOKEN_INFO ti;
diff --git a/testcases/login/set_pin.c b/testcases/login/set_pin.c
index 52bb058c..786ba71d 100644
--- a/testcases/login/set_pin.c
+++ b/testcases/login/set_pin.c
@@ -22,7 +22,6 @@
#include "regress.h"
#include "common.c"
-CK_FUNCTION_LIST *funcs;
int do_GetFunctionList(void);
int do_SetPIN(CK_FUNCTION_LIST * funcs, CK_SLOT_ID slot_id,
diff --git a/testcases/misc_tests/speed.c b/testcases/misc_tests/speed.c
index 8f71b371..39fdca08 100644
--- a/testcases/misc_tests/speed.c
+++ b/testcases/misc_tests/speed.c
@@ -67,9 +67,6 @@ static inline unsigned long delta_time_us(struct timeval *t1,
int do_GetFunctionList(void);
-CK_FUNCTION_LIST *funcs;
-CK_SLOT_ID SLOT_ID;
-
// keylength: 512, 1024, 2048, 4096
int do_RSA_PKCS_EncryptDecrypt(int keylength)
{
diff --git a/testcases/misc_tests/threadmkobj.c b/testcases/misc_tests/threadmkobj.c
index e9321ec1..f61bbd0b 100644
--- a/testcases/misc_tests/threadmkobj.c
+++ b/testcases/misc_tests/threadmkobj.c
@@ -35,10 +35,6 @@ void init_coprocessor(void);
CK_RV _C_GetFunctionList(CK_FUNCTION_LIST **);
-CK_FUNCTION_LIST *funcs;
-
-CK_SLOT_ID SLOT_ID;
-
CK_RV open_session_and_login(void)
{
CK_FLAGS flags;
diff --git a/testcases/misc_tests/tok_des.c b/testcases/misc_tests/tok_des.c
index 0d7ed49d..4e7f81d3 100644
--- a/testcases/misc_tests/tok_des.c
+++ b/testcases/misc_tests/tok_des.c
@@ -27,9 +27,6 @@
int do_GetFunctionList(void);
-CK_FUNCTION_LIST *funcs;
-CK_SLOT_ID SLOT_ID;
-
CK_RV do_VerifyTokenSymKey(CK_SESSION_HANDLE sess, CK_BYTE * label)
{
CK_OBJECT_HANDLE obj_handles[20];
diff --git a/testcases/misc_tests/tok_obj.c b/testcases/misc_tests/tok_obj.c
index c32fa07e..c6272cc9 100644
--- a/testcases/misc_tests/tok_obj.c
+++ b/testcases/misc_tests/tok_obj.c
@@ -29,10 +29,6 @@ void init_coprocessor(void);
CK_RV C_GetFunctionList(CK_FUNCTION_LIST **);
-CK_FUNCTION_LIST *funcs;
-
-CK_SLOT_ID SLOT_ID;
-
// do_create_token_object()
int do_create_token_object(void)
{
diff --git a/testcases/misc_tests/tok_obj2.c b/testcases/misc_tests/tok_obj2.c
index ad58d7cc..caf2433e 100644
--- a/testcases/misc_tests/tok_obj2.c
+++ b/testcases/misc_tests/tok_obj2.c
@@ -28,10 +28,6 @@ void init_coprocessor(void);
CK_RV C_GetFunctionList(CK_FUNCTION_LIST **);
-CK_FUNCTION_LIST *funcs;
-
-CK_SLOT_ID SLOT_ID;
-
void show_error(CK_BYTE * str, CK_RV rc)
{
printf("%s returned: %ld - %s\n", str, rc, p11_get_ckr(rc));
diff --git a/testcases/misc_tests/tok_rsa.c b/testcases/misc_tests/tok_rsa.c
index 3cc2bcae..b9d34f8f 100644
--- a/testcases/misc_tests/tok_rsa.c
+++ b/testcases/misc_tests/tok_rsa.c
@@ -26,8 +26,6 @@
int do_GetFunctionList(void);
-CK_FUNCTION_LIST *funcs;
-
CK_RV do_Cleanup(CK_SESSION_HANDLE sess)
{
CK_RV rv;
diff --git a/testcases/pkcs11/hw_fn.c b/testcases/pkcs11/hw_fn.c
index 21d79d65..b6a79c91 100644
--- a/testcases/pkcs11/hw_fn.c
+++ b/testcases/pkcs11/hw_fn.c
@@ -34,7 +34,6 @@ int do_GetFunctionList(void);
int clean_up(void);
CK_SLOT_ID slot_id;
-CK_FUNCTION_LIST *funcs;
CK_SESSION_HANDLE sess;
/*

View File

@ -1,7 +1,7 @@
Name: opencryptoki Name: opencryptoki
Summary: Implementation of the PKCS#11 (Cryptoki) specification v2.11 Summary: Implementation of the PKCS#11 (Cryptoki) specification v2.11
Version: 3.12.1 Version: 3.12.1
Release: 2%{?dist} Release: 3%{?dist}
License: CPL License: CPL
URL: https://github.com/opencryptoki/opencryptoki URL: https://github.com/opencryptoki/opencryptoki
Source0: https://github.com/opencryptoki/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/opencryptoki/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
@ -11,6 +11,8 @@ Patch0: opencryptoki-3.11.0-group.patch
# bz#1373833, change tmpfiles snippets from /var/lock/* to /run/lock/* # bz#1373833, change tmpfiles snippets from /var/lock/* to /run/lock/*
Patch1: opencryptoki-3.11.0-lockdir.patch Patch1: opencryptoki-3.11.0-lockdir.patch
# https://github.com/opencryptoki/opencryptoki/commit/33e58bc69b1c26b20b3c4a2ea6061fe15c5ffbbc
Patch2: opencryptoki-3.12.1-gcc10.patch
# Use --no-undefined to debug missing symbols # Use --no-undefined to debug missing symbols
#Patch100: %%{name}-3.2-no-undefined.patch #Patch100: %%{name}-3.2-no-undefined.patch
@ -309,6 +311,9 @@ fi
%changelog %changelog
* Mon Feb 03 2020 Dan Horák <dan[at]danny.cz> - 3.12.1-3
- fix build with gcc 10
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.1-2 * Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild