From 63559a378edd18f00978f68eeb77fbd0f088a804 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Sat, 19 Jul 2014 00:08:43 +0000 Subject: Change _rs_allocate so it can combine the two regions (rs and rsx) into one if a system has an awesome getentropy(). In that case it is valid to totally throw away the rsx state in the child. If the getentropy() is not very good and has a lazy reseed operation, this combining is a bad idea, and the reseed should probably continue to use the "something old, something new" mix. _rs_allocate() can accomodate either method, but not on the fly. ok matthew --- src/lib/libcrypto/crypto/arc4random_win.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/lib/libcrypto/crypto/arc4random_win.h') diff --git a/src/lib/libcrypto/crypto/arc4random_win.h b/src/lib/libcrypto/crypto/arc4random_win.h index 7d01d42be5..1fc228d109 100644 --- a/src/lib/libcrypto/crypto/arc4random_win.h +++ b/src/lib/libcrypto/crypto/arc4random_win.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_win.h,v 1.1 2014/07/18 02:05:55 deraadt Exp $ */ +/* $OpenBSD: arc4random_win.h,v 1.2 2014/07/19 00:08:43 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres @@ -22,10 +22,19 @@ * Stub functions for portability. */ -static inline void * -_rs_allocate(size_t len) +static inline int +_rs_allocate(struct _rs **rsp, struct _rsx **rsxp) { - return calloc(1, sizeof(*rs)); + *rsp = calloc(1, sizeof(**rsp)); + if (*rsp == NULL) + return (-1); + + *rsxp = calloc(1, sizeof(**rsxp)); + if (*rsxp == NULL) { + free(*rsp); + return (-1); + } + return (0); } static inline void @@ -37,9 +46,3 @@ static inline void _rs_forkdetect(void) { } - -static inline void -_rs_forkdetectsetup(struct _rs *rs, size_t len) -{ -} - -- cgit v1.2.3-55-g6feb