diff options
author | Daniel Kestrel <kestrel1974@t-online.de> | 2021-06-15 17:33:24 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2022-01-06 00:23:02 +0100 |
commit | 6ade9d1ddac660e7f06116359c0812adde86bf9e (patch) | |
tree | 4c7af1344afbb7137f3a6a5efd47cfebdd15dd90 /package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c | |
parent | 0470b05b568c9d9b7188e83c1303d0acac64921d (diff) | |
download | upstream-6ade9d1ddac660e7f06116359c0812adde86bf9e.tar.gz upstream-6ade9d1ddac660e7f06116359c0812adde86bf9e.tar.bz2 upstream-6ade9d1ddac660e7f06116359c0812adde86bf9e.zip |
ltq-deu: remove compiler warning and shorten locked sections
Removing hash pointer in _hmac_setkey since its not needed and causes
a compiler warning.
Make the spinlock control sections shorter and move initializations
out of the control sections to free the spinlock faster for allowing
other threads to use the hash engine.
Minor improvements for indentation and removal of blanks and blank
lines in some areas.
Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de>
Diffstat (limited to 'package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c')
-rw-r--r-- | package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c index ea808fdc5b..fc3a5ea668 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c @@ -119,7 +119,6 @@ static void md5_hmac_transform(struct shash_desc *desc, u32 const *in) static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { struct md5_hmac_ctx *mctx = crypto_shash_ctx(tfm); - volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; int err; //printk("copying keys to context with length %d\n", keylen); @@ -145,14 +144,12 @@ static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int return 0; } - /*! \fn int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen) * \ingroup IFX_MD5_HMAC_FUNCTIONS * \brief sets md5 hmac key into the hardware registers * \param key input key * \param keylen key length greater than 64 bytes IS NOT SUPPORTED */ - static int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen) { volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START; @@ -323,7 +320,6 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final in += 16; } - #if 1 if (hash_final) { //wait for digest ready @@ -338,6 +334,8 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final *((u32 *) out + 2) = hashs->D3R; *((u32 *) out + 3) = hashs->D4R; + CRTCL_SECT_HASH_END; + if (hash_final) { /* reset the context after we finish with the hash */ mctx->byte_count = 0; @@ -347,10 +345,7 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final } else { mctx->dbn = 0; } - CRTCL_SECT_HASH_END; - - - return 0; + return 0; } /*! \fn void md5_hmac_init_tfm(struct crypto_tfm *tfm) @@ -381,11 +376,9 @@ static void md5_hmac_exit_tfm(struct crypto_tfm *tfm) kfree(mctx->desc); } - /* * \brief MD5_HMAC function mappings */ - static struct shash_alg ifxdeu_md5_hmac_alg = { .digestsize = MD5_DIGEST_SIZE, .init = md5_hmac_init, @@ -435,5 +428,3 @@ void ifxdeu_fini_md5_hmac (void) { crypto_unregister_shash(&ifxdeu_md5_hmac_alg); } - - |