summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Shtylyov <s.shtylyov@omp.ru>2025-12-17 23:21:45 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2025-12-29 08:48:35 +0800
commitc904e459cf73bd379500637b4090a2939d69a85f (patch)
treee836ccdd6de6c6018ba72b4aaf6d606a701eb2c3
parent6acd394367ab145b1cc26e66aac3bb40b968e893 (diff)
crypto: drbg - make drbg_get_random_bytes() return *void*
Now that drbg_get_random_bytes() always returns 0, checking its result at the call sites stopped to make sense -- make this function return *void* instead of *int*... Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/drbg.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 72d1d130dcc8..9a2af599ead1 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -842,15 +842,13 @@ static inline int __drbg_seed(struct drbg_state *drbg, struct list_head *seed,
return ret;
}
-static inline int drbg_get_random_bytes(struct drbg_state *drbg,
- unsigned char *entropy,
- unsigned int entropylen)
+static inline void drbg_get_random_bytes(struct drbg_state *drbg,
+ unsigned char *entropy,
+ unsigned int entropylen)
{
do
get_random_bytes(entropy, entropylen);
while (!drbg_fips_continuous_test(drbg, entropy));
-
- return 0;
}
static int drbg_seed_from_random(struct drbg_state *drbg)
@@ -867,13 +865,10 @@ static int drbg_seed_from_random(struct drbg_state *drbg)
drbg_string_fill(&data, entropy, entropylen);
list_add_tail(&data.list, &seedlist);
- ret = drbg_get_random_bytes(drbg, entropy, entropylen);
- if (ret)
- goto out;
+ drbg_get_random_bytes(drbg, entropy, entropylen);
ret = __drbg_seed(drbg, &seedlist, true, DRBG_SEED_STATE_FULL);
-out:
memzero_explicit(entropy, entropylen);
return ret;
}
@@ -948,9 +943,7 @@ static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers,
if (!rng_is_initialized())
new_seed_state = DRBG_SEED_STATE_PARTIAL;
- ret = drbg_get_random_bytes(drbg, entropy, entropylen);
- if (ret)
- goto out;
+ drbg_get_random_bytes(drbg, entropy, entropylen);
if (!drbg->jent) {
drbg_string_fill(&data1, entropy, entropylen);