diff options
author | Daniel Kestrel <kestrel1974@t-online.de> | 2021-06-05 21:37:53 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2022-01-06 00:22:48 +0100 |
commit | 87a19c9345db7554441dbd10f8c4460f6629c10a (patch) | |
tree | 748cf30a44b5ad8261ba3bc1c7ec9d1f89ecc53e /package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c | |
parent | 536dc6f16467f7f029ddf30fb8d47770b3010190 (diff) | |
download | upstream-87a19c9345db7554441dbd10f8c4460f6629c10a.tar.gz upstream-87a19c9345db7554441dbd10f8c4460f6629c10a.tar.bz2 upstream-87a19c9345db7554441dbd10f8c4460f6629c10a.zip |
ltq-deu: make deu hash lock global and remove md5_hmac_ exports
All hash algorithms use the same base IFX_HASH_CON to access the hash unit.
Parallel threads should not be able to call different hash algorithms and
therefor a global lock is required.
Fixed linker warning, that md5_hmac_init, md5_hmac_update and
md5_hmac_final are static export symbols. The export symbols are not
required, because the functions are exposed using shash_alg structure.
Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de>
Diffstat (limited to 'package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c')
-rw-r--r-- | package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c index 14967c30d6..f7dbee4fdc 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c @@ -64,11 +64,6 @@ #define MD5_HASH_WORDS 4 #define HASH_START IFX_HASH_CON -static spinlock_t lock; -#define CRTCL_SECT_INIT spin_lock_init(&lock) -#define CRTCL_SECT_START spin_lock_irqsave(&lock, flag) -#define CRTCL_SECT_END spin_unlock_irqrestore(&lock, flag) - //#define CRYPTO_DEBUG #ifdef CRYPTO_DEBUG extern char debug_level; @@ -110,7 +105,7 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in) volatile struct deu_hash_t *hashs = (struct deu_hash_t *) HASH_START; unsigned long flag; - CRTCL_SECT_START; + CRTCL_SECT_HASH_START; if (mctx->started) { hashs->D1R = endian_swap(*((u32 *) hash + 0)); @@ -136,7 +131,7 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in) mctx->started = 1; - CRTCL_SECT_END; + CRTCL_SECT_HASH_END; } /*! \fn static inline void md5_transform_helper(struct md5_ctx *ctx) @@ -242,14 +237,14 @@ static int md5_final(struct shash_desc *desc, u8 *out) md5_transform(mctx, mctx->hash, mctx->block); - CRTCL_SECT_START; + CRTCL_SECT_HASH_START; *((u32 *) out + 0) = endian_swap (hashs->D1R); *((u32 *) out + 1) = endian_swap (hashs->D2R); *((u32 *) out + 2) = endian_swap (hashs->D3R); *((u32 *) out + 3) = endian_swap (hashs->D4R); - CRTCL_SECT_END; + CRTCL_SECT_HASH_END; // Wipe context memset(mctx, 0, sizeof(*mctx)); @@ -288,8 +283,6 @@ int ifxdeu_init_md5 (void) if ((ret = crypto_register_shash(&ifxdeu_md5_alg))) goto md5_err; - CRTCL_SECT_INIT; - printk (KERN_NOTICE "IFX DEU MD5 initialized%s.\n", disable_deudma ? "" : " (DMA)"); return ret; |