summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2026-03-26 03:15:03 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2026-04-03 03:56:12 +0300
commit117c3c4df23d973357a523f6dce1f63d28bbf8aa (patch)
tree8c468be405f902d96c3a3c2110c4f783820de661
parenteba92a2d7e51601adae3d3b37df2e5a8a3c0de5b (diff)
downloadlinux-117c3c4df23d973357a523f6dce1f63d28bbf8aa.tar.xz
net: tipc: Use crypto_stdrng_get_bytes()
Replace the sequence of crypto_get_default_rng(), crypto_rng_get_bytes(), and crypto_put_default_rng() with the equivalent helper function crypto_stdrng_get_bytes(). Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--net/tipc/crypto.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
index d3046a39ff72..6d3b6b89b1d1 100644
--- a/net/tipc/crypto.c
+++ b/net/tipc/crypto.c
@@ -367,17 +367,8 @@ int tipc_aead_key_validate(struct tipc_aead_key *ukey, struct genl_info *info)
*/
static int tipc_aead_key_generate(struct tipc_aead_key *skey)
{
- int rc = 0;
-
- /* Fill the key's content with a random value via RNG cipher */
- rc = crypto_get_default_rng();
- if (likely(!rc)) {
- rc = crypto_rng_get_bytes(crypto_default_rng, skey->key,
- skey->keylen);
- crypto_put_default_rng();
- }
-
- return rc;
+ /* Fill the key's content with a random value via stdrng */
+ return crypto_stdrng_get_bytes(skey->key, skey->keylen);
}
static struct tipc_aead *tipc_aead_get(struct tipc_aead __rcu *aead)