aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libcrc32c.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrc32c.c')
-rw-r--r--lib/libcrc32c.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c
index b3131f5cf8a2..6a08ce7d6adc 100644
--- a/lib/libcrc32c.c
+++ b/lib/libcrc32c.c
@@ -41,20 +41,18 @@ static struct crypto_shash *tfm;
41 41
42u32 crc32c(u32 crc, const void *address, unsigned int length) 42u32 crc32c(u32 crc, const void *address, unsigned int length)
43{ 43{
44 struct { 44 SHASH_DESC_ON_STACK(shash, tfm);
45 struct shash_desc shash; 45 u32 *ctx = (u32 *)shash_desc_ctx(shash);
46 char ctx[crypto_shash_descsize(tfm)];
47 } desc;
48 int err; 46 int err;
49 47
50 desc.shash.tfm = tfm; 48 shash->tfm = tfm;
51 desc.shash.flags = 0; 49 shash->flags = 0;
52 *(u32 *)desc.ctx = crc; 50 *ctx = crc;
53 51
54 err = crypto_shash_update(&desc.shash, address, length); 52 err = crypto_shash_update(shash, address, length);
55 BUG_ON(err); 53 BUG_ON(err);
56 54
57 return *(u32 *)desc.ctx; 55 return *ctx;
58} 56}
59 57
60EXPORT_SYMBOL(crc32c); 58EXPORT_SYMBOL(crc32c);