From 87a19c9345db7554441dbd10f8c4460f6629c10a Mon Sep 17 00:00:00 2001 From: Daniel Kestrel Date: Sat, 5 Jun 2021 21:37:53 +0200 Subject: 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 --- package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c') diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c index 09496c509b..a1461e6e5b 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c @@ -66,11 +66,6 @@ #define SHA1_HMAC_MAX_KEYLEN 64 -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) - #ifdef CRYPTO_DEBUG extern char debug_level; #define DPRINTF(level, format, args...) if (level < debug_level) printk(KERN_INFO "[%s %s %d]: " format, __FILE__, __func__, __LINE__, ##args); @@ -158,7 +153,7 @@ static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen) j = 0; - CRTCL_SECT_START; + CRTCL_SECT_HASH_START; for (i = 0; i < keylen; i+=4) { hash->KIDX = j; @@ -167,7 +162,7 @@ static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen) j++; } - CRTCL_SECT_END; + CRTCL_SECT_HASH_END; return 0; } @@ -265,7 +260,7 @@ static int sha1_hmac_final(struct shash_desc *desc, u8 *out) /* Append length */ sha1_hmac_update (desc, bits, sizeof bits); - CRTCL_SECT_START; + CRTCL_SECT_HASH_START; hashs->DBN = sctx->dbn; @@ -312,7 +307,7 @@ static int sha1_hmac_final(struct shash_desc *desc, u8 *out) sctx->count = 0; //printk("debug ln: %d, fn: %s\n", __LINE__, __func__); - CRTCL_SECT_END; + CRTCL_SECT_HASH_END; return 0; @@ -355,8 +350,6 @@ int ifxdeu_init_sha1_hmac (void) if ((ret = crypto_register_shash(&ifxdeu_sha1_hmac_alg))) goto sha1_err; - CRTCL_SECT_INIT; - printk (KERN_NOTICE "IFX DEU SHA1_HMAC initialized%s.\n", disable_deudma ? "" : " (DMA)"); return ret; -- cgit v1.2.3