]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX: Avoid building rand-fortuna-kernel.o
authorAndrew Deason <adeason@sinenomine.net>
Mon, 2 Mar 2020 22:17:55 +0000 (16:17 -0600)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 18 Mar 2020 19:16:40 +0000 (15:16 -0400)
Currently, we build rand-fortuna-kernel.o for libafs on all platforms,
even though we only use the fortuna RNG on AIX, DragonFlyBSD, HP-UX,
and Irix. Everywhere else, our RAND_bytes() in
src/crypto/hcrypto/kernel/rand.c uses osi_readRandom() instead of
going through heimdal.

Building rand-fortuna.c causes occasional build headaches for the
kernel on Linux (see cc7f942, "LINUX: Disable kernel fortuna large
frame errors"). The most recent instance of this is that Linux 5.6
removes the definition for struct timeval, which is referenced in
rand-fortuna.c.

The Linux kernel is constantly changing, and so trying to keep
rand-fortuna.c building on Linux seems like a waste of ongoing effort.
So, just stop building rand-fortuna-kernel.o on Linux. The original
intent of building this file on all platforms was to avoid bitrot, so
still keep building rand-fortuna-kernel.o on all other platforms even
when it's not used; just avoid it on Linux specifically, the platform
that requires the most effort.

To accomplish this, move rand-fortuna-kernel.o from AFSAOBJS to
AFS_OS_OBJS, and remove it from the Linux-only AFSPAGOBJS.

[1.8.x: The 1.8 branch does not contain the commits that introduced
-Wno-error=frame-larger-than= (cc7f942a and 54150f38), so we can skip
removing the references to -Wno-error=frame-larger-than=.]

Reviewed-on: https://gerrit.openafs.org/14084
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit b8088b49dec23da19406fcb014e7100695dc8322)

Change-Id: Iad0d1af5ffd79c576ddbc253b0037b9772187350
Reviewed-on: https://gerrit.openafs.org/14094
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
12 files changed:
src/crypto/hcrypto/kernel/rand.c
src/libafs/Makefile.common.in
src/libafs/MakefileProto.AIX.in
src/libafs/MakefileProto.DARWIN.in
src/libafs/MakefileProto.DFBSD.in
src/libafs/MakefileProto.FBSD.in
src/libafs/MakefileProto.HPUX.in
src/libafs/MakefileProto.IRIX.in
src/libafs/MakefileProto.LINUX.in
src/libafs/MakefileProto.NBSD.in
src/libafs/MakefileProto.OBSD.in
src/libafs/MakefileProto.SOLARIS.in

index 81064863bca2b9b6abc8124498277fb21111e35d..72cc41877c04def8050e9e6497a0580d758b28a8 100644 (file)
  */
 afs_kmutex_t hckernel_mutex;
 
+/*
+ * For these platforms, we use the fortuna RNG from heimdal (seeded from afsd
+ * userspace on startup). Otherwise, we rely on osi_readRandom() as the source
+ * of random data.
+ */
+#if defined(AFS_AIX_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI_ENV)
+# define USE_FORTUNA
+#endif
+
 /* Called from osi_Init(); will only run once. */
 void
 init_hckernel_mutex(void)
@@ -25,8 +34,10 @@ init_hckernel_mutex(void)
 void
 RAND_seed(const void *indata, size_t size)
 {
+#ifdef USE_FORTUNA
     const RAND_METHOD *m = RAND_fortuna_method();
     m->seed(indata, size);
+#endif
 }
 
 int
@@ -34,7 +45,7 @@ RAND_bytes(void *outdata, size_t size)
 {
     if (size == 0)
        return 0;
-#if defined(AFS_AIX_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI_ENV)
+#ifdef USE_FORTUNA
     const RAND_METHOD *m = RAND_fortuna_method();
     return m->bytes(outdata, size);
 #else
index 0b8505a0f559509e0cbfdae5e27aff52e3471443..b4e00166a5a73d6e466027778a3f12abcb969f2c 100644 (file)
@@ -72,7 +72,6 @@ depsrcs:
 
 AFSAOBJS = \
        sha256-kernel.o \
-       rand-fortuna-kernel.o \
        rand-timer-kernel.o \
        afs_atomlist.o \
        afs_lhash.o \
@@ -217,7 +216,6 @@ AFSNONFSOBJS = \
 # init daemons call pioctl
 AFSPAGOBJS = \
        sha256-kernel.o \
-       rand-fortuna-kernel.o \
        rand-timer-kernel.o \
        md5.o           \
        evp.o           \
index 5c2b7467c1e5fc813687b384df3e89559fc43bf0..697ba7aa9b80c03d7045a9238459945607858584 100644 (file)
@@ -24,7 +24,8 @@ AFS_OS_OBJS = \
        osi_sleep.o \
        osi_timeout.o \
        osi_vcache.o \
-       osi_vm.o
+       osi_vm.o \
+       rand-fortuna-kernel.o
 
 AFSNOIAUTHOBJS = \
        afs_call.o \
index 0592913c17ce6657be6c1b57981e98b454d84fb1..fc0945480aa6944b397b219a41e42a9df70c19d8 100644 (file)
@@ -28,8 +28,8 @@ AFS_OS_OBJS = \
        osi_vcache.o \
        osi_vm.o \
        osi_vnodeops.o \
-       osi_module.o
-
+       osi_module.o \
+       rand-fortuna-kernel.o
 
 #AFS_OS_NFSOBJS = osi_vfsops_nfs.o
 
index 41e1b51406e784aab2c8d5744d37c6802ad8b323..9c06a50a7485041d34d75ec3466dce2c65038b4f 100644 (file)
@@ -20,7 +20,8 @@ AFS_OS_OBJS = \
        osi_vcache.o \
        osi_vm.o \
        osi_vnodeops.o \
-       osi_module.o 
+       osi_module.o \
+       rand-fortuna-kernel.o
 
 #AFS_OS_NFSOBJS = \
 #      osi_vfsops_nfs.o
index 4c3c0cd8e50e648e38b388aecdf64cf82e6d9687..e0616afadc507b8d91e3ad702f611326453e1f5d 100644 (file)
@@ -31,6 +31,9 @@ SRCS+= \
        osi_vnodeops.c \
        osi_module.c
 
+AFS_OS_OBJS = \
+       rand-fortuna-kernel.o
+
 #AFS_OS_NFSOBJS = \
 #      osi_vfsops_nfs.o
 
index 929884e2391d9d5ae515de7a5abcc60775498bc2..0925a3f964b7385893a451762a49bd717eceebcd 100644 (file)
@@ -24,7 +24,8 @@ AFS_OS_OBJS = \
        osi_sleep.o \
        osi_vcache.o \
        osi_vnodeops.o \
-       osi_vm.o
+       osi_vm.o \
+       rand-fortuna-kernel.o
 
 AFS_OS_NFSOBJS = \
 <ia64_hpux1123 hp_ux1123>
index 310db13fb36e2af7647021c36f9266e396436b17..4142b413ff503882302e4707a42c0b71699f5d22 100644 (file)
@@ -26,7 +26,8 @@ AFS_OS_OBJS = \
        osi_sleep.o \
        osi_vcache.o \
        osi_vm.o \
-       osi_vnodeops.o
+       osi_vnodeops.o \
+       rand-fortuna-kernel.o
 
 AFS_OS_NFSOBJS = \
        osi_vfsops_nfs.o
index ed687f1ec66de51cd28939b72c6237d78f8517b4..d98fa05ad3daf8326f649f7d02e388ebea724081 100644 (file)
@@ -82,7 +82,6 @@ CFLAGS_evp.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
               -DHAVE_CONFIG_H
 CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_evp-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
-CFLAGS_rand-fortuna-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_rand-timer-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_rand-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_aes.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
index 892dea2e9b2e42cd76ee8f80b20af01386e92357..f1669339e055ecf54a9eaeff995f5749d6f956af 100644 (file)
@@ -24,7 +24,8 @@ AFS_OS_OBJS = \
        osi_sleep.o \
        osi_vcache.o \
        osi_vm.o \
-       osi_vnodeops.o
+       osi_vnodeops.o \
+       rand-fortuna-kernel.o
 
 AFS_OS_NFSOBJS = \
        osi_vfsops_nfs.o
index 3e3beaae74604d9cef69876f8eebe8ca2788f259..69871cc37005a5782f8da25298cc65f00aa21e71 100644 (file)
@@ -44,7 +44,8 @@ AFS_OS_OBJS = \
        osi_sleep.o \
        osi_vcache.o \
        osi_vm.o \
-       osi_vnodeops.o
+       osi_vnodeops.o \
+       rand-fortuna-kernel.o
 
 #AFS_OS_NFSOBJS = osi_vfsops_nfs.o
 
index 602fed5436646774a610f25258a843d679504f88..5d7e07037ae3601d60a3e8c63108a928ca8788f1 100644 (file)
@@ -26,7 +26,8 @@ AFS_OS_OBJS = \
        osi_sleep.o \
        osi_vcache.o \
        osi_vm.o \
-       osi_vnodeops.o
+       osi_vnodeops.o \
+       rand-fortuna-kernel.o
 
 AFS_OS_NFSOBJS = \
        osi_vfsops_nfs.o