-/* $OpenBSD: rnd.c,v 1.163 2014/10/24 20:02:07 tedu Exp $ */
+/* $OpenBSD: rnd.c,v 1.164 2014/12/18 16:27:30 deraadt Exp $ */
/*
* Copyright (c) 2011 Theo de Raadt.
static size_t rs_have; /* valid bytes at end of rs_buf */
static size_t rs_count; /* bytes till reseed */
+void
+suspend_randomness(void)
+{
+ struct timespec ts;
+
+ getnanotime(&ts);
+ add_true_randomness(ts.tv_sec);
+ add_true_randomness(ts.tv_nsec);
+
+ dequeue_randomness(NULL);
+ rs_count = 0;
+ arc4random_buf(entropy_pool, sizeof(entropy_pool));
+}
+
+void
+resume_randomness(void)
+{
+ struct timespec ts;
+
+ getnanotime(&ts);
+ add_true_randomness(ts.tv_sec);
+ add_true_randomness(ts.tv_nsec);
+
+ dequeue_randomness(NULL);
+ rs_count = 0;
+}
+
static inline void _rs_rekey(u_char *dat, size_t datlen);
static inline void
-/* $OpenBSD: rndvar.h,v 1.34 2014/11/18 02:37:30 tedu Exp $ */
+/* $OpenBSD: rndvar.h,v 1.35 2014/12/18 16:27:30 deraadt Exp $ */
/*
* Copyright (c) 1996,2000 Michael Shalayeff.
void random_start(void);
void enqueue_randomness(int, int);
+void suspend_randomness(void);
+void resume_randomness(void);
#endif /* _KERNEL */