Skip to content

Commit f7aee87

Browse files
krzkherbertx
authored andcommitted
crypto: stm32_crc32 - Use existing define with polynomial
Do not define again the polynomial but use header with existing define. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent e37f2f9 commit f7aee87

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/crypto/stm32/stm32_crc32.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <linux/bitrev.h>
88
#include <linux/clk.h>
9+
#include <linux/crc32poly.h>
910
#include <linux/module.h>
1011
#include <linux/platform_device.h>
1112
#include <linux/pm_runtime.h>
@@ -29,10 +30,6 @@
2930
#define CRC_CR_REVERSE (BIT(7) | BIT(6) | BIT(5))
3031
#define CRC_INIT_DEFAULT 0xFFFFFFFF
3132

32-
/* Polynomial reversed */
33-
#define POLY_CRC32 0xEDB88320
34-
#define POLY_CRC32C 0x82F63B78
35-
3633
#define CRC_AUTOSUSPEND_DELAY 50
3734

3835
struct stm32_crc {
@@ -69,7 +66,7 @@ static int stm32_crc32_cra_init(struct crypto_tfm *tfm)
6966
struct stm32_crc_ctx *mctx = crypto_tfm_ctx(tfm);
7067

7168
mctx->key = CRC_INIT_DEFAULT;
72-
mctx->poly = POLY_CRC32;
69+
mctx->poly = CRC32_POLY_LE;
7370
return 0;
7471
}
7572

@@ -78,7 +75,7 @@ static int stm32_crc32c_cra_init(struct crypto_tfm *tfm)
7875
struct stm32_crc_ctx *mctx = crypto_tfm_ctx(tfm);
7976

8077
mctx->key = CRC_INIT_DEFAULT;
81-
mctx->poly = POLY_CRC32C;
78+
mctx->poly = CRC32C_POLY_LE;
8279
return 0;
8380
}
8481

@@ -187,7 +184,7 @@ static int stm32_crc_final(struct shash_desc *desc, u8 *out)
187184
struct stm32_crc_ctx *mctx = crypto_shash_ctx(desc->tfm);
188185

189186
/* Send computed CRC */
190-
put_unaligned_le32(mctx->poly == POLY_CRC32C ?
187+
put_unaligned_le32(mctx->poly == CRC32C_POLY_LE ?
191188
~ctx->partial : ctx->partial, out);
192189

193190
return 0;

0 commit comments

Comments
 (0)