Fix the t-secmem on PPC64

This commit is contained in:
Tomas Mraz 2017-08-16 15:15:51 +02:00
parent 64437a1a3c
commit 6c13b08816
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,34 @@
diff -up libgcrypt-1.8.0/tests/t-secmem.c.build libgcrypt-1.8.0/tests/t-secmem.c
--- libgcrypt-1.8.0/tests/t-secmem.c.build 2017-01-18 15:24:25.000000000 +0100
+++ libgcrypt-1.8.0/tests/t-secmem.c 2017-08-16 15:12:48.948224849 +0200
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <unistd.h>
#define PGM "t-secmem"
@@ -37,17 +38,21 @@ test_secmem (void)
{
void *a[28];
void *b;
+ long oversize;
int i;
memset (a, 0, sizeof a);
+ oversize = sysconf (_SC_PAGESIZE);
+ oversize = oversize <= 16384 ? 2048 : oversize - (16384 - 2048);
+
/* Allocating 28*512=14k should work in the default 16k pool even
* with extrem alignment requirements. */
for (i=0; i < DIM(a); i++)
a[i] = gcry_xmalloc_secure (512);
/* Allocating another 2k should fail for the default 16k pool. */
- b = gcry_malloc_secure (2048);
+ b = gcry_malloc_secure (oversize);
if (b)
fail ("allocation did not fail as expected\n");

View File

@ -33,6 +33,8 @@ Patch14: libgcrypt-1.7.3-ecc-test-fix.patch
Patch18: libgcrypt-1.6.2-fips-ctor.patch
# Block some operations if in FIPS non-operational state
Patch22: libgcrypt-1.7.3-fips-reqs.patch
# Fix the t-secmem on PPC64
Patch23: libgcrypt-1.8.0-build.patch
%define gcrylibdir %{_libdir}
@ -76,7 +78,7 @@ applications using libgcrypt.
%patch14 -p1 -b .eccfix
%patch18 -p1 -b .fips-ctor
%patch22 -p1 -b .fips-reqs
#%patch23 -p1 -b .aliasing
%patch23 -p1 -b .build
cp %{SOURCE4} cipher/
cp %{SOURCE5} %{SOURCE6} tests/