commit 7b7703dd7bb9f5552c337fdad170cbdfd0880be9 Author: CentOS Sources Date: Thu Apr 23 22:30:47 2020 +0000 import libica-3.6.1-2.el8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b8bcb65 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libica-3.6.1.tar.gz diff --git a/.libica.metadata b/.libica.metadata new file mode 100644 index 0000000..42a90e2 --- /dev/null +++ b/.libica.metadata @@ -0,0 +1 @@ +e4ed7750d1b296f1866275467fbbf9e368d579f5 SOURCES/libica-3.6.1.tar.gz diff --git a/SOURCES/libica-3.3.3-annotate.patch b/SOURCES/libica-3.3.3-annotate.patch new file mode 100644 index 0000000..b18f331 --- /dev/null +++ b/SOURCES/libica-3.3.3-annotate.patch @@ -0,0 +1,12 @@ +diff -up libica-3.3.3/src/Makefile.am.annotate libica-3.3.3/src/Makefile.am +--- libica-3.3.3/src/Makefile.am.annotate 2018-09-20 08:25:50.892538076 -0400 ++++ libica-3.3.3/src/Makefile.am 2018-09-20 08:26:14.162538076 -0400 +@@ -8,7 +8,7 @@ lib_LTLIBRARIES = libica.la + + libica_la_CFLAGS = ${AM_CFLAGS} -I${srcdir}/include -I${srcdir}/../include \ + -fvisibility=hidden -pthread +-libica_la_CCASFLAGS = ${AM_CFLAGS} ++libica_la_CCASFLAGS = ${AM_CFLAGS} -Wa,--generate-missing-build-notes=yes + libica_la_LIBADD = @LIBS@ -lrt -lcrypto + libica_la_LDFLAGS = -Wl,--version-script=${srcdir}/../libica.map \ + -version-number ${VERSION} diff --git a/SOURCES/libica-3.6.1-counter.patch b/SOURCES/libica-3.6.1-counter.patch new file mode 100644 index 0000000..53d5a37 --- /dev/null +++ b/SOURCES/libica-3.6.1-counter.patch @@ -0,0 +1,201 @@ +From 58c1073a585443146332c5a3b5536eb5e6c6493d Mon Sep 17 00:00:00 2001 +From: Joerg Schmidbauer +Date: Wed, 27 Nov 2019 15:54:29 +0100 +Subject: [PATCH] Fix icastats counter format + +icastats counters displayed negative numbers for counts +higher than 31 bits in size. Now using 64-bit unsigned values. + +Signed-off-by: Joerg Schmidbauer +--- + src/icastats.c | 18 +++++++++--------- + src/icastats_shared.c | 32 ++++++++++++++++---------------- + src/include/icastats.h | 6 +++--- + test/icastats_test.c | 10 +++++----- + 4 files changed, 33 insertions(+), 33 deletions(-) + +diff --git a/src/icastats.c b/src/icastats.c +index 3896ad1..fa1dcff 100644 +--- a/src/icastats.c ++++ b/src/icastats.c +@@ -10,7 +10,7 @@ + * Benedikt Klotz + * Ingo Tuchscherer + * +- * Copyright IBM Corp. 2009, 2010, 2011, 2014 ++ * Copyright IBM Corp. 2009-2019 + */ + + #include +@@ -24,7 +24,7 @@ + #include "icastats.h" + + #define CMD_NAME "icastats" +-#define COPYRIGHT "Copyright IBM Corp. 2009, 2010, 2011, 2014." ++#define COPYRIGHT "Copyright IBM Corp. 2009-2019" + + void print_version(void) + { +@@ -69,24 +69,24 @@ const char *const STATS_DESC[ICA_NUM_STATS] = { + + + +-#define CELL_SIZE 10 ++#define CELL_SIZE 12 + void print_stats(stats_entry_t *stats) + { +- printf(" function | hardware | software\n"); +- printf("----------------+--------------------------+-------------------------\n"); +- printf(" | ENC CRYPT DEC | ENC CRYPT DEC \n"); +- printf("----------------+--------------------------+-------------------------\n"); ++ printf(" function | hardware | software\n"); ++ printf("----------------+------------------------------+-----------------------------\n"); ++ printf(" | ENC CRYPT DEC | ENC CRYPT DEC \n"); ++ printf("----------------+------------------------------+-----------------------------\n"); + unsigned int i; + for (i = 0; i < ICA_NUM_STATS; ++i){ + if(i<=ICA_STATS_RSA_CRT){ +- printf(" %14s | %*d | %*d\n", ++ printf(" %14s | %*lu | %*lu\n", + STATS_DESC[i], + CELL_SIZE, + stats[i].enc.hw, + CELL_SIZE, + stats[i].enc.sw); + } else{ +- printf(" %14s |%*d %*d |%*d %*d\n", ++ printf(" %14s |%*lu %*lu |%*lu %*lu\n", + STATS_DESC[i], + CELL_SIZE, + stats[i].enc.hw, +diff --git a/src/icastats_shared.c b/src/icastats_shared.c +index ecd9c59..f3b24d9 100644 +--- a/src/icastats_shared.c ++++ b/src/icastats_shared.c +@@ -34,18 +34,18 @@ static stats_entry_t *stats = NULL; + volatile int stats_shm_handle = NOT_INITIALIZED; + + +-static inline void atomic_add(int *x, int i) ++static inline void atomic_add(uint64_t *x, uint64_t i) + { +- int old; +- int new; +- asm volatile (" l %0,%2\n" +- "0: lr %1,%0\n" +- " ar %1,%3\n" +- " cs %0,%1,%2\n" +- " jl 0b" +- :"=&d" (old), "=&d"(new), "=Q"(*x) +- :"d"(i), "Q"(*x) +- :"cc", "memory"); ++ uint64_t old; ++ uint64_t new; ++ asm volatile (" lg %0,%2\n" ++ "0: lgr %1,%0\n" ++ " agr %1,%3\n" ++ " csg %0,%1,%2\n" ++ " jl 0b" ++ :"=&d" (old), "=&d"(new), "=Q"(*x) ++ :"d"(i), "Q"(*x) ++ :"cc", "memory"); + } + + +@@ -125,7 +125,7 @@ void stats_munmap(int unlink) + * @direction - valid values are ENCRYPT and DECRYPT + */ + +-uint32_t stats_query(stats_fields_t field, int hardware, int direction) ++uint64_t stats_query(stats_fields_t field, int hardware, int direction) + { + if (stats == NULL) + return 0; +@@ -277,14 +277,14 @@ void stats_increment(stats_fields_t field, int hardware, int direction) + + if(direction == ENCRYPT) + if (hardware == ALGO_HW) +- atomic_add((int *)&stats[field].enc.hw, 1); ++ atomic_add(&stats[field].enc.hw, 1); + else +- atomic_add((int *)&stats[field].enc.sw, 1); ++ atomic_add(&stats[field].enc.sw, 1); + else + if (hardware == ALGO_HW) +- atomic_add((int *)&stats[field].dec.hw, 1); ++ atomic_add(&stats[field].dec.hw, 1); + else +- atomic_add((int *)&stats[field].dec.sw, 1); ++ atomic_add(&stats[field].dec.sw, 1); + } + #endif + +diff --git a/src/include/icastats.h b/src/include/icastats.h +index 53af8ba..f373263 100644 +--- a/src/include/icastats.h ++++ b/src/include/icastats.h +@@ -18,8 +18,8 @@ + + + typedef struct crypt_opts{ +- uint32_t hw; +- uint32_t sw; ++ uint64_t hw; ++ uint64_t sw; + } crypt_opts_t; + + typedef struct statis_entry { +@@ -159,7 +159,7 @@ typedef enum stats_fields { + + int stats_mmap(int user); + void stats_munmap(int unlink); +-uint32_t stats_query(stats_fields_t field, int hardware, int direction); ++uint64_t stats_query(stats_fields_t field, int hardware, int direction); + void get_stats_data(stats_entry_t *entries); + void stats_increment(stats_fields_t field, int hardware, int direction); + int get_stats_sum(stats_entry_t *sum); +diff --git a/test/icastats_test.c b/test/icastats_test.c +index 4527d48..c7ac447 100644 +--- a/test/icastats_test.c ++++ b/test/icastats_test.c +@@ -239,7 +239,7 @@ void check_icastats(int algo_id, char *stat) + char cmd[256], line[256], *p; + FILE *f; + int i, hw, rc=-1, counters=0; +- int hwcounter1=0, hwcounter2=0, swcounter1=0, swcounter2=0; ++ uint64_t hwcounter1=0, hwcounter2=0, swcounter1=0, swcounter2=0; + + hw = check_hw(algo_id); + if (hw < 0) return; /* unknown algo_id */ +@@ -267,13 +267,13 @@ void check_icastats(int algo_id, char *stat) + if (!p) goto out; /* no | in the output. Wrong algo string ? */ + p++; + while (isspace(*p)) p++; +- hwcounter1 = atoi(p); /* parse 1st hw counter value */ ++ hwcounter1 = atol(p); /* parse 1st hw counter value */ + counters++; + while (*p && !isspace(*p)) p++; /* parse over counter value */ + while (isspace(*p)) p++; + /* now either a | or another counter value follows */ + if (isdigit(*p)) { +- hwcounter2 = atoi(p); /* parse 2nd hw counter value */ ++ hwcounter2 = atol(p); /* parse 2nd hw counter value */ + counters++; + while (*p && !isspace(*p)) p++; /* parse over counter value */ + while (isspace(*p)) p++; +@@ -285,13 +285,13 @@ void check_icastats(int algo_id, char *stat) + } + p++; + while (isspace(*p)) p++; +- swcounter1 = atoi(p); /* parse 1st sw counter value */ ++ swcounter1 = atol(p); /* parse 1st sw counter value */ + counters++; + while (*p && !isspace(*p)) p++; /* parse over counter value */ + while (isspace(*p)) p++; + /* maybe another counter value follows */ + if (isdigit(*p)) { +- swcounter2 = atoi(p); /* parse 2nd sw counter value */ ++ swcounter2 = atol(p); /* parse 2nd sw counter value */ + counters++; + } + diff --git a/SPECS/libica.spec b/SPECS/libica.spec new file mode 100644 index 0000000..3834c1b --- /dev/null +++ b/SPECS/libica.spec @@ -0,0 +1,267 @@ +Summary: Library for accessing ICA hardware crypto on IBM z Systems +Name: libica +Version: 3.6.1 +Release: 2%{?dist} +License: CPL +Group: System Environment/Libraries +URL: https://github.com/opencryptoki/ +Source0: https://github.com/opencryptoki/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz +# annotate assembler source +# https://bugzilla.redhat.com/show_bug.cgi?id=1630582 +Patch1: %{name}-3.3.3-annotate.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1789052 +# https://github.com/opencryptoki/libica/commit/58c1073a585443146332c5a3b5536eb5e6c6493d +Patch2: %{name}-3.6.1-counter.patch +BuildRequires: gcc +BuildRequires: openssl-devel +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +ExclusiveArch: s390 s390x + +%description +A library of functions and utilities for accessing ICA hardware crypto on +IBM z Systems. + + +%package devel +Summary: Development tools for programs to access ICA hardware crypto on IBM z Systems +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: openssl-devel + +%description devel +The libica-devel package contains the header files and static +libraries necessary for developing programs accessing ICA hardware crypto on +IBM z Systems. + + +%prep +%autosetup -p1 + +sh ./bootstrap.sh + + +%build +%configure --disable-static --enable-fips +make %{?_smp_mflags} + + +%install +make install DESTDIR=$RPM_BUILD_ROOT +rm $RPM_BUILD_ROOT%{_libdir}/libica.la + + +%check +# mock doesn't provide the device, so check here +# https://github.com/rpm-software-management/mock/issues/33 +if [ -c /dev/hwrng -o -c /dev/prandom ]; then + make check +fi + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%doc AUTHORS LICENSE ChangeLog +%exclude %{_pkgdocdir}/{INSTALL,README.md} +%{_bindir}/icainfo +%{_bindir}/icastats +%{_libdir}/libica.so.* +%{_mandir}/man1/icainfo.1* +%{_mandir}/man1/icastats.1* + +%files devel +%{_includedir}/* +%{_libdir}/libica.so + + +%changelog +* Thu Jan 09 2020 Dan Horák - 3.6.1-2 +- fix overflow in icastats counters (#1789052) +- Resolves: #1789052 + +* Tue Nov 26 2019 Dan Horák - 3.6.1-1 +- updated to 3.6.1 (#1772402) +- Resolves: #1772402 + +* Tue Nov 05 2019 Dan Horák - 3.6.0-1 +- updated to 3.6.0 (#1726244) +- Resolves: #1726244, #1723862 + +* Wed Apr 24 2019 Dan Horák - 3.5.0-1 +- updated to 3.5.0 (#1666621) +- Resolves: #1666621, #1659428, #1673054 + +* Fri Sep 21 2018 Dan Horák - 3.3.3-4 +- annotate assembler file (#1630582) + +* Fri Jul 13 2018 Fedora Release Engineering - 3.3.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Jun 13 2018 Dan Horák - 3.3.3-2 +- fix executable stack in assembler code + +* Tue Jun 12 2018 Dan Horák - 3.3.3-1 +- updated to 3.3.3 + +* Tue Apr 17 2018 Dan Horák - 3.3.2-1 +- updated to 3.3.2 + +* Wed Feb 07 2018 Fedora Release Engineering - 3.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Mon Sep 25 2017 Dan Horák - 3.2.0-1 +- updated to 3.2.0 + +* Mon Sep 11 2017 Dan Horák - 3.1.1-1 +- updated to 3.1.1 + +* Thu Aug 03 2017 Fedora Release Engineering - 3.0.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 3.0.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Tue Apr 18 2017 Dan Horák - 3.0.2-3 +- update BR + +* Fri Feb 10 2017 Fedora Release Engineering - 3.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Jan 18 2017 Dan Horák - 3.0.2-1 +- updated to 3.0.2 + +* Fri Jan 13 2017 Dan Horák - 3.0.1-2 +- check for /dev/prandom before running the test-suite + +* Fri Jan 13 2017 Dan Horák - 3.0.1-1 +- updated to 3.0.1 + +* Tue Apr 12 2016 Dan Horák - 2.6.2-1 +- updated to 2.6.2 + +* Thu Mar 17 2016 Dan Horák - 2.6.1-1 +- updated to 2.6.1 + +* Thu Feb 04 2016 Fedora Release Engineering - 2.4.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 2.4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Sep 01 2014 Dan Horák - 2.4.2-1 +- updated to 2.4.2 + +* Wed Jun 11 2014 Dan Horák - 2.3.0-5 +- fix build with recent kernels + +* Sat Jun 07 2014 Fedora Release Engineering - 2.3.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri Mar 14 2014 Dan Horák - 2.3.0-3 +- add post release fix (#1066014) + +* Sat Aug 03 2013 Fedora Release Engineering - 2.3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Fri May 03 2013 Dan Horák - 2.3.0-1 +- updated to 2.3.0 + +* Thu Feb 14 2013 Fedora Release Engineering - 2.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Fri Aug 17 2012 Dan Horák - 2.2.0-1 +- updated to 2.2.0 + +* Thu Jul 19 2012 Fedora Release Engineering - 2.1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jan 16 2012 Dan Horák - 2.1.1-1 +- updated to 2.1.1 + +* Fri Jan 13 2012 Fedora Release Engineering - 2.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Jul 07 2011 Dan Horák - 2.1.0-1 +- updated to 2.1.0 with soname set back to 2.0 + +* Mon Apr 11 2011 Dan Horák - 2.0.6-1 +- updated to 2.0.6 + +* Tue Feb 08 2011 Fedora Release Engineering - 2.0.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Jan 12 2011 Dan Horák - 2.0.4-1 +- Do not use sigill to wrap all HW instructions (#665401) +- updated to 2.0.4 + +* Tue Nov 9 2010 Dan Horák - 2.0.3-3 +- Fix the return value of old_api_sha_test() in libica_sha1_test (#624005) +- Use the right buffer length when operating in 32-bit mode (#640035) +- Resolves: #624005, #640035 + +* Fri May 21 2010 Dan Horák - 2.0.3-2 +- rebuilt with -fno-strict-aliasing (#593779) +- Resolves: #593779 + +* Thu Apr 22 2010 Dan Horák - 2.0.3-1 +- updated to 2.0.3 (#582607) +- Resolves: #582607 + +* Mon Apr 12 2010 Dan Horák - 2.0.2-3 +- add SIGILL handler for add_entropy (#581520) +- Resolves: #581520 + +* Tue Feb 16 2010 Dan Horák - 2.0.2-2 +- dropped the utils sub-package +- Related: #543948 + +* Tue Dec 08 2009 Dennis Gregorovic - 2.0.2-1.1 +- Rebuilt for RHEL 6 + +* Mon Aug 17 2009 Dan Horák - 2.0.2-1 +- update to 2.0.2 + +* Fri Jul 24 2009 Fedora Release Engineering - 2.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Apr 1 2009 Dan Horák - 2.0.1-1 +- update to 2.0.1 + +* Mon Mar 23 2009 Dan Horák - 2.0-1 +- update to 2.0 +- spec file cleanup before submitting to Fedora + +* Sun Sep 14 2008 Phil Knirsch - 1.3.7-8.el5 +- Added the icainfo tool to libica (#439484) + +* Tue Apr 01 2008 Phil Knirsch - 1.3.7-7.el5 +- Fixed build of libica with latest AES & SHA feature (#439390) + +* Tue Jan 15 2008 Phil Knirsch - 1.3.7-6.el5 +- Added Software Support for CP Assist Instructions AES & SHA (#318971) + +* Thu Nov 23 2006 Phil Knirsch - 1.3.7-5.el5 +- Fixed requires bug where devel packages would get wrong arch lib (#215908) + +* Fri Oct 13 2006 Phil Knirsch - 1.3.7-4 +- Fixed bug where libica fails to initialize when no crypto hardware is + available (#210504) +- Only build libica for s390(x), really only needed there. + +* Fri Sep 08 2006 Phil Knirsch - 1.3.7-3 +- Build for other archs as well due to openCryptoki requirement (#184631) + +* Fri Jul 14 2006 Tim Powers - 1.3.7-2 +- rebuild + +* Tue Jun 13 2006 Phil Knirsch - 1.3.7-1 +- Update to libica-1.3.7 final +- Fixed build on latest devel tree + +* Tue Apr 04 2006 Phil Knirsch - 1.3.6-rc3-1 +- Initial package.