From 57225e6797885e31302e76fc5926c0bedd7e5ad4 Mon Sep 17 00:00:00 2001 From: Stephan Mueller Date: Tue, 9 Jun 2015 21:55:38 +0800 Subject: crypto: drbg - Use callback API for random readiness The get_blocking_random_bytes API is broken because the wait can be arbitrarily long (potentially forever) so there is no safe way of calling it from within the kernel. This patch replaces it with the new callback API which does not have this problem. The patch also removes the entropy buffer registered with the DRBG handle in favor of stack variables to hold the seed data. Signed-off-by: Stephan Mueller Signed-off-by: Herbert Xu --- include/crypto/drbg.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/crypto') diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h index c3f208dc83ee..fad6450b99f9 100644 --- a/include/crypto/drbg.h +++ b/include/crypto/drbg.h @@ -121,12 +121,11 @@ struct drbg_state { unsigned char *prev; /* FIPS 140-2 continuous test value */ #endif struct work_struct seed_work; /* asynchronous seeding support */ - u8 *seed_buf; /* buffer holding the seed */ - size_t seed_buf_len; struct crypto_rng *jent; const struct drbg_state_ops *d_ops; const struct drbg_core *core; struct drbg_string test_data; + struct random_ready_callback random_ready; }; static inline __u8 drbg_statelen(struct drbg_state *drbg) -- cgit v1.2.3