summaryrefslogtreecommitdiff
path: root/drivers/char/random.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2025-05-05 11:18:23 -0700
committerHerbert Xu <herbert@gondor.apana.org.au>2025-05-12 13:32:53 +0800
commit607c92141cdec6e472d80de813f5251685b9ddc1 (patch)
treec5aba824a6119fac977fe93a76514544723bd70b /drivers/char/random.c
parent32c9541189eb31ba6b25e2ff28e42660394a62af (diff)
crypto: lib/chacha - add strongly-typed state zeroization
Now that the ChaCha state matrix is strongly-typed, add a helper function chacha_zeroize_state() which zeroizes it. Then convert all applicable callers to use it instead of direct memzero_explicit. No functional changes. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/random.c')
-rw-r--r--drivers/char/random.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 9f876ed2655b..5f22a08101f6 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -422,7 +422,7 @@ static void _get_random_bytes(void *buf, size_t len)
buf += CHACHA_BLOCK_SIZE;
}
- memzero_explicit(&chacha_state, sizeof(chacha_state));
+ chacha_zeroize_state(&chacha_state);
}
/*
@@ -485,7 +485,7 @@ static ssize_t get_random_bytes_user(struct iov_iter *iter)
memzero_explicit(block, sizeof(block));
out_zero_chacha:
- memzero_explicit(&chacha_state, sizeof(chacha_state));
+ chacha_zeroize_state(&chacha_state);
return ret ? ret : -EFAULT;
}