Commit f7aee878 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Herbert Xu

crypto: stm32_crc32 - Use existing define with polynomial

Do not define again the polynomial but use header with existing define.
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e37f2f93
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/bitrev.h> #include <linux/bitrev.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/crc32poly.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
...@@ -29,10 +30,6 @@ ...@@ -29,10 +30,6 @@
#define CRC_CR_REVERSE (BIT(7) | BIT(6) | BIT(5)) #define CRC_CR_REVERSE (BIT(7) | BIT(6) | BIT(5))
#define CRC_INIT_DEFAULT 0xFFFFFFFF #define CRC_INIT_DEFAULT 0xFFFFFFFF
/* Polynomial reversed */
#define POLY_CRC32 0xEDB88320
#define POLY_CRC32C 0x82F63B78
#define CRC_AUTOSUSPEND_DELAY 50 #define CRC_AUTOSUSPEND_DELAY 50
struct stm32_crc { struct stm32_crc {
...@@ -69,7 +66,7 @@ static int stm32_crc32_cra_init(struct crypto_tfm *tfm) ...@@ -69,7 +66,7 @@ static int stm32_crc32_cra_init(struct crypto_tfm *tfm)
struct stm32_crc_ctx *mctx = crypto_tfm_ctx(tfm); struct stm32_crc_ctx *mctx = crypto_tfm_ctx(tfm);
mctx->key = CRC_INIT_DEFAULT; mctx->key = CRC_INIT_DEFAULT;
mctx->poly = POLY_CRC32; mctx->poly = CRC32_POLY_LE;
return 0; return 0;
} }
...@@ -78,7 +75,7 @@ static int stm32_crc32c_cra_init(struct crypto_tfm *tfm) ...@@ -78,7 +75,7 @@ static int stm32_crc32c_cra_init(struct crypto_tfm *tfm)
struct stm32_crc_ctx *mctx = crypto_tfm_ctx(tfm); struct stm32_crc_ctx *mctx = crypto_tfm_ctx(tfm);
mctx->key = CRC_INIT_DEFAULT; mctx->key = CRC_INIT_DEFAULT;
mctx->poly = POLY_CRC32C; mctx->poly = CRC32C_POLY_LE;
return 0; return 0;
} }
...@@ -187,7 +184,7 @@ static int stm32_crc_final(struct shash_desc *desc, u8 *out) ...@@ -187,7 +184,7 @@ static int stm32_crc_final(struct shash_desc *desc, u8 *out)
struct stm32_crc_ctx *mctx = crypto_shash_ctx(desc->tfm); struct stm32_crc_ctx *mctx = crypto_shash_ctx(desc->tfm);
/* Send computed CRC */ /* Send computed CRC */
put_unaligned_le32(mctx->poly == POLY_CRC32C ? put_unaligned_le32(mctx->poly == CRC32C_POLY_LE ?
~ctx->partial : ctx->partial, out); ~ctx->partial : ctx->partial, out);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment