diff options
| author | Eric Biggers <ebiggers@kernel.org> | 2026-04-20 09:33:46 +0300 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2026-05-07 11:09:59 +0300 |
| commit | ddc4dedb9ba3c8eecbc8c050fffd46d1b7e75c21 (patch) | |
| tree | d9873c4421300070bee77c16161a86e3a9148e1c /include | |
| parent | 39a31ad9e2a5ed7e9c9c6f711dca96c8c8f5f26b (diff) | |
| download | linux-ddc4dedb9ba3c8eecbc8c050fffd46d1b7e75c21.tar.xz | |
crypto: drbg - Fix misaligned writes in CTR_DRBG and HASH_DRBG
drbg_cpu_to_be32() is being used to do a plain write to a byte array,
which doesn't have any alignment guarantee. This can cause a misaligned
write. Replace it with the correct function, put_unaligned_be32().
Fixes: 72f3e00dd67e ("crypto: drbg - replace int2byte with cpu_to_be")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include')
| -rw-r--r-- | include/crypto/internal/drbg.h | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/include/crypto/internal/drbg.h b/include/crypto/internal/drbg.h index 371e52dcee6c..b4e5ef0be602 100644 --- a/include/crypto/internal/drbg.h +++ b/include/crypto/internal/drbg.h @@ -10,24 +10,6 @@ #define _INTERNAL_DRBG_H /* - * Convert an integer into a byte representation of this integer. - * The byte representation is big-endian - * - * @val value to be converted - * @buf buffer holding the converted integer -- caller must ensure that - * buffer size is at least 32 bit - */ -static inline void drbg_cpu_to_be32(__u32 val, unsigned char *buf) -{ - struct s { - __be32 conv; - }; - struct s *conversion = (struct s *)buf; - - conversion->conv = cpu_to_be32(val); -} - -/* * Concatenation Helper and string operation helper * * SP800-90A requires the concatenation of different data. To avoid copying |
