aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
diff options
context:
space:
mode:
authorDaniel Kestrel <kestrel1974@t-online.de>2021-06-05 21:37:53 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2022-01-06 00:22:48 +0100
commit87a19c9345db7554441dbd10f8c4460f6629c10a (patch)
tree748cf30a44b5ad8261ba3bc1c7ec9d1f89ecc53e /package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
parent536dc6f16467f7f029ddf30fb8d47770b3010190 (diff)
downloadupstream-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_sha1_hmac.c')
-rw-r--r--package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c15
1 files changed, 4 insertions, 11 deletions
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;