aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/lantiq
diff options
context:
space:
mode:
authorDaniel Kestrel <kestrel1974@t-online.de>2021-06-15 17:33:24 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2022-01-06 00:23:02 +0100
commit6ade9d1ddac660e7f06116359c0812adde86bf9e (patch)
tree4c7af1344afbb7137f3a6a5efd47cfebdd15dd90 /package/kernel/lantiq
parent0470b05b568c9d9b7188e83c1303d0acac64921d (diff)
downloadupstream-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')
-rw-r--r--package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c6
-rw-r--r--package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c3
-rw-r--r--package/kernel/lantiq/ltq-deu/src/ifxmips_des.c7
-rw-r--r--package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c5
-rw-r--r--package/kernel/lantiq/ltq-deu/src/ifxmips_md5_hmac.c15
-rw-r--r--package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c4
-rw-r--r--package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c10
7 files changed, 7 insertions, 43 deletions
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
index a55766a4ac..e0adc18d62 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c
@@ -343,7 +343,6 @@ int ctr_rfc3686_aes_set_key_skcipher (struct crypto_skcipher *tfm, const uint8_t
return ctr_rfc3686_aes_set_key(crypto_skcipher_tfm(tfm), in_key, key_len);
}
-
/*! \fn void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode)
* \ingroup IFX_AES_FUNCTIONS
* \brief main interface with deu hardware in DMA mode
@@ -572,7 +571,6 @@ struct skcipher_alg ifxdeu_ecb_aes_alg = {
.decrypt = ecb_aes_decrypt,
};
-
/*! \fn int ecb_aes_encrypt(struct skcipher_req *req)
* \ingroup IFX_AES_FUNCTIONS
* \brief CBC AES encrypt using linux crypto skcipher
@@ -736,7 +734,6 @@ struct skcipher_alg ifxdeu_ofb_aes_alg = {
.decrypt = ofb_aes_decrypt,
};
-
/*! \fn int cfb_aes_encrypt(struct skcipher_req *req)
* \ingroup IFX_AES_FUNCTIONS
* \brief CFB AES encrypt using linux crypto skcipher
@@ -825,7 +822,6 @@ struct skcipher_alg ifxdeu_cfb_aes_alg = {
.decrypt = cfb_aes_decrypt,
};
-
/*! \fn int ctr_basic_aes_encrypt(struct skcipher_req *req)
* \ingroup IFX_AES_FUNCTIONS
* \brief Counter mode AES encrypt using linux crypto skcipher
@@ -913,7 +909,6 @@ struct skcipher_alg ifxdeu_ctr_basic_aes_alg = {
.decrypt = ctr_basic_aes_decrypt,
};
-
/*! \fn int ctr_rfc3686_aes_encrypt(struct skcipher_req *req)
* \ingroup IFX_AES_FUNCTIONS
* \brief Counter mode AES (rfc3686) encrypt using linux crypto skcipher
@@ -1021,7 +1016,6 @@ struct skcipher_alg ifxdeu_ctr_rfc3686_aes_alg = {
.decrypt = ctr_rfc3686_aes_decrypt,
};
-
/*! \fn int ifxdeu_init_aes (void)
* \ingroup IFX_AES_FUNCTIONS
* \brief function to initialize AES driver
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c
index 6afd783b6b..51f988fe43 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_arc4.c
@@ -89,7 +89,6 @@ struct arc4_ctx {
extern int disable_deudma;
extern int disable_multiblock;
-
/*! \fn static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode)
\ingroup IFX_ARC4_FUNCTIONS
\brief main interface to ARC4 hardware
@@ -386,5 +385,3 @@ void ifxdeu_fini_arc4(void)
}
-
-
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
index a223e8ec38..8c12a26070 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c
@@ -119,7 +119,6 @@ struct ifx_deu_des_ctx {
extern int disable_multiblock;
extern int disable_deudma;
-
/*! \fn int des_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets DES key
@@ -154,7 +153,6 @@ int des_setkey(struct crypto_tfm *tfm, const u8 *key,
return err;
}
-
/*! \fn int des_setkey_skcipher (struct crypto_skcipher *tfm, const uint8_t *in_key, unsigned int key_len)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets the AES keys for skcipher
@@ -168,7 +166,6 @@ int des_setkey_skcipher (struct crypto_skcipher *tfm, const u8 *in_key, unsigned
return des_setkey(crypto_skcipher_tfm(tfm), in_key, key_len);
}
-
/*! \fn void ifx_deu_des(void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, u32 nbytes, int encdec, int mode)
* \ingroup IFX_DES_FUNCTIONS
* \brief main interface to DES hardware
@@ -287,8 +284,6 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
* \param mode operation mode such as ebc, cbc
*/
-
-
/*! \fn void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets DES hardware to ECB mode
@@ -300,7 +295,6 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
-
void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@@ -776,4 +770,3 @@ void ifxdeu_fini_des (void)
crypto_unregister_skcipher (&ifxdeu_cbc_des3_ede_alg);
}
-
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
index 376ff64d05..51782e0b6a 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_md5.c
@@ -119,9 +119,9 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in)
*((u32 *) hash + 2) = hashs->D3R;
*((u32 *) hash + 3) = hashs->D4R;
- mctx->started = 1;
-
CRTCL_SECT_HASH_END;
+
+ mctx->started = 1;
}
/*! \fn static inline void md5_transform_helper(struct md5_ctx *ctx)
@@ -274,4 +274,3 @@ void ifxdeu_fini_md5 (void)
crypto_unregister_shash(&ifxdeu_md5_alg);
}
-
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);
}
-
-
diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
index a139f8d9d4..a20430c448 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
@@ -38,7 +38,6 @@
\brief ifx deu sha1 functions
*/
-
/* Project header */
#include <linux/init.h>
#include <linux/module.h>
@@ -86,7 +85,6 @@ struct sha1_ctx {
extern int disable_deudma;
-
/*! \fn static void sha1_transform1 (u32 *state, const u32 *in)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief main interface to sha1 hardware
@@ -283,5 +281,3 @@ void ifxdeu_fini_sha1 (void)
}
-
-
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 72770a38e8..9adf4d4710 100644
--- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
+++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
@@ -38,7 +38,6 @@
\brief ifx sha1 hmac functions
*/
-
/* Project header */
#include <linux/init.h>
#include <linux/module.h>
@@ -125,7 +124,6 @@ static int sha1_hmac_transform(struct shash_desc *desc, u32 const *in)
static int sha1_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(tfm);
- volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START;
int err;
if (keylen > SHA1_HMAC_MAX_KEYLEN) {
@@ -152,7 +150,6 @@ static int sha1_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned in
return 0;
}
-
/*! \fn int sha1_hmac_setkey_hw(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief sets sha1 hmac key into hw registers
@@ -351,6 +348,8 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
*((u32 *) out + 3) = hashs->D4R;
*((u32 *) out + 4) = hashs->D5R;
+ CRTCL_SECT_HASH_END;
+
if (hash_final) {
memset(&sctx->buffer[0], 0, SHA1_HMAC_BLOCK_SIZE);
sctx->count = 0;
@@ -358,8 +357,6 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
sctx->dbn = 0;
}
//printk("debug ln: %d, fn: %s\n", __LINE__, __func__);
- CRTCL_SECT_HASH_END;
-
return 0;
@@ -393,7 +390,6 @@ static void sha1_hmac_exit_tfm(struct crypto_tfm *tfm)
kfree(sctx->desc);
}
-
/*
* \brief SHA1_HMAC function mappings
*/
@@ -418,7 +414,6 @@ static struct shash_alg ifxdeu_sha1_hmac_alg = {
}
};
-
/*! \fn int ifxdeu_init_sha1_hmac (void)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief initialize sha1 hmac driver
@@ -451,4 +446,3 @@ void ifxdeu_fini_sha1_hmac (void)
}
-