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>
*/
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)
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
{
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
AFSAOBJS = \
sha256-kernel.o \
- rand-fortuna-kernel.o \
rand-timer-kernel.o \
afs_atomlist.o \
afs_lhash.o \
# init daemons call pioctl
AFSPAGOBJS = \
sha256-kernel.o \
- rand-fortuna-kernel.o \
rand-timer-kernel.o \
md5.o \
evp.o \
osi_sleep.o \
osi_timeout.o \
osi_vcache.o \
- osi_vm.o
+ osi_vm.o \
+ rand-fortuna-kernel.o
AFSNOIAUTHOBJS = \
afs_call.o \
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
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
osi_vnodeops.c \
osi_module.c
+AFS_OS_OBJS = \
+ rand-fortuna-kernel.o
+
#AFS_OS_NFSOBJS = \
# osi_vfsops_nfs.o
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>
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
-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
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
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
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