treewide: strip trailing whitespace

Strip trailing whitespace in all code:
find . -type f | grep "\.c$" | xargs sed -i 's/[ \t]\+$//'
find . -type f | grep "\.h$" | xargs sed -i 's/[ \t]\+$//'
find . -type f | grep "\.dts$" | xargs sed -i 's/[ \t]\+$//'
find . -type f | grep "\.dtsi$" | xargs sed -i 's/[ \t]\+$//'

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/18626
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Mieczyslaw Nalewaj
2025-05-19 14:27:36 +02:00
committed by Robert Marko
parent 6b43a52171
commit a238170e57
138 changed files with 1965 additions and 1965 deletions

View File

@@ -1489,14 +1489,14 @@ IFX_MEI_DFEMemoryAlloc (DSL_DEV_Device_t * pDev, long size)
allocate_size = size;
else
allocate_size = SDRAM_SEGMENT_SIZE;
org_mem_ptr = kmalloc (allocate_size, GFP_KERNEL);
if (org_mem_ptr == NULL) {
IFX_MEI_EMSG ("%d: kmalloc %d bytes memory fail!\n", idx, allocate_size);
err = -ENOMEM;
goto allocate_error;
}
if (((unsigned long)org_mem_ptr) & (1023)) {
/* Pointer not 1k aligned, so free it and allocate a larger chunk
* for further alignment.
@@ -1637,7 +1637,7 @@ DSL_BSP_FWDownload (DSL_DEV_Device_t * pDev, const char *buf,
retval = -ENOMEM;
goto error;
}
if (((unsigned long)org_mem_ptr) & (1023)) {
/* Pointer not 1k aligned, so free it and allocate a larger chunk
* for further alignment.
@@ -1654,7 +1654,7 @@ DSL_BSP_FWDownload (DSL_DEV_Device_t * pDev, const char *buf,
} else {
adsl_mem_info[XDATA_REGISTER].address = org_mem_ptr;
}
adsl_mem_info[XDATA_REGISTER].org_address = org_mem_ptr;
adsl_mem_info[XDATA_REGISTER].size = SDRAM_SEGMENT_SIZE;
@@ -1770,7 +1770,7 @@ int DSL_BSP_EventCBUnregister(DSL_BSP_EventCallBack_t *p)
IFX_MEI_EMSG("Dying Gasp! Shutting Down... (Work around for Amazon-S Venus emulator)\n");
#else
IFX_MEI_EMSG("Dying Gasp! Shutting Down...\n");
// kill_proc (1, SIGINT, 1);
// kill_proc (1, SIGINT, 1);
#endif
return IRQ_HANDLED;
}

View File

@@ -35,7 +35,7 @@
/*!
\defgroup IFX_AES_FUNCTIONS IFX_AES_FUNCTIONS
\ingroup IFX_DEU
\brief IFX AES driver Functions
\brief IFX AES driver Functions
*/
@@ -68,7 +68,7 @@
#include "ifxmips_deu.h"
#if defined(CONFIG_DANUBE)
#if defined(CONFIG_DANUBE)
#include "ifxmips_deu_danube.h"
extern int ifx_danube_pre_1_4;
#elif defined(CONFIG_AR9)
@@ -114,7 +114,7 @@ void aes_dma_memory_copy(u32 *outcopy, u32 *out_dma, u8 *out_arg, int nbytes);
void des_dma_memory_copy(u32 *outcopy, u32 *out_dma, u8 *out_arg, int nbytes);
int aes_memory_allocate(int value);
int des_memory_allocate(int value);
void memory_release(u32 *addr);
void memory_release(u32 *addr);
extern void ifx_deu_aes (void *ctx_arg, uint8_t *out_arg, const uint8_t *in_arg,
@@ -138,16 +138,16 @@ struct aes_ctx {
};
extern int disable_deudma;
extern int disable_multiblock;
extern int disable_multiblock;
/*! \fn int aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_key, unsigned int key_len)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets the AES keys
* \param tfm linux crypto algo transform
* \param in_key input key
* \param key_len key lengths of 16, 24 and 32 bytes supported
* \ingroup IFX_AES_FUNCTIONS
* \brief sets the AES keys
* \param tfm linux crypto algo transform
* \param in_key input key
* \param key_len key lengths of 16, 24 and 32 bytes supported
* \return -EINVAL - bad key length, 0 - SUCCESS
*/
*/
static int aes_set_key (struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len)
{
struct aes_ctx *ctx = crypto_tfm_ctx(tfm);
@@ -186,7 +186,7 @@ static int aes_set_key_skcipher (struct crypto_skcipher *tfm, const u8 *in_key,
/*! \fn void aes_set_key_skcipher (void *ctx_arg)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets the AES key to the hardware, requires spinlock to be set by caller
* \param ctx_arg crypto algo context
* \param ctx_arg crypto algo context
* \return
*/
static void aes_set_key_hw (void *ctx_arg)
@@ -242,15 +242,15 @@ static void aes_set_key_hw (void *ctx_arg)
/*! \fn void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg, size_t nbytes, int encdec, int mode)
* \ingroup IFX_AES_FUNCTIONS
* \brief main interface to AES hardware
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc, ctr
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc, ctr
*
*/
*/
void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
u8 *iv_arg, size_t nbytes, int encdec, int mode)
@@ -261,14 +261,14 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
unsigned long flag;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
int i = 0;
int byte_cnt = nbytes;
int byte_cnt = nbytes;
CRTCL_SECT_START;
aes_set_key_hw (ctx_arg);
aes->controlr.E_D = !encdec; //encryption
aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
//aes->controlr.F = 128; //default; only for CFB and OFB modes; change only for customer-specific apps
if (mode > 0) {
@@ -286,7 +286,7 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
aes->ID2R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 1));
aes->ID1R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 2));
aes->ID0R = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + (i * 4) + 3)); /* start crypto */
while (aes->controlr.BUS) {
// this will not take long
}
@@ -336,13 +336,13 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/*!
* \fn int ctr_rfc3686_aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_key, unsigned int key_len)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets RFC3686 key
* \param tfm linux crypto algo transform
* \param in_key input key
* \param key_len key lengths of 20, 28 and 36 bytes supported; last 4 bytes is nonce
* \brief sets RFC3686 key
* \param tfm linux crypto algo transform
* \param in_key input key
* \param key_len key lengths of 20, 28 and 36 bytes supported; last 4 bytes is nonce
* \return 0 - SUCCESS
* -EINVAL - bad key length
*/
*/
static int ctr_rfc3686_aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_key, unsigned int key_len)
{
struct aes_ctx *ctx = crypto_tfm_ctx(tfm);
@@ -360,7 +360,7 @@ static int ctr_rfc3686_aes_set_key (struct crypto_tfm *tfm, const uint8_t *in_ke
ctx->key_length = key_len;
ctx->use_tweak = 0;
memcpy ((u8 *) (ctx->buf), in_key, key_len);
return 0;
@@ -384,13 +384,13 @@ static int ctr_rfc3686_aes_set_key_skcipher (struct crypto_skcipher *tfm, const
/*! \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
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc, ctr
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc, ctr
*/
@@ -404,15 +404,15 @@ static int ctr_rfc3686_aes_set_key_skcipher (struct crypto_skcipher *tfm, const
/*! \fn void ifx_deu_aes_ecb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to ECB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to ECB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@@ -421,15 +421,15 @@ static void ifx_deu_aes_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_aes_cbc (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to CBC mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to CBC mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_cbc (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@@ -438,15 +438,15 @@ static void ifx_deu_aes_cbc (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_aes_ofb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to OFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to OFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_ofb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@@ -455,15 +455,15 @@ static void ifx_deu_aes_ofb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_aes_cfb (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to CFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to CFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_cfb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@@ -472,15 +472,15 @@ static void ifx_deu_aes_cfb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_aes_ctr (void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
* \ingroup IFX_AES_FUNCTIONS
* \brief sets AES hardware to CTR mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets AES hardware to CTR mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_aes_ctr (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@@ -555,7 +555,7 @@ static int ecb_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -581,7 +581,7 @@ static int ecb_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -627,7 +627,7 @@ static int cbc_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes)) {
u8 *iv = walk.iv;
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -654,7 +654,7 @@ static int cbc_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes)) {
u8 *iv = walk.iv;
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -704,7 +704,7 @@ static void ifx_deu_aes_xts (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
u8 oldiv[16];
int i = 0;
int byte_cnt = nbytes;
int byte_cnt = nbytes;
CRTCL_SECT_START;
@@ -828,7 +828,7 @@ static int xts_aes_encrypt(struct skcipher_request *req)
}
}
}
ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, enc_bytes, CRYPTO_DIR_ENCRYPT);
err = skcipher_walk_done(&walk, nbytes - enc_bytes);
processed += enc_bytes;
@@ -838,7 +838,7 @@ static int xts_aes_encrypt(struct skcipher_request *req)
u8 *iv = walk.iv;
nbytes = req->cryptlen - processed;
scatterwalk_map_and_copy(ctx->lastbuffer, req->src, (req->cryptlen - nbytes), nbytes, 0);
ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer,
ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer,
iv, nbytes, CRYPTO_DIR_ENCRYPT);
scatterwalk_map_and_copy(ctx->lastbuffer, req->dst, (req->cryptlen - nbytes), nbytes, 1);
skcipher_request_complete(req, 0);
@@ -884,7 +884,7 @@ static int xts_aes_decrypt(struct skcipher_request *req)
}
}
}
ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_xts(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, dec_bytes, CRYPTO_DIR_DECRYPT);
err = skcipher_walk_done(&walk, nbytes - dec_bytes);
processed += dec_bytes;
@@ -894,7 +894,7 @@ static int xts_aes_decrypt(struct skcipher_request *req)
u8 *iv = walk.iv;
nbytes = req->cryptlen - processed;
scatterwalk_map_and_copy(ctx->lastbuffer, req->src, (req->cryptlen - nbytes), nbytes, 0);
ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer,
ifx_deu_aes_xts(ctx, ctx->lastbuffer, ctx->lastbuffer,
iv, nbytes, CRYPTO_DIR_DECRYPT);
scatterwalk_map_and_copy(ctx->lastbuffer, req->dst, (req->cryptlen - nbytes), nbytes, 1);
skcipher_request_complete(req, 0);
@@ -969,7 +969,7 @@ static int ofb_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -1002,7 +1002,7 @@ static int ofb_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ofb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -1057,7 +1057,7 @@ static int cfb_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -1090,7 +1090,7 @@ static int cfb_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_cfb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -1145,7 +1145,7 @@ static int ctr_basic_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -1178,7 +1178,7 @@ static int ctr_basic_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
walk.iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -1233,7 +1233,7 @@ static int ctr_rfc3686_aes_encrypt(struct skcipher_request *req)
nbytes = walk.nbytes;
/* set up counter block */
memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
memcpy(rfc3686_iv + CTR_RFC3686_NONCE_SIZE, walk.iv, CTR_RFC3686_IV_SIZE);
/* initialize counter portion of counter block */
@@ -1242,7 +1242,7 @@ static int ctr_rfc3686_aes_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
enc_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
rfc3686_iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -1276,7 +1276,7 @@ static int ctr_rfc3686_aes_decrypt(struct skcipher_request *req)
nbytes = walk.nbytes;
/* set up counter block */
memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
memcpy(rfc3686_iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
memcpy(rfc3686_iv + CTR_RFC3686_NONCE_SIZE, walk.iv, CTR_RFC3686_IV_SIZE);
/* initialize counter portion of counter block */
@@ -1285,7 +1285,7 @@ static int ctr_rfc3686_aes_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes) && (walk.nbytes >= AES_BLOCK_SIZE)) {
dec_bytes -= (nbytes % AES_BLOCK_SIZE);
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_aes_ctr(ctx, walk.dst.virt.addr, walk.src.virt.addr,
rfc3686_iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= AES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -1437,7 +1437,7 @@ static int aes_cbcmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fin
aes_set_key_hw (mctx);
aes->controlr.E_D = !CRYPTO_DIR_ENCRYPT; //encryption
aes->controlr.O = 1; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
aes->controlr.O = 1; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
//aes->controlr.F = 128; //default; only for CFB and OFB modes; change only for customer-specific apps
@@ -1477,7 +1477,7 @@ static int aes_cbcmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fin
*((u32 *) mctx->hash + 3) = DEU_ENDIAN_SWAP(aes->IV0R);
if (hash_final && offset) {
aes->controlr.O = 0; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
aes->controlr.O = 0; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
crypto_xor(mctx->block, mctx->hash, offset);
memcpy(p, mctx->hash + offset, (AES_BLOCK_SIZE - offset));

View File

@@ -33,7 +33,7 @@
\brief ARC4 encryption DEU driver file
*/
/*!
/*!
\defgroup IFX_ARC4_FUNCTIONS IFX_ARC4_FUNCTIONS
\ingroup IFX_DEU
\brief IFX deu driver functions
@@ -59,7 +59,7 @@
#ifdef CONFIG_VR9
#include "ifxmips_deu_vr9.h"
#endif
static spinlock_t lock;
#define CRTCL_SECT_INIT spin_lock_init(&lock)
#define CRTCL_SECT_START spin_lock_irqsave(&lock, flag)
@@ -78,7 +78,7 @@ extern char debug_level;
#define DPRINTF(level, format, args...)
#endif
/*
/*
* \brief arc4 private structure
*/
struct arc4_ctx {
@@ -91,24 +91,24 @@ 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
\param ctx_arg crypto algo context
\param out_arg output bytestream
\param in_arg input bytestream
\param iv_arg initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param mode operation mode such as ebc, cbc, ctr
*/
\brief main interface to ARC4 hardware
\param ctx_arg crypto algo context
\param out_arg output bytestream
\param in_arg input bytestream
\param iv_arg initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param mode operation mode such as ebc, cbc, ctr
*/
static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
u8 *iv_arg, u32 nbytes, int encdec, int mode)
{
volatile struct arc4_t *arc4 = (struct arc4_t *) ARC4_START;
int i = 0;
unsigned long flag;
#if 1 // need to handle nbytes not multiple of 16
#if 1 // need to handle nbytes not multiple of 16
volatile u32 tmp_array32[4];
volatile u8 *tmp_ptr8;
int remaining_bytes, j;
@@ -121,18 +121,18 @@ static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
#if 1
while (i < nbytes) {
arc4->ID3R = *((u32 *) in_arg + (i>>2) + 0);
arc4->ID2R = *((u32 *) in_arg + (i>>2) + 1);
arc4->ID2R = *((u32 *) in_arg + (i>>2) + 1);
arc4->ID1R = *((u32 *) in_arg + (i>>2) + 2);
arc4->ID0R = *((u32 *) in_arg + (i>>2) + 3);
arc4->controlr.GO = 1;
arc4->ID0R = *((u32 *) in_arg + (i>>2) + 3);
arc4->controlr.GO = 1;
while (arc4->controlr.BUS) {
// this will not take long
}
#if 1
// need to handle nbytes not multiple of 16
// need to handle nbytes not multiple of 16
tmp_array32[0] = arc4->OD3R;
tmp_array32[1] = arc4->OD2R;
tmp_array32[2] = arc4->OD1R;
@@ -141,11 +141,11 @@ static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
remaining_bytes = nbytes - i;
if (remaining_bytes > 16)
remaining_bytes = 16;
tmp_ptr8 = (u8 *)&tmp_array32[0];
for (j = 0; j < remaining_bytes; j++)
*out_arg++ = *tmp_ptr8++;
#else
#else
*((u32 *) out_arg + (i>>2) + 0) = arc4->OD3R;
*((u32 *) out_arg + (i>>2) + 1) = arc4->OD2R;
*((u32 *) out_arg + (i>>2) + 2) = arc4->OD1R;
@@ -163,8 +163,8 @@ static void _deu_arc4 (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/*! \fn arc4_chip_init (void)
\ingroup IFX_ARC4_FUNCTIONS
\brief initialize arc4 hardware
*/
\brief initialize arc4 hardware
*/
static void arc4_chip_init (void)
{
//do nothing
@@ -172,18 +172,18 @@ static void arc4_chip_init (void)
/*! \fn static int arc4_set_key(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len)
\ingroup IFX_ARC4_FUNCTIONS
\brief sets ARC4 key
\param tfm linux crypto algo transform
\param in_key input key
\param key_len key lengths less than or equal to 16 bytes supported
*/
\brief sets ARC4 key
\param tfm linux crypto algo transform
\param in_key input key
\param key_len key lengths less than or equal to 16 bytes supported
*/
static int arc4_set_key(struct crypto_tfm *tfm, const u8 *inkey,
unsigned int key_len)
{
//struct arc4_ctx *ctx = crypto_tfm_ctx(tfm);
volatile struct arc4_t *arc4 = (struct arc4_t *) ARC4_START;
u32 *in_key = (u32 *)inkey;
// must program all bits at one go?!!!
//#if 1
*IFX_ARC4_CON = ( (1<<31) | ((key_len - 1)<<27) | (1<<26) | (3<<16) );
@@ -194,7 +194,7 @@ static int arc4_set_key(struct crypto_tfm *tfm, const u8 *inkey,
arc4->K1R = *((u32 *) in_key + 2);
arc4->K0R = *((u32 *) in_key + 3);
#if 0 // arc4 is a ugly state machine, KSAE can only be set once per session
#if 0 // arc4 is a ugly state machine, KSAE can only be set once per session
ctx->key_length = key_len;
memcpy ((u8 *) (ctx->buf), in_key, key_len);
@@ -218,15 +218,15 @@ static int arc4_set_key_skcipher(struct crypto_skcipher *tfm, const u8 *inkey,
/*! \fn static void _deu_arc4_ecb(void *ctx, uint8_t *dst, const uint8_t *src, uint8_t *iv, size_t nbytes, int encdec, int inplace)
\ingroup IFX_ARC4_FUNCTIONS
\brief sets ARC4 hardware to ECB mode
\param ctx crypto algo context
\param dst output bytestream
\param src input bytestream
\param iv initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param inplace not used
*/
\brief sets ARC4 hardware to ECB mode
\param ctx crypto algo context
\param dst output bytestream
\param src input bytestream
\param iv initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param inplace not used
*/
static void _deu_arc4_ecb(void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@@ -235,11 +235,11 @@ static void _deu_arc4_ecb(void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn static void arc4_crypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
\ingroup IFX_ARC4_FUNCTIONS
\brief encrypt/decrypt ARC4_BLOCK_SIZE of data
\param tfm linux crypto algo transform
\param out output bytestream
\param in input bytestream
*/
\brief encrypt/decrypt ARC4_BLOCK_SIZE of data
\param tfm linux crypto algo transform
\param out output bytestream
\param in input bytestream
*/
static void arc4_crypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
{
struct arc4_ctx *ctx = crypto_tfm_ctx(tfm);
@@ -288,7 +288,7 @@ static int ecb_arc4_encrypt(struct skcipher_request *req)
err = skcipher_walk_virt(&walk, req, false);
while ((nbytes = walk.nbytes)) {
_deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
_deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, nbytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= ARC4_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -313,7 +313,7 @@ static int ecb_arc4_decrypt(struct skcipher_request *req)
err = skcipher_walk_virt(&walk, req, false);
while ((nbytes = walk.nbytes)) {
_deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
_deu_arc4_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, nbytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= ARC4_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -343,8 +343,8 @@ static struct skcipher_alg ifxdeu_ecb_arc4_alg = {
/*! \fn int ifxdeu_init_arc4(void)
\ingroup IFX_ARC4_FUNCTIONS
\brief initialize arc4 driver
*/
\brief initialize arc4 driver
*/
int ifxdeu_init_arc4(void)
{
int ret = -ENOSYS;
@@ -376,8 +376,8 @@ ecb_arc4_err:
/*! \fn void ifxdeu_fini_arc4(void)
\ingroup IFX_ARC4_FUNCTIONS
\brief unregister arc4 driver
*/
\brief unregister arc4 driver
*/
void ifxdeu_fini_arc4(void)
{
crypto_unregister_alg (&ifxdeu_arc4_alg);

View File

@@ -136,7 +136,7 @@ struct aes_container {
u32 nbytes;
struct ablkcipher_request arequest;
};
aes_priv_t *aes_queue;
@@ -149,7 +149,7 @@ void hexdump(unsigned char *buf, unsigned int len)
buf, len, false);
}
/*! \fn void lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg,
/*! \fn void lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg, u8 *iv_arg,
size_t nbytes, int encdec, int mode)
* \ingroup IFX_AES_FUNCTIONS
* \brief main interface to AES hardware
@@ -226,7 +226,7 @@ static int lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
AES_DMA_MISC_CONFIG();
aes->controlr.E_D = !encdec; //encryption
aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
aes->controlr.O = mode; //0 ECB 1 CBC 2 OFB 3 CFB 4 CTR
//aes->controlr.F = 128; //default; only for CFB and OFB modes; change only for customer-specific apps
if (mode > 0) {
@@ -240,8 +240,8 @@ static int lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/* Prepare Rx buf length used in dma psuedo interrupt */
deu_priv->deu_rx_buf = (u32 *)out_arg;
deu_priv->deu_rx_len = nbytes;
/* memory alignment issue */
/* memory alignment issue */
dword_mem_aligned_in = (u32 *) DEU_DWORD_REORDERING(in_arg, aes_buff_in, BUFFER_IN, nbytes);
dma->controlr.ALGO = 1; //AES
@@ -274,16 +274,16 @@ static int lq_deu_aes_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
*((u32 *) iv_arg + 2) = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 2));
*((u32 *) iv_arg + 3) = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 3));
}
return -EINPROGRESS;
return -EINPROGRESS;
}
/* \fn static int count_sgs(struct scatterlist *sl, unsigned int total_bytes)
* \ingroup IFX_AES_FUNCTIONS
* \brief Counts and return the number of scatterlists
* \brief Counts and return the number of scatterlists
* \param *sl Function pointer to the scatterlist
* \param total_bytes The total number of bytes that needs to be encrypted/decrypted
* \return The number of scatterlists
* \return The number of scatterlists
*/
static int count_sgs(struct scatterlist *sl, unsigned int total_bytes)
@@ -302,7 +302,7 @@ static int count_sgs(struct scatterlist *sl, unsigned int total_bytes)
/* \fn void lq_sg_init(struct scatterlist *src,
* struct scatterlist *dst)
* \ingroup IFX_AES_FUNCTIONS
* \brief Maps the scatterlists into a source/destination page.
* \brief Maps the scatterlists into a source/destination page.
* \param *src Pointer to the source scatterlist
* \param *dst Pointer to the destination scatterlist
*/
@@ -322,12 +322,12 @@ static void lq_sg_init(struct aes_container *aes_con,struct scatterlist *src,
}
/* \fn static void lq_sg_complete(struct aes_container *aes_con)
/* \fn static void lq_sg_complete(struct aes_container *aes_con)
* \ingroup IFX_AES_FUNCTIONS
* \brief Free the used up memory after encryt/decrypt.
*/
static void lq_sg_complete(struct aes_container *aes_con)
static void lq_sg_complete(struct aes_container *aes_con)
{
unsigned long queue_flag;
@@ -355,9 +355,9 @@ static inline struct aes_container *aes_container_cast (
* \ingroup IFX_AES_FUNCTIONS
* \brief Process next packet to be encrypt/decrypt
* \param *aes_con AES container structure
* \param *areq Pointer to memory location where ablkcipher_request is located
* \param *areq Pointer to memory location where ablkcipher_request is located
* \param state The state of the current packet (part of scatterlist or new packet)
* \return -EINVAL: error, -EINPROGRESS: Crypto still running, 1: no more scatterlist
* \return -EINVAL: error, -EINPROGRESS: Crypto still running, 1: no more scatterlist
*/
static int process_next_packet(struct aes_container *aes_con, struct ablkcipher_request *areq,
@@ -377,17 +377,17 @@ static int process_next_packet(struct aes_container *aes_con, struct ablkcipher_
dir = aes_con->encdec;
mode = aes_con->mode;
iv = aes_con->iv;
if (state & PROCESS_SCATTER) {
src = scatterwalk_sg_next(areq->src);
dst = scatterwalk_sg_next(areq->dst);
if (!src || !dst) {
spin_unlock_irqrestore(&aes_queue->lock, queue_flag);
return 1;
}
}
else if (state & PROCESS_NEW_PACKET) {
else if (state & PROCESS_NEW_PACKET) {
src = areq->src;
dst = areq->dst;
}
@@ -404,7 +404,7 @@ static int process_next_packet(struct aes_container *aes_con, struct ablkcipher_
remain -= inc;
aes_con->nbytes = inc;
if (state & PROCESS_SCATTER) {
aes_con->src_buf += aes_con->nbytes;
aes_con->dst_buf += aes_con->nbytes;
@@ -444,7 +444,7 @@ static int process_next_packet(struct aes_container *aes_con, struct ablkcipher_
* \ingroup IFX_AES_FUNCTIONS
* \brief tasklet to signal the dequeuing of the next packet to be processed
* \param unsigned long data Not used
* \return void
* \return void
*/
static void process_queue(unsigned long data)
@@ -467,17 +467,17 @@ static int aes_crypto_thread (void *data)
struct ablkcipher_request *areq = NULL;
int err;
unsigned long queue_flag;
daemonize("lq_aes_thread");
printk("AES Queue Manager Starting\n");
while (1)
{
DEU_WAIT_EVENT(deu_dma_priv.deu_thread_wait, AES_ASYNC_EVENT,
DEU_WAIT_EVENT(deu_dma_priv.deu_thread_wait, AES_ASYNC_EVENT,
deu_dma_priv.aes_event_flags);
spin_lock_irqsave(&aes_queue->lock, queue_flag);
/* wait to prevent starting a crypto session before
* exiting the dma interrupt thread.
*/
@@ -513,15 +513,15 @@ static int aes_crypto_thread (void *data)
if (aes_con->bytes_processed == 0) {
goto aes_done;
}
/* Process new packet or the next packet in a scatterlist */
if (aes_con->flag & PROCESS_NEW_PACKET) {
aes_con->flag = PROCESS_SCATTER;
err = process_next_packet(aes_con, areq, PROCESS_NEW_PACKET);
}
else
else
err = process_next_packet(aes_con, areq, PROCESS_SCATTER);
if (err == -EINVAL) {
areq->base.complete(&areq->base, err);
lq_sg_complete(aes_con);
@@ -529,31 +529,31 @@ static int aes_crypto_thread (void *data)
}
else if (err > 0) {
printk("src/dst returned zero in func: %s\n", __func__);
goto aes_done;
goto aes_done;
}
continue;
aes_done:
//printk("debug line - %d, func: %s, qlen: %d\n", __LINE__, __func__, aes_queue->list.qlen);
areq->base.complete(&areq->base, 0);
areq->base.complete(&areq->base, 0);
lq_sg_complete(aes_con);
spin_lock_irqsave(&aes_queue->lock, queue_flag);
if (aes_queue->list.qlen > 0) {
spin_unlock_irqrestore(&aes_queue->lock, queue_flag);
tasklet_schedule(&aes_queue->aes_task);
tasklet_schedule(&aes_queue->aes_task);
}
else {
aes_queue->hw_status = AES_IDLE;
spin_unlock_irqrestore(&aes_queue->lock, queue_flag);
}
} //while(1)
return 0;
}
/* \fn static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq,
return 0;
}
/* \fn static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq,
u8 *iv, int dir, int mode)
* \ingroup IFX_AES_FUNCTIONS
* \brief starts the process of queuing DEU requests
@@ -565,18 +565,18 @@ aes_done:
* \return 0 if success
*/
static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq,
static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq,
u8 *iv, int dir, int mode)
{
int err = -EINVAL;
int err = -EINVAL;
unsigned long queue_flag;
struct scatterlist *src = areq->src;
struct scatterlist *dst = areq->dst;
struct aes_container *aes_con = NULL;
u32 remain, inc, nbytes = areq->nbytes;
u32 chunk_bytes = src->length;
aes_con = (struct aes_container *)kmalloc(sizeof(struct aes_container),
GFP_KERNEL);
@@ -600,15 +600,15 @@ static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq
//printk("debug - Line: %d, func: %s, reqsize: %d, scattersize: %d\n",
// __LINE__, __func__, nbytes, chunk_bytes);
if (remain > DEU_MAX_PACKET_SIZE)
if (remain > DEU_MAX_PACKET_SIZE)
inc = DEU_MAX_PACKET_SIZE;
else if (remain > chunk_bytes)
inc = chunk_bytes;
inc = chunk_bytes;
else
inc = remain;
remain -= inc;
lq_sg_init(aes_con, src, dst);
lq_sg_init(aes_con, src, dst);
if (remain <= 0)
aes_con->complete = 1;
@@ -619,7 +619,7 @@ static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq
aes_con->iv = iv;
aes_con->mode = mode;
aes_con->encdec = dir;
spin_lock_irqsave(&aes_queue->lock, queue_flag);
if (aes_queue->hw_status == AES_STARTED || aes_queue->hw_status == AES_BUSY ||
@@ -638,12 +638,12 @@ static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq
spin_unlock_irqrestore(&aes_queue->lock, queue_flag);
return -EINPROGRESS;
}
else if (aes_queue->hw_status == AES_IDLE)
else if (aes_queue->hw_status == AES_IDLE)
aes_queue->hw_status = AES_STARTED;
aes_con->flag = PROCESS_SCATTER;
aes_con->bytes_processed -= aes_con->nbytes;
/* or enqueue the whole structure so as to get back the info
/* or enqueue the whole structure so as to get back the info
* at the moment that it's queued. nbytes might be different */
err = ablkcipher_enqueue_request(&aes_queue->list, &aes_con->arequest);
@@ -671,7 +671,7 @@ static int lq_aes_queue_mgr(struct aes_ctx *ctx, struct ablkcipher_request *areq
static int aes_setkey(struct crypto_ablkcipher *tfm, const u8 *in_key,
unsigned int keylen)
{
struct aes_ctx *ctx = crypto_ablkcipher_ctx(tfm);
struct aes_ctx *ctx = crypto_ablkcipher_ctx(tfm);
unsigned long *flags = (unsigned long *) &tfm->base.crt_flags;
DPRINTF(2, "set_key in %s\n", __FILE__);
@@ -790,7 +790,7 @@ static int ecb_aes_encrypt (struct ablkcipher_request *areq)
* \brief Decrypt function for AES algo
* \param *areq Pointer to ablkcipher request in memory
* \return 0 is success, -EINPROGRESS if encryting, EINVAL if failure
*/
*/
static int ecb_aes_decrypt(struct ablkcipher_request *areq)
{
@@ -864,7 +864,7 @@ static int cfb_aes_decrypt(struct ablkcipher_request *areq)
return lq_aes_queue_mgr(ctx, areq, areq->info, CRYPTO_DIR_DECRYPT, 3);
}
#endif
#endif
/* \fn static int ctr_aes_encrypt(struct ablkcipher_request *areq)
* \ingroup IFX_AES_FUNCTIONS
@@ -877,7 +877,7 @@ static int ctr_aes_encrypt (struct ablkcipher_request *areq)
{
struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
struct aes_ctx *ctx = crypto_ablkcipher_ctx(cipher);
return lq_aes_queue_mgr(ctx, areq, areq->info, CRYPTO_DIR_ENCRYPT, 4);
}
@@ -998,7 +998,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_BLOCK_SIZE,
}
}
}
},{
.alg = {
@@ -1073,7 +1073,7 @@ static struct lq_aes_alg aes_drivers_alg[] = {
int __init lqdeu_async_aes_init (void)
{
int i, j, ret = -EINVAL;
int i, j, ret = -EINVAL;
#define IFX_DEU_DRV_VERSION "2.0.0"
printk(KERN_INFO "Lantiq Technologies DEU Driver version %s\n", IFX_DEU_DRV_VERSION);
@@ -1090,16 +1090,16 @@ int __init lqdeu_async_aes_init (void)
CRTCL_SECT_INIT;
printk (KERN_NOTICE "Lantiq DEU AES initialized %s %s.\n",
printk (KERN_NOTICE "Lantiq DEU AES initialized %s %s.\n",
disable_multiblock ? "" : " (multiblock)", disable_deudma ? "" : " (DMA)");
return ret;
aes_err:
for (j = 0; j < i; j++)
for (j = 0; j < i; j++)
crypto_unregister_alg(&aes_drivers_alg[j].alg);
printk(KERN_ERR "Lantiq %s driver initialization failed!\n", (char *)&aes_drivers_alg[i].alg.cra_driver_name);
return ret;
@@ -1119,15 +1119,15 @@ ctr_rfc3686_aes_err:
void __exit lqdeu_fini_async_aes (void)
{
int i;
for (i = 0; i < ARRAY_SIZE(aes_drivers_alg); i++)
crypto_unregister_alg(&aes_drivers_alg[i].alg);
aes_queue->hw_status = AES_COMPLETED;
DEU_WAKEUP_EVENT(deu_dma_priv.deu_thread_wait, AES_ASYNC_EVENT,
deu_dma_priv.aes_event_flags);
deu_dma_priv.aes_event_flags);
kfree(aes_queue);
kfree(aes_queue);
}

View File

@@ -258,7 +258,7 @@ static int lq_deu_des_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/* memory alignment issue */
dword_mem_aligned_in = (u32 *) DEU_DWORD_REORDERING(in_arg, des_buff_in, BUFFER_IN, nbytes);
deu_priv->deu_rx_buf = (u32 *) out_arg;
deu_priv->deu_rx_len = nbytes;
@@ -283,13 +283,13 @@ static int lq_deu_des_core (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
outcopy = (u32 *) DEU_DWORD_REORDERING(out_arg, des_buff_out, BUFFER_OUT, nbytes);
deu_priv->outcopy = outcopy;
deu_priv->event_src = DES_ASYNC_EVENT;
if (mode > 0) {
*(u32 *) iv_arg = DEU_ENDIAN_SWAP(des->IVHR);
*((u32 *) iv_arg + 1) = DEU_ENDIAN_SWAP(des->IVLR);
};
CRTCL_SECT_END;
CRTCL_SECT_END;
return -EINPROGRESS;
@@ -330,9 +330,9 @@ static inline struct des_container *des_container_cast(
static void lq_sg_complete(struct des_container *des_con)
{
unsigned long queue_flag;
spin_lock_irqsave(&des_queue->lock, queue_flag);
kfree(des_con);
kfree(des_con);
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
}
@@ -367,7 +367,7 @@ static void lq_sg_init(struct des_container *des_con, struct scatterlist *src,
*/
static int process_next_packet(struct des_container *des_con, struct ablkcipher_request *areq,
int state)
int state)
{
u8 *iv;
int mode, encdec, err = -EINVAL;
@@ -401,7 +401,7 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
remain = des_con->bytes_processed;
chunk_size = src->length;
//printk("debug ln: %d, func: %s, reqsize: %d, scattersize: %d\n",
//printk("debug ln: %d, func: %s, reqsize: %d, scattersize: %d\n",
// __LINE__, __func__, areq->nbytes, chunk_size);
if (remain > DEU_MAX_PACKET_SIZE)
@@ -410,14 +410,14 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
inc = chunk_size;
else
inc = remain;
remain -= inc;
des_con->nbytes = inc;
if (state & PROCESS_SCATTER) {
des_con->src_buf += des_con->nbytes;
des_con->dst_buf += des_con->nbytes;
}
}
lq_sg_init(des_con, src, dst);
@@ -429,7 +429,7 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
if (des_queue->hw_status == DES_IDLE) {
des_queue->hw_status = DES_STARTED;
}
des_con->bytes_processed -= des_con->nbytes;
err = ablkcipher_enqueue_request(&des_queue->list, &des_con->arequest);
if (err == -EBUSY) {
@@ -441,7 +441,7 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
err = lq_deu_des_core(ctx, des_con->dst_buf, des_con->src_buf, iv, nbytes, encdec, mode);
return err;
}
@@ -449,7 +449,7 @@ static int process_next_packet(struct des_container *des_con, struct ablkcipher
* \ingroup IFX_DES_FUNCTIONS
* \brief Process next packet in queue
* \param data not used
* \return
* \return
*/
static void process_queue(unsigned long data)
@@ -474,17 +474,17 @@ static int des_crypto_thread(void *data)
unsigned long queue_flag;
daemonize("lq_des_thread");
while (1)
{
DEU_WAIT_EVENT(deu_dma_priv.deu_thread_wait, DES_ASYNC_EVENT,
{
DEU_WAIT_EVENT(deu_dma_priv.deu_thread_wait, DES_ASYNC_EVENT,
deu_dma_priv.des_event_flags);
spin_lock_irqsave(&des_queue->lock, queue_flag);
/* wait to prevent starting a crypto session before
/* wait to prevent starting a crypto session before
* exiting the dma interrupt thread.
*/
if (des_queue->hw_status == DES_STARTED) {
areq = ablkcipher_dequeue_request(&des_queue->list);
des_con = des_container_cast(areq);
@@ -507,7 +507,7 @@ static int des_crypto_thread(void *data)
return 0;
}
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
if ((des_con->bytes_processed == 0)) {
goto des_done;
}
@@ -516,25 +516,25 @@ static int des_crypto_thread(void *data)
goto des_done;
}
if (des_con->flag & PROCESS_NEW_PACKET) {
if (des_con->flag & PROCESS_NEW_PACKET) {
des_con->flag = PROCESS_SCATTER;
err = process_next_packet(des_con, areq, PROCESS_NEW_PACKET);
err = process_next_packet(des_con, areq, PROCESS_NEW_PACKET);
}
else
err = process_next_packet(des_con, areq, PROCESS_SCATTER);
err = process_next_packet(des_con, areq, PROCESS_SCATTER);
if (err == -EINVAL) {
areq->base.complete(&areq->base, err);
lq_sg_complete(des_con);
printk("src/dst returned -EINVAL in func: %s\n", __func__);
}
else if (err > 0) {
else if (err > 0) {
printk("src/dst returned zero in func: %s\n", __func__);
goto des_done;
}
continue;
des_done:
//printk("debug line - %d, func: %s, qlen: %d\n", __LINE__, __func__, des_queue->list.qlen);
areq->base.complete(&areq->base, 0);
@@ -544,13 +544,13 @@ des_done:
if (des_queue->list.qlen > 0) {
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
tasklet_schedule(&des_queue->des_task);
}
}
else {
des_queue->hw_status = DES_IDLE;
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
}
} // while(1)
return 0;
}
@@ -567,7 +567,7 @@ des_done:
* \return 0 if success
*/
static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
u8 *iv, int encdec, int mode)
{
int err = -EINVAL;
@@ -577,8 +577,8 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
struct des_container *des_con = NULL;
u32 remain, inc, nbytes = areq->nbytes;
u32 chunk_bytes = src->length;
des_con = (struct des_container *)kmalloc(sizeof(struct des_container),
des_con = (struct des_container *)kmalloc(sizeof(struct des_container),
GFP_KERNEL);
if (!(des_con)) {
@@ -586,7 +586,7 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
__func__, __LINE__);
return -ENOMEM;
}
/* DES encrypt/decrypt mode */
if (mode == 5) {
nbytes = DES_BLOCK_SIZE;
@@ -598,26 +598,26 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
des_con->arequest = (*areq);
remain = nbytes;
//printk("debug - Line: %d, func: %s, reqsize: %d, scattersize: %d\n",
//printk("debug - Line: %d, func: %s, reqsize: %d, scattersize: %d\n",
// __LINE__, __func__, nbytes, chunk_bytes);
if (remain > DEU_MAX_PACKET_SIZE)
if (remain > DEU_MAX_PACKET_SIZE)
inc = DEU_MAX_PACKET_SIZE;
else if(remain > chunk_bytes)
inc = chunk_bytes;
else
else
inc = remain;
remain -= inc;
lq_sg_init(des_con, src, dst);
if (remain <= 0 ) {
if (remain <= 0 ) {
des_con->complete = 1;
}
else
else
des_con->complete = 0;
des_con->nbytes = inc;
des_con->nbytes = inc;
des_con->iv = iv;
des_con->mode = mode;
des_con->encdec = encdec;
@@ -630,20 +630,20 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
des_con->flag = PROCESS_NEW_PACKET;
err = ablkcipher_enqueue_request(&des_queue->list, &des_con->arequest);
if (err == -EBUSY) {
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
printk("Fail to enqueue ablkcipher request ln: %d, err: %d\n",
__LINE__, err);
return err;
}
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
return -EINPROGRESS;
}
else if (des_queue->hw_status == DES_IDLE) {
des_queue->hw_status = DES_STARTED;
des_queue->hw_status = DES_STARTED;
}
des_con->flag = PROCESS_SCATTER;
des_con->bytes_processed -= des_con->nbytes;
@@ -655,8 +655,8 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
return err;
}
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
spin_unlock_irqrestore(&des_queue->lock, queue_flag);
return lq_deu_des_core(ctx, des_con->dst_buf, des_con->src_buf, iv, inc, encdec, mode);
}
@@ -667,7 +667,7 @@ static int lq_queue_mgr(struct des_ctx *ctx, struct ablkcipher_request *areq,
* \param *areq Pointer to ablkcipher request in memory
* \return 0 is success, -EINPROGRESS if encryting, EINVAL if failure
*/
static int lq_des_encrypt(struct ablkcipher_request *areq)
{
struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
@@ -761,7 +761,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "des",
.cra_driver_name = "lqdeu-des",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@@ -782,7 +782,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "ecb(des)",
.cra_driver_name = "lqdeu-ecb(des)",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@@ -802,7 +802,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "cbc(des)",
.cra_driver_name = "lqdeu-cbc(des)",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@@ -822,7 +822,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "des3_ede",
.cra_driver_name = "lqdeu-des3_ede",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@@ -842,7 +842,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.alg = {
.cra_name = "ecb(des3_ede)",
.cra_driver_name = "lqdeu-ecb(des3_ede)",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@@ -857,12 +857,12 @@ static struct lq_des_alg des_drivers_alg [] = {
.max_keysize = DES3_EDE_KEY_SIZE,
.ivsize = DES3_EDE_BLOCK_SIZE,
}
}
}
},{
.alg = {
.cra_name = "cbc(des3_ede)",
.cra_driver_name = "lqdeu-cbc(des3_ede)",
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_ASYNC,
.cra_blocksize = DES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct des_ctx),
.cra_type = &crypto_ablkcipher_type,
@@ -878,7 +878,7 @@ static struct lq_des_alg des_drivers_alg [] = {
.ivsize = DES3_EDE_BLOCK_SIZE,
}
}
}
}
};
/*! \fn int __init lqdeu_async_des_init (void)
@@ -895,7 +895,7 @@ int __init lqdeu_async_des_init (void)
if (ret)
goto des_err;
}
des_chip_init();
CRTCL_SECT_INIT;
@@ -904,7 +904,7 @@ int __init lqdeu_async_des_init (void)
return ret;
des_err:
for (j = 0; j < i; j++)
for (j = 0; j < i; j++)
crypto_unregister_alg(&des_drivers_alg[i].alg);
printk(KERN_ERR "Lantiq %s driver initialization failed!\n", (char *)&des_drivers_alg[i].alg.cra_driver_name);
@@ -914,7 +914,7 @@ cbc_des3_ede_err:
for (i = 0; i < ARRAY_SIZE(des_drivers_alg); i++) {
if (!strcmp((char *)&des_drivers_alg[i].alg.cra_name, "cbc(des3_ede)"))
crypto_unregister_alg(&des_drivers_alg[i].alg);
}
}
printk(KERN_ERR "Lantiq %s driver initialization failed!\n", (char *)&des_drivers_alg[i].alg.cra_driver_name);
return ret;
@@ -927,14 +927,14 @@ cbc_des3_ede_err:
void __exit lqdeu_fini_async_des (void)
{
int i;
for (i = 0; i < ARRAY_SIZE(des_drivers_alg); i++)
crypto_unregister_alg(&des_drivers_alg[i].alg);
des_queue->hw_status = DES_COMPLETED;
DEU_WAKEUP_EVENT(deu_dma_priv.deu_thread_wait, DES_ASYNC_EVENT,
deu_dma_priv.des_event_flags);
deu_dma_priv.des_event_flags);
kfree(des_queue);
}

View File

@@ -54,7 +54,7 @@
#include <crypto/internal/skcipher.h>
#include "ifxmips_deu.h"
#if defined(CONFIG_DANUBE)
#if defined(CONFIG_DANUBE)
#include "ifxmips_deu_danube.h"
extern int ifx_danube_pre_1_4;
#elif defined(CONFIG_AR9)
@@ -68,9 +68,9 @@ extern int ifx_danube_pre_1_4;
/* DMA specific header and variables */
#if 0
#define CRTCL_SECT_INIT
#define CRTCL_SECT_START
#define CRTCL_SECT_END
#define CRTCL_SECT_INIT
#define CRTCL_SECT_START
#define CRTCL_SECT_END
#else
spinlock_t des_lock;
#define CRTCL_SECT_INIT spin_lock_init(&des_lock)
@@ -121,11 +121,11 @@ 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
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length
*/
* \brief sets DES key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length
*/
static int des_setkey(struct crypto_tfm *tfm, const u8 *key,
unsigned int keylen)
{
@@ -168,15 +168,15 @@ static int des_setkey_skcipher (struct crypto_skcipher *tfm, const u8 *in_key, u
/*! \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
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc
*/
* \brief main interface to DES hardware
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc
*/
void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
u8 *iv_arg, u32 nbytes, int encdec, int mode)
@@ -188,7 +188,7 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
int i = 0;
int nblocks = 0;
CRTCL_SECT_START;
des->controlr.M = dctx->controlr_M;
@@ -242,10 +242,10 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
#ifdef CRYPTO_DEBUG
printk ("ihr: %x\n", (*((u32 *) in_arg + i)));
printk ("ilr: %x\n", (*((u32 *) in_arg + 1 + i)));
#endif
#endif
des->IHR = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + i));
des->ILR = INPUT_ENDIAN_SWAP(*((u32 *) in_arg + 1 + i)); /* start crypto */
while (des->controlr.BUS) {
// this will not take long
}
@@ -256,7 +256,7 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
}
if (mode > 0) {
*(u32 *) iv_arg = DEU_ENDIAN_SWAP(des->IVHR);
*((u32 *) iv_arg + 1) = DEU_ENDIAN_SWAP(des->IVLR);
@@ -275,26 +275,26 @@ void ifx_deu_des (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
/*! \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
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param mode operation mode such as ebc, cbc
*/
* \brief main interface to DES hardware
* \param ctx_arg crypto algo context
* \param out_arg output bytestream
* \param in_arg input bytestream
* \param iv_arg initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \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
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
* \brief sets DES hardware to ECB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
@@ -304,15 +304,15 @@ static void ifx_deu_des_ecb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_cbc (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 CBC mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets DES hardware to CBC mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
static void ifx_deu_des_cbc (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
{
@@ -321,15 +321,15 @@ static void ifx_deu_des_cbc (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_ofb (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 OFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets DES hardware to OFB mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
/*
static void ifx_deu_des_ofb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
@@ -340,15 +340,15 @@ static void ifx_deu_des_ofb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_cfb (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 CFB mode
\param ctx crypto algo context
\param dst output bytestream
\param src input bytestream
\param iv initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param inplace not used
*/
\brief sets DES hardware to CFB mode
\param ctx crypto algo context
\param dst output bytestream
\param src input bytestream
\param iv initialization vector
\param nbytes length of bytestream
\param encdec 1 for encrypt; 0 for decrypt
\param inplace not used
*/
/*
static void ifx_deu_des_cfb (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
@@ -359,15 +359,15 @@ static void ifx_deu_des_cfb (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_ctr (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 CTR mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
* \brief sets DES hardware to CTR mode
* \param ctx crypto algo context
* \param dst output bytestream
* \param src input bytestream
* \param iv initialization vector
* \param nbytes length of bytestream
* \param encdec 1 for encrypt; 0 for decrypt
* \param inplace not used
*/
/*
void ifx_deu_des_ctr (void *ctx, uint8_t *dst, const uint8_t *src,
uint8_t *iv, size_t nbytes, int encdec, int inplace)
@@ -378,11 +378,11 @@ void ifx_deu_des_ctr (void *ctx, uint8_t *dst, const uint8_t *src,
/*! \fn void ifx_deu_des_encrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in)
* \ingroup IFX_DES_FUNCTIONS
* \brief encrypt DES_BLOCK_SIZE of data
* \param tfm linux crypto algo transform
* \param out output bytestream
* \param in input bytestream
*/
* \brief encrypt DES_BLOCK_SIZE of data
* \param tfm linux crypto algo transform
* \param out output bytestream
* \param in input bytestream
*/
static void ifx_deu_des_encrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in)
{
struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(tfm);
@@ -393,11 +393,11 @@ static void ifx_deu_des_encrypt (struct crypto_tfm *tfm, uint8_t * out, const ui
/*! \fn void ifx_deu_des_decrypt (struct crypto_tfm *tfm, uint8_t *out, const uint8_t *in)
* \ingroup IFX_DES_FUNCTIONS
* \brief encrypt DES_BLOCK_SIZE of data
* \param tfm linux crypto algo transform
* \param out output bytestream
* \param in input bytestream
*/
* \brief encrypt DES_BLOCK_SIZE of data
* \param tfm linux crypto algo transform
* \param out output bytestream
* \param in input bytestream
*/
static void ifx_deu_des_decrypt (struct crypto_tfm *tfm, uint8_t * out, const uint8_t * in)
{
struct ifx_deu_des_ctx *ctx = crypto_tfm_ctx(tfm);
@@ -421,11 +421,11 @@ static void ifx_deu_des_decrypt (struct crypto_tfm *tfm, uint8_t * out, const ui
/*! \fn int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_DES_FUNCTIONS
* \brief sets 3DES key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length
*/
* \brief sets 3DES key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length
*/
static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key,
unsigned int keylen)
{
@@ -468,7 +468,7 @@ static int des3_ede_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key,
/*
* \brief DES function mappings
*/
*/
struct crypto_alg ifxdeu_des_alg = {
.cra_name = "des",
.cra_driver_name = "ifxdeu-des",
@@ -489,7 +489,7 @@ struct crypto_alg ifxdeu_des_alg = {
/*
* \brief DES function mappings
*/
*/
struct crypto_alg ifxdeu_des3_ede_alg = {
.cra_name = "des3_ede",
.cra_driver_name = "ifxdeu-des3_ede",
@@ -525,7 +525,7 @@ static int ecb_des_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes)) {
enc_bytes -= (nbytes % DES_BLOCK_SIZE);
ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= DES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -552,7 +552,7 @@ static int ecb_des_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes)) {
dec_bytes -= (nbytes % DES_BLOCK_SIZE);
ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr,
NULL, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= DES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -618,7 +618,7 @@ static int cbc_des_encrypt(struct skcipher_request *req)
while ((nbytes = enc_bytes = walk.nbytes)) {
u8 *iv = walk.iv;
enc_bytes -= (nbytes % DES_BLOCK_SIZE);
ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0);
nbytes &= DES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -646,7 +646,7 @@ static int cbc_des_decrypt(struct skcipher_request *req)
while ((nbytes = dec_bytes = walk.nbytes)) {
u8 *iv = walk.iv;
dec_bytes -= (nbytes % DES_BLOCK_SIZE);
ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0);
nbytes &= DES_BLOCK_SIZE - 1;
err = skcipher_walk_done(&walk, nbytes);
@@ -697,8 +697,8 @@ struct skcipher_alg ifxdeu_cbc_des3_ede_alg = {
/*! \fn int ifxdeu_init_des (void)
* \ingroup IFX_DES_FUNCTIONS
* \brief initialize des driver
*/
* \brief initialize des driver
*/
int ifxdeu_init_des (void)
{
int ret = -ENOSYS;
@@ -765,8 +765,8 @@ cbc_des3_ede_err:
/*! \fn void ifxdeu_fini_des (void)
* \ingroup IFX_DES_FUNCTIONS
* \brief unregister des driver
*/
* \brief unregister des driver
*/
void ifxdeu_fini_des (void)
{
crypto_unregister_alg (&ifxdeu_des_alg);

View File

@@ -65,7 +65,7 @@
#include "ifxmips_deu_ar9.h"
#elif defined(CONFIG_VR9) || defined(CONFIG_AR10)
#include "ifxmips_deu_vr9.h"
#else
#else
#error "Platform unknown!"
#endif /* CONFIG_xxxx */
@@ -77,10 +77,10 @@ void chip_version(void);
/*! \fn static int __init deu_init (void)
* \ingroup IFX_DEU_FUNCTIONS
* \brief link all modules that have been selected in kernel config for ifx hw crypto support
* \return ret
*/
* \brief link all modules that have been selected in kernel config for ifx hw crypto support
* \return ret
*/
static int ltq_deu_probe(struct platform_device *pdev)
{
int ret = -ENOSYS;
@@ -88,7 +88,7 @@ static int ltq_deu_probe(struct platform_device *pdev)
START_DEU_POWER;
CRTCL_SECT_HASH_INIT;
#define IFX_DEU_DRV_VERSION "2.0.0"
printk(KERN_INFO "Infineon Technologies DEU driver version %s \n", IFX_DEU_DRV_VERSION);
@@ -141,8 +141,8 @@ static int ltq_deu_probe(struct platform_device *pdev)
/*! \fn static void __exit deu_fini (void)
* \ingroup IFX_DEU_FUNCTIONS
* \brief remove the loaded crypto algorithms
*/
* \brief remove the loaded crypto algorithms
*/
static void ltq_deu_remove(struct platform_device *pdev)
{
//#ifdef CONFIG_CRYPTO_DEV_PWR_SAVE_MODE

View File

@@ -96,8 +96,8 @@
clc->DISR = 1; \
} while (0)
/*
* Not used anymore in UEIP (use IFX_DES_CON, IFX_AES_CON, etc instead)
/*
* Not used anymore in UEIP (use IFX_DES_CON, IFX_AES_CON, etc instead)
* #define DEU_BASE (KSEG1+0x1E103100)
* #define DES_CON (DEU_BASE+0x10)
* #define AES_CON (DEU_BASE+0x50)
@@ -153,7 +153,7 @@ extern spinlock_t ltq_deu_hash_lock;
set_bit((event), &(flags)); \
wake_up_interruptible(&(queue)); \
}while (0)
#define DEU_WAIT_EVENT(queue, event, flags) \
do { \
wait_event_interruptible(queue, \
@@ -184,7 +184,7 @@ typedef struct deu_drv_priv {
* @lock: spinlock lock
* @lock_flag: flag for spinlock activities
* @list: crypto queue API list
* @hw_status: DEU hw status flag
* @hw_status: DEU hw status flag
* @aes_wait_flag: flag for sleep queue
* @aes_wait_queue: queue attributes for aes
* @bytes_processed: number of bytes to process by DEU
@@ -230,7 +230,7 @@ typedef struct {
struct tasklet_struct des_task;
} des_priv_t;
#endif /* IFXMIPS_DEU_H */

View File

@@ -31,8 +31,8 @@
\brief ifx deu board specific driver file for ar9
*/
/*!
\defgroup BOARD_SPECIFIC_FUNCTIONS IFX_BOARD_SPECIFIC_FUNCTIONS
/*!
\defgroup BOARD_SPECIFIC_FUNCTIONS IFX_BOARD_SPECIFIC_FUNCTIONS
\ingroup IFX_DEU
\brief board specific functions
*/
@@ -71,9 +71,9 @@ u8 *g_dma_block2 = NULL;
deu_drv_priv_t deu_dma_priv;
/*! \fn u32 endian_swap(u32 input)
/*! \fn u32 endian_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Swap data given to the function
* \brief Swap data given to the function
* \param input Data input to be swapped
* \return either the swapped data or the input data depending on whether it is in DMA mode or FPI mode
*/
@@ -84,7 +84,7 @@ u32 endian_swap(u32 input)
/*! \fn u32 input_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Not used
* \brief Not used
* \return input
*/
@@ -95,7 +95,7 @@ u32 input_swap(u32 input)
/*! \fn void aes_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize AES hardware
* \brief initialize AES hardware
*/
void aes_chip_init (void)
@@ -110,8 +110,8 @@ void aes_chip_init (void)
/*! \fn void des_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize DES hardware
*/
*/
void des_chip_init (void)
{
volatile struct des_t *des = (struct des_t *) DES_3DES_START;
@@ -123,12 +123,12 @@ void des_chip_init (void)
}
/*! \fn void chip_version(void)
/*! \fn void chip_version(void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief not used!
*/
*/
void chip_version(void)
void chip_version(void)
{
return;
}

View File

@@ -65,9 +65,9 @@
#define INPUT_ENDIAN_SWAP(input) input_swap(input)
#define DEU_ENDIAN_SWAP(input) endian_swap(input)
#define DELAY_PERIOD 10
#define DELAY_PERIOD 10
#define FIND_DEU_CHIP_VERSION chip_version()
#define CLC_START IFX_DEU_CLK
#define CLC_START IFX_DEU_CLK
#define AES_INIT 0
#define DES_INIT 1
@@ -79,7 +79,7 @@
#define AES_START IFX_AES_CON
#define DES_3DES_START IFX_DES_CON
#define WAIT_AES_DMA_READY() \
do { \
int i; \
@@ -126,7 +126,7 @@
} while(0)
/* DEU Common Structures for AR9*/
struct clc_controlr_t {
u32 Res:26;
u32 FSOE:1;
@@ -233,7 +233,7 @@ struct arc4_t {
u32 reserved3:1;
u32 ARS:1;
u32 SM:1;
u32 reserved4:4;
u32 reserved4:4;
} controlr;
u32 K3R; //104h
@@ -247,7 +247,7 @@ struct arc4_t {
u32 ID2R; //11Ch
u32 ID1R; //120h
u32 ID0R; //124h
u32 OD3R; //128h
u32 OD2R; //12Ch
u32 OD1R; //130h
@@ -257,14 +257,14 @@ struct arc4_t {
struct deu_hash_t {
struct hash_controlr {
u32 reserved1:5;
u32 KHS:1;
u32 KHS:1;
u32 GO:1;
u32 INIT:1;
u32 reserved2:6;
u32 NDC:1;
u32 ENDI:1;
u32 reserved3:7;
u32 DGRY:1;
u32 DGRY:1;
u32 BSY:1;
u32 reserved4:1;
u32 IRCL:1;

View File

@@ -52,14 +52,14 @@
/* Function Declerations */
int aes_memory_allocate(int value);
int des_memory_allocate(int value);
void memory_release(u32 *addr);
void memory_release(u32 *addr);
int aes_chip_init (void);
void des_chip_init (void);
int deu_dma_init (void);
u32 endian_swap(u32 input);
u32* memory_alignment(const u8 *arg, u32 *buff_alloc, int in_out, int nbytes);
void dma_memory_copy(u32 *outcopy, u32 *out_dma, u8 *out_arg, int nbytes);
void chip_version(void);
void chip_version(void);
void deu_dma_priv_init(void);
void __exit ifxdeu_fini_dma(void);
@@ -68,7 +68,7 @@ void __exit ifxdeu_fini_dma(void);
#define CLC_START IFX_DEU_CLK
/* Variables definition */
int ifx_danube_pre_1_4;
int ifx_danube_pre_1_4;
u8 *g_dma_page_ptr = NULL;
u8 *g_dma_block = NULL;
u8 *g_dma_block2 = NULL;
@@ -76,7 +76,7 @@ u8 *g_dma_block2 = NULL;
deu_drv_priv_t deu_dma_priv;
/*! \fn u32 endian_swap(u32 input)
/*! \fn u32 endian_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief function is not used
* \param input Data input to be swapped
@@ -91,8 +91,8 @@ u32 endian_swap(u32 input)
/*! \fn u32 input_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Swap the input data if the current chip is Danube version
* 1.4 and do nothing to the data if the current chip is
* Danube version 1.3
* 1.4 and do nothing to the data if the current chip is
* Danube version 1.3
* \param input data that needs to be swapped
* \return input or swapped input
*/
@@ -101,9 +101,9 @@ u32 input_swap(u32 input)
{
if (!ifx_danube_pre_1_4) {
u8 *ptr = (u8 *)&input;
return ((ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]);
return ((ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]);
}
else
else
return input;
}
@@ -111,7 +111,7 @@ u32 input_swap(u32 input)
/*! \fn void aes_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize AES hardware
* \brief initialize AES hardware
*/
int aes_chip_init (void)
@@ -127,8 +127,8 @@ int aes_chip_init (void)
/*! \fn void des_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize DES hardware
*/
*/
void des_chip_init (void)
{
volatile struct des_t *des = (struct des_t *) DES_3DES_START;
@@ -142,11 +142,11 @@ void des_chip_init (void)
* \ingroup IFX_DES_FUNCTIONS
* \brief To find the version of the chip by looking at the chip ID
* \param ifx_danube_pre_1_4 (sets to 1 if Chip is Danube less than v1.4)
*/
*/
#define IFX_MPS (KSEG1 | 0x1F107000)
#define IFX_MPS_CHIPID ((volatile u32*)(IFX_MPS + 0x0344))
void chip_version(void)
void chip_version(void)
{
/* DANUBE PRE 1.4 SOFTWARE FIX */
@@ -159,7 +159,7 @@ void chip_version(void)
printk("Danube Chip ver. 1.4 detected. \n");
}
else {
ifx_danube_pre_1_4 = 1;
ifx_danube_pre_1_4 = 1;
printk("Danube Chip ver. 1.3 or below detected. \n");
}

View File

@@ -71,7 +71,7 @@
#define AES_INIT 0
#define DES_INIT 1
#define SHA1_INIT 2
#define SHA1_INIT 2
#define MD5_INIT 3
#define WAIT_AES_DMA_READY() \
@@ -94,7 +94,7 @@
udelay(DELAY_PERIOD); \
while (dma->controlr.BSY) {}; \
while (des->controlr.BUS) {}; \
} while (0)
} while (0)
#define SHA_HASH_INIT \
do { \
@@ -167,12 +167,12 @@ struct aes_t {
u32 PNK:1;
u32 GO:1;
u32 STP:1;
u32 reserved2:6;
u32 NDC:1;
u32 ENDI:1;
u32 ENDI:1;
u32 reserved3:2;
u32 F:3; //fbs
u32 O:3; //om
u32 BUS:1; //bsy
@@ -209,14 +209,14 @@ struct aes_t {
struct deu_hash_t {
struct hash_controlr {
u32 reserved1:5;
u32 KHS:1;
u32 KHS:1;
u32 GO:1;
u32 INIT:1;
u32 reserved2:6;
u32 NDC:1;
u32 ENDI:1;
u32 reserved3:7;
u32 DGRY:1;
u32 DGRY:1;
u32 BSY:1;
u32 reserved4:1;
u32 IRCL:1;

View File

@@ -29,7 +29,7 @@
/*!
\file ifxmips_deu_dma.c
\ingroup IFX_DEU
\brief DMA deu driver file
\brief DMA deu driver file
*/
/*!
@@ -38,5 +38,5 @@
\brief deu-dma driver functions
*/
/* Project header files */
/* Project header files */

View File

@@ -72,9 +72,9 @@ u8 *g_dma_block2 = NULL;
deu_drv_priv_t deu_dma_priv;
/*! \fn u32 endian_swap(u32 input)
/*! \fn u32 endian_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Swap data given to the function
* \brief Swap data given to the function
* \param input Data input to be swapped
* \return either the swapped data or the input data depending on whether it is in DMA mode or FPI mode
*/
@@ -87,7 +87,7 @@ u32 endian_swap(u32 input)
/*! \fn u32 input_swap(u32 input)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief Not used
* \brief Not used
* \return input
*/
@@ -98,7 +98,7 @@ u32 input_swap(u32 input)
/*! \fn void aes_chip_init (void)
* \ingroup BOARD_SPECIFIC_FUNCTIONS
* \brief initialize AES hardware
* \brief initialize AES hardware
*/
void aes_chip_init (void)
@@ -112,14 +112,14 @@ void aes_chip_init (void)
aes->controlr.ENDI = 1;
asm("sync");
aes->controlr.ARS = 0;
}
/*! \fn void des_chip_init (void)
* \ingroup IFX_AES_FUNCTIONS
* \brief initialize DES hardware
*/
*/
void des_chip_init (void)
{
volatile struct des_t *des = (struct des_t *) DES_3DES_START;
@@ -129,7 +129,7 @@ void des_chip_init (void)
des->controlr.NDC = 1;
asm("sync");
des->controlr.ENDI = 1;
asm("sync");
asm("sync");
des->controlr.ARS = 0;
}
@@ -137,7 +137,7 @@ void des_chip_init (void)
* \ingroup IFX_DES_FUNCTIONS
* \brief function not used in VR9
*/
void chip_version(void)
void chip_version(void)
{
return;
}

View File

@@ -87,14 +87,14 @@
#define INPUT_ENDIAN_SWAP(input) input_swap(input)
#define DEU_ENDIAN_SWAP(input) endian_swap(input)
#define FIND_DEU_CHIP_VERSION chip_version()
#define FIND_DEU_CHIP_VERSION chip_version()
#if defined (CONFIG_AR10)
#define DELAY_PERIOD 30
#else
#define DELAY_PERIOD 10
#endif
#define WAIT_AES_DMA_READY() \
do { \
int i; \
@@ -143,7 +143,7 @@
} while(0)
/* DEU Common Structures for AR9*/
struct clc_controlr_t {
u32 Res:26;
u32 FSOE:1;
@@ -250,7 +250,7 @@ struct arc4_t {
u32 reserved3:1;
u32 ARS:1;
u32 SM:1;
u32 reserved4:4;
u32 reserved4:4;
} controlr;
u32 K3R; //104h
@@ -264,7 +264,7 @@ struct arc4_t {
u32 ID2R; //11Ch
u32 ID1R; //120h
u32 ID0R; //124h
u32 OD3R; //128h
u32 OD2R; //12Ch
u32 OD1R; //130h
@@ -274,14 +274,14 @@ struct arc4_t {
struct deu_hash_t {
struct hash_controlr {
u32 reserved1:5;
u32 KHS:1;
u32 KHS:1;
u32 GO:1;
u32 INIT:1;
u32 reserved2:6;
u32 NDC:1;
u32 ENDI:1;
u32 reserved3:7;
u32 DGRY:1;
u32 DGRY:1;
u32 BSY:1;
u32 reserved4:1;
u32 IRCL:1;

View File

@@ -29,7 +29,7 @@
/*!
\file ifxmips_md5.c
\ingroup IFX_DEU
\brief MD5 encryption deu driver file
\brief MD5 encryption deu driver file
*/
/*!
@@ -83,10 +83,10 @@ extern int disable_deudma;
/*! \fn static void md5_transform(u32 *hash, u32 const *in)
* \ingroup IFX_MD5_FUNCTIONS
* \brief main interface to md5 hardware
* \param hash current hash value
* \param in 64-byte block of input
*/
* \brief main interface to md5 hardware
* \param hash current hash value
* \param in 64-byte block of input
*/
static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in)
{
int i;
@@ -97,7 +97,7 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in)
MD5_HASH_INIT;
if (mctx->started) {
if (mctx->started) {
hashs->D1R = *((u32 *) hash + 0);
hashs->D2R = *((u32 *) hash + 1);
hashs->D3R = *((u32 *) hash + 2);
@@ -126,9 +126,9 @@ static void md5_transform(struct md5_ctx *mctx, u32 *hash, u32 const *in)
/*! \fn static inline void md5_transform_helper(struct md5_ctx *ctx)
* \ingroup IFX_MD5_FUNCTIONS
* \brief interfacing function for md5_transform()
* \param ctx crypto context
*/
* \brief interfacing function for md5_transform()
* \param ctx crypto context
*/
static inline void md5_transform_helper(struct md5_ctx *ctx)
{
//le32_to_cpu_array(ctx->block, sizeof(ctx->block) / sizeof(u32));
@@ -137,9 +137,9 @@ static inline void md5_transform_helper(struct md5_ctx *ctx)
/*! \fn static void md5_init(struct crypto_tfm *tfm)
* \ingroup IFX_MD5_FUNCTIONS
* \brief initialize md5 hardware
* \param tfm linux crypto algo transform
*/
* \brief initialize md5 hardware
* \param tfm linux crypto algo transform
*/
static int md5_init(struct shash_desc *desc)
{
struct md5_ctx *mctx = shash_desc_ctx(desc);
@@ -152,11 +152,11 @@ static int md5_init(struct shash_desc *desc)
/*! \fn static void md5_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
* \ingroup IFX_MD5_FUNCTIONS
* \brief on-the-fly md5 computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
* \brief on-the-fly md5 computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
static int md5_update(struct shash_desc *desc, const u8 *data, unsigned int len)
{
struct md5_ctx *mctx = shash_desc_ctx(desc);
@@ -190,10 +190,10 @@ static int md5_update(struct shash_desc *desc, const u8 *data, unsigned int len)
/*! \fn static void md5_final(struct crypto_tfm *tfm, u8 *out)
* \ingroup IFX_MD5_FUNCTIONS
* \brief compute final md5 value
* \param tfm linux crypto algo transform
* \param out final md5 output value
*/
* \brief compute final md5 value
* \param tfm linux crypto algo transform
* \param out final md5 output value
*/
static int md5_final(struct shash_desc *desc, u8 *out)
{
struct md5_ctx *mctx = shash_desc_ctx(desc);
@@ -215,7 +215,7 @@ static int md5_final(struct shash_desc *desc, u8 *out)
mctx->block[14] = le32_to_cpu(mctx->byte_count << 3);
mctx->block[15] = le32_to_cpu(mctx->byte_count >> 29);
md5_transform(mctx, mctx->hash, mctx->block);
md5_transform(mctx, mctx->hash, mctx->block);
memcpy(out, mctx->hash, MD5_DIGEST_SIZE);
@@ -246,8 +246,8 @@ static struct shash_alg ifxdeu_md5_alg = {
/*! \fn int ifxdeu_init_md5 (void)
* \ingroup IFX_MD5_FUNCTIONS
* \brief initialize md5 driver
*/
* \brief initialize md5 driver
*/
int ifxdeu_init_md5 (void)
{
int ret = -ENOSYS;
@@ -266,9 +266,9 @@ md5_err:
/*! \fn void ifxdeu_fini_md5 (void)
* \ingroup IFX_MD5_FUNCTIONS
* \brief unregister md5 driver
*/
* \brief unregister md5 driver
*/
void ifxdeu_fini_md5 (void)
{
crypto_unregister_shash(&ifxdeu_md5_alg);

View File

@@ -60,7 +60,7 @@
#define MD5_HMAC_BLOCK_SIZE 64
#define MD5_BLOCK_WORDS 16
#define MD5_HASH_WORDS 4
#define MD5_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround
#define MD5_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround
#define HASH_START IFX_HASH_CON
//#define CRYPTO_DEBUG
@@ -91,10 +91,10 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
/*! \fn static void md5_hmac_transform(struct crypto_tfm *tfm, u32 const *in)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief save input block to context
* \param tfm linux crypto algo transform
* \param in 64-byte block of input
*/
* \brief save input block to context
* \param tfm linux crypto algo transform
* \param in 64-byte block of input
*/
static void md5_hmac_transform(struct shash_desc *desc, u32 const *in)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm);
@@ -111,12 +111,12 @@ static void md5_hmac_transform(struct shash_desc *desc, u32 const *in)
/*! \fn int md5_hmac_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief sets md5 hmac key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen)
* \brief sets md5 hmac key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(tfm);
int err;
@@ -146,25 +146,25 @@ static int md5_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int
/*! \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
*/
* \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;
int i, j;
u32 *in_key = (u32 *)key;
u32 *in_key = (u32 *)key;
//printk("\nsetkey keylen: %d\n key: ", keylen);
hash->KIDX |= 0x80000000; // reset all 16 words of the key to '0'
j = 0;
for (i = 0; i < keylen; i+=4)
{
hash->KIDX = j;
asm("sync");
hash->KEY = *((u32 *) in_key + j);
hash->KEY = *((u32 *) in_key + j);
asm("sync");
j++;
}
@@ -174,14 +174,14 @@ static int md5_hmac_setkey_hw(const u8 *key, unsigned int keylen)
/*! \fn void md5_hmac_init(struct crypto_tfm *tfm)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief initialize md5 hmac context
* \param tfm linux crypto algo transform
*/
* \brief initialize md5 hmac context
* \param tfm linux crypto algo transform
*/
static int md5_hmac_init(struct shash_desc *desc)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm);
mctx->dbn = 0; //dbn workaround
mctx->started = 0;
@@ -189,21 +189,21 @@ static int md5_hmac_init(struct shash_desc *desc)
return 0;
}
/*! \fn void md5_hmac_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief on-the-fly md5 hmac computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
* \brief on-the-fly md5 hmac computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
static int md5_hmac_update(struct shash_desc *desc, const u8 *data, unsigned int len)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm);
const u32 avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f);
mctx->byte_count += len;
if (avail > len) {
memcpy((char *)mctx->block + (sizeof(mctx->block) - avail),
data, len);
@@ -225,15 +225,15 @@ static int md5_hmac_update(struct shash_desc *desc, const u8 *data, unsigned int
}
memcpy(mctx->block, data, len);
return 0;
return 0;
}
/*! \fn static int md5_hmac_final(struct crypto_tfm *tfm, u8 *out)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief call md5_hmac_final_impl with hash_final true
* \param tfm linux crypto algo transform
* \param out final md5 hmac output value
*/
* \brief call md5_hmac_final_impl with hash_final true
* \param tfm linux crypto algo transform
* \param out final md5 hmac output value
*/
static int md5_hmac_final(struct shash_desc *desc, u8 *out)
{
return md5_hmac_final_impl(desc, out, true);
@@ -241,11 +241,11 @@ static int md5_hmac_final(struct shash_desc *desc, u8 *out)
/*! \fn static int md5_hmac_final_impl(struct crypto_tfm *tfm, u8 *out, bool hash_final)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief compute final or intermediate md5 hmac value
* \param tfm linux crypto algo transform
* \param out final md5 hmac output value
* \param in finalize or intermediate processing
*/
* \brief compute final or intermediate md5 hmac value
* \param tfm linux crypto algo transform
* \param out final md5 hmac output value
* \param in finalize or intermediate processing
*/
static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final)
{
struct md5_hmac_ctx *mctx = crypto_shash_ctx(desc->tfm);
@@ -268,7 +268,7 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
}
memset(p, 0, padding);
mctx->block[14] = le32_to_cpu((mctx->byte_count + 64) << 3); // need to add 512 bit of the IPAD operation
mctx->block[14] = le32_to_cpu((mctx->byte_count + 64) << 3); // need to add 512 bit of the IPAD operation
mctx->block[15] = 0x00000000;
md5_hmac_transform(desc, mctx->block);
@@ -280,15 +280,15 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
md5_hmac_setkey_hw(mctx->key, mctx->keylen);
//printk("\ndbn = %d\n", mctx->dbn);
//printk("\ndbn = %d\n", mctx->dbn);
if (hash_final) {
hashs->DBN = mctx->dbn;
} else {
hashs->DBN = mctx->dbn + 5;
}
asm("sync");
*IFX_HASH_CON = 0x0703002D; //khs, go, init, ndc, endi, kyue, hmen, md5
*IFX_HASH_CON = 0x0703002D; //khs, go, init, ndc, endi, kyue, hmen, md5
//wait for processing
while (hashs->controlr.BSY) {
@@ -317,7 +317,7 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
while (hashs->controlr.BSY) {
// this will not take long
}
in += 16;
}
@@ -374,7 +374,7 @@ 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 = {
@@ -399,8 +399,8 @@ static struct shash_alg ifxdeu_md5_hmac_alg = {
/*! \fn int ifxdeu_init_md5_hmac (void)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief initialize md5 hmac driver
*/
* \brief initialize md5 hmac driver
*/
int ifxdeu_init_md5_hmac (void)
{
@@ -420,8 +420,8 @@ md5_hmac_err:
/** \fn void ifxdeu_fini_md5_hmac (void)
* \ingroup IFX_MD5_HMAC_FUNCTIONS
* \brief unregister md5 hmac driver
*/
* \brief unregister md5 hmac driver
*/
void ifxdeu_fini_md5_hmac (void)
{
crypto_unregister_shash(&ifxdeu_md5_hmac_alg);

View File

@@ -92,10 +92,10 @@ extern int disable_deudma;
/*! \fn static void sha1_transform1 (u32 *state, const u32 *in)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief main interface to sha1 hardware
* \param state current state
* \param in 64-byte block of input
*/
* \brief main interface to sha1 hardware
* \param state current state
* \param in 64-byte block of input
*/
static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
{
int i = 0;
@@ -107,7 +107,7 @@ static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
SHA_HASH_INIT;
/* For context switching purposes, the previous hash output
* is loaded back into the output register
* is loaded back into the output register
*/
if (sctx->started) {
hashs->D1R = *((u32 *) sctx->hash + 0);
@@ -125,9 +125,9 @@ static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
while (hashs->controlr.BSY) {
// this will not take long
}
/* For context switching purposes, the output is saved into a
* context struct which can be used later on
/* For context switching purposes, the output is saved into a
* context struct which can be used later on
*/
*((u32 *) sctx->hash + 0) = hashs->D1R;
*((u32 *) sctx->hash + 1) = hashs->D2R;
@@ -142,13 +142,13 @@ static void sha1_transform1 (struct sha1_ctx *sctx, u32 *state, const u32 *in)
/*! \fn static void sha1_init1(struct crypto_tfm *tfm)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief initialize sha1 hardware
* \param tfm linux crypto algo transform
*/
* \brief initialize sha1 hardware
* \param tfm linux crypto algo transform
*/
static int sha1_init1(struct shash_desc *desc)
{
struct sha1_ctx *sctx = shash_desc_ctx(desc);
sctx->started = 0;
sctx->count = 0;
return 0;
@@ -156,11 +156,11 @@ static int sha1_init1(struct shash_desc *desc)
/*! \fn static void sha1_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief on-the-fly sha1 computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
* \brief on-the-fly sha1 computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
static int sha1_update(struct shash_desc * desc, const u8 *data,
unsigned int len)
{
@@ -188,10 +188,10 @@ static int sha1_update(struct shash_desc * desc, const u8 *data,
/*! \fn static void sha1_final(struct crypto_tfm *tfm, u8 *out)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief compute final sha1 value
* \param tfm linux crypto algo transform
* \param out final md5 output value
*/
* \brief compute final sha1 value
* \param tfm linux crypto algo transform
* \param out final md5 output value
*/
static int sha1_final(struct shash_desc *desc, u8 *out)
{
struct sha1_ctx *sctx = shash_desc_ctx(desc);
@@ -235,7 +235,7 @@ static int sha1_final(struct shash_desc *desc, u8 *out)
return 0;
}
/*
/*
* \brief SHA1 function mappings
*/
static struct shash_alg ifxdeu_sha1_alg = {
@@ -258,8 +258,8 @@ static struct shash_alg ifxdeu_sha1_alg = {
/*! \fn int ifxdeu_init_sha1 (void)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief initialize sha1 driver
*/
* \brief initialize sha1 driver
*/
int ifxdeu_init_sha1 (void)
{
int ret = -ENOSYS;
@@ -278,8 +278,8 @@ sha1_err:
/*! \fn void ifxdeu_fini_sha1 (void)
* \ingroup IFX_SHA1_FUNCTIONS
* \brief unregister sha1 driver
*/
* \brief unregister sha1 driver
*/
void ifxdeu_fini_sha1 (void)
{
crypto_unregister_shash(&ifxdeu_sha1_alg);

View File

@@ -32,7 +32,7 @@
\brief SHA1-HMAC deu driver file
*/
/*!
/*!
\defgroup IFX_SHA1_HMAC_FUNCTIONS IFX_SHA1_HMAC_FUNCTIONS
\ingroup IFX_DEU
\brief ifx sha1 hmac functions
@@ -67,7 +67,7 @@
#define SHA1_BLOCK_WORDS 16
#define SHA1_HASH_WORDS 5
#define SHA1_HMAC_BLOCK_SIZE 64
#define SHA1_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround
#define SHA1_HMAC_DBN_TEMP_SIZE 1024 // size in dword, needed for dbn workaround
#define HASH_START IFX_HASH_CON
#define SHA1_HMAC_MAX_KEYLEN 64
@@ -99,10 +99,10 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
/*! \fn static void sha1_hmac_transform(struct crypto_tfm *tfm, u32 const *in)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief save input block to context
* \param tfm linux crypto algo transform
* \param in 64-byte block of input
*/
* \brief save input block to context
* \param tfm linux crypto algo transform
* \param in 64-byte block of input
*/
static int sha1_hmac_transform(struct shash_desc *desc, u32 const *in)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(desc->tfm);
@@ -121,11 +121,11 @@ static int sha1_hmac_transform(struct shash_desc *desc, u32 const *in)
/*! \fn int sha1_hmac_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief sets sha1 hmac key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
* \brief sets sha1 hmac key
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int sha1_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(tfm);
@@ -157,16 +157,16 @@ static int sha1_hmac_setkey(struct crypto_shash *tfm, const u8 *key, unsigned in
/*! \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
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
* \brief sets sha1 hmac key into hw registers
* \param tfm linux crypto algo transform
* \param key input key
* \param keylen key length greater than 64 bytes IS NOT SUPPORTED
*/
static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen)
{
volatile struct deu_hash_t *hash = (struct deu_hash_t *) HASH_START;
int i, j;
u32 *in_key = (u32 *)key;
u32 *in_key = (u32 *)key;
j = 0;
@@ -175,7 +175,7 @@ static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen)
{
hash->KIDX = j;
asm("sync");
hash->KEY = *((u32 *) in_key + j);
hash->KEY = *((u32 *) in_key + j);
j++;
}
@@ -184,9 +184,9 @@ static int sha1_hmac_setkey_hw(const u8 *key, unsigned int keylen)
/*! \fn void sha1_hmac_init(struct crypto_tfm *tfm)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief initialize sha1 hmac context
* \param tfm linux crypto algo transform
*/
* \brief initialize sha1 hmac context
* \param tfm linux crypto algo transform
*/
static int sha1_hmac_init(struct shash_desc *desc)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(desc->tfm);
@@ -201,11 +201,11 @@ static int sha1_hmac_init(struct shash_desc *desc)
/*! \fn static void sha1_hmac_update(struct crypto_tfm *tfm, const u8 *data, unsigned int len)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief on-the-fly sha1 hmac computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
* \brief on-the-fly sha1 hmac computation
* \param tfm linux crypto algo transform
* \param data input data
* \param len size of input data
*/
static int sha1_hmac_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
@@ -234,10 +234,10 @@ static int sha1_hmac_update(struct shash_desc *desc, const u8 *data,
/*! \fn static int sha1_hmac_final(struct crypto_tfm *tfm, u8 *out)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief call sha1_hmac_final_impl with hash_final true
* \param tfm linux crypto algo transform
* \param out final sha1 hmac output value
*/
* \brief call sha1_hmac_final_impl with hash_final true
* \param tfm linux crypto algo transform
* \param out final sha1 hmac output value
*/
static int sha1_hmac_final(struct shash_desc *desc, u8 *out)
{
return sha1_hmac_final_impl(desc, out, true);
@@ -245,11 +245,11 @@ static int sha1_hmac_final(struct shash_desc *desc, u8 *out)
/*! \fn static int sha1_hmac_final_impl(struct crypto_tfm *tfm, u8 *out, bool hash_final)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief ompute final or intermediate sha1 hmac value
* \param tfm linux crypto algo transform
* \param out final sha1 hmac output value
* \param in finalize or intermediate processing
*/
* \brief ompute final or intermediate sha1 hmac value
* \param tfm linux crypto algo transform
* \param out final sha1 hmac output value
* \param in finalize or intermediate processing
*/
static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final)
{
struct sha1_hmac_ctx *sctx = crypto_shash_ctx(desc->tfm);
@@ -304,7 +304,7 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
asm("sync");
//for vr9 change, ENDI = 1
*IFX_HASH_CON = HASH_CON_VALUE;
*IFX_HASH_CON = HASH_CON_VALUE;
//wait for processing
while (hashs->controlr.BSY) {
@@ -334,7 +334,7 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
while (hashs->controlr.BSY) {
// this will not take long
}
in += 16;
}
@@ -395,7 +395,7 @@ static void sha1_hmac_exit_tfm(struct crypto_tfm *tfm)
kfree(sctx->desc);
}
/*
/*
* \brief SHA1_HMAC function mappings
*/
@@ -421,8 +421,8 @@ 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
*/
* \brief initialize sha1 hmac driver
*/
int ifxdeu_init_sha1_hmac (void)
{
int ret = -ENOSYS;
@@ -442,8 +442,8 @@ sha1_err:
/*! \fn void ifxdeu_fini_sha1_hmac (void)
* \ingroup IFX_SHA1_HMAC_FUNCTIONS
* \brief unregister sha1 hmac driver
*/
* \brief unregister sha1 hmac driver
*/
void ifxdeu_fini_sha1_hmac (void)
{

View File

@@ -6,7 +6,7 @@
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
*/

View File

@@ -172,7 +172,7 @@ static void ptm_setup(struct net_device *dev, int ndev)
static struct net_device_stats *ptm_get_stats(struct net_device *dev)
{
struct net_device_stats *s;
if ( dev != g_net_dev[0] )
return NULL;
s = &g_ptm_priv_data.itf[0].stats;

View File

@@ -1,21 +1,21 @@
/*
LzmaDecode.c
LZMA Decoder (optimized for Speed version)
LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
http://www.7-zip.org/
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this Code, expressly permits you to
statically or dynamically link your Code (or bind by name) to the
interfaces of this file without subjecting your linked Code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@@ -46,7 +46,7 @@
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
#endif
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
@@ -57,9 +57,9 @@
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
{ UpdateBit0(p); mi <<= 1; A0; } else \
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
{ int i = numLevels; res = 1; \
@@ -82,7 +82,7 @@
#define LenLow (LenChoice2 + 1)
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
#define kNumStates 12
@@ -168,7 +168,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int lc = vs->Properties.lc;
#ifdef _LZMA_OUT_READ
UInt32 Range = vs->Range;
UInt32 Code = vs->Code;
#ifdef _LZMA_IN_CB
@@ -210,7 +210,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
UInt32 i;
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
p[i] = kBitModelTotal >> 1;
rep0 = rep1 = rep2 = rep3 = 1;
state = 0;
globalPos = 0;
@@ -261,7 +261,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
for (i = 0; i < numProbs; i++)
p[i] = kBitModelTotal >> 1;
}
#ifdef _LZMA_IN_CB
RC_INIT;
#else
@@ -275,7 +275,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
CProb *prob;
UInt32 bound;
int posState = (int)(
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@@ -287,9 +287,9 @@ int LzmaDecode(CLzmaDecoderState *vs,
{
int symbol = 1;
UpdateBit0(prob)
prob = p + Literal + (LZMA_LIT_SIZE *
prob = p + Literal + (LZMA_LIT_SIZE *
(((
(nowPos
(nowPos
#ifdef _LZMA_OUT_READ
+ globalPos
#endif
@@ -338,7 +338,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
else if (state < 10) state -= 3;
else state -= 6;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRep + state;
@@ -365,14 +365,14 @@ int LzmaDecode(CLzmaDecoderState *vs,
UInt32 pos;
#endif
UpdateBit0(prob);
#ifdef _LZMA_OUT_READ
if (distanceLimit == 0)
#else
if (nowPos == 0)
#endif
return LZMA_RESULT_DATA_ERROR;
state = state < kNumLitStates ? 9 : 11;
#ifdef _LZMA_OUT_READ
pos = dictionaryPos - rep0;
@@ -408,7 +408,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
UpdateBit0(prob);
distance = rep1;
}
else
else
{
UpdateBit1(prob);
prob = p + IsRepG2 + state;
@@ -469,7 +469,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
int posSlot;
state += kNumLitStates;
prob = p + PosSlot +
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
kNumPosSlotBits);
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
if (posSlot >= kStartPosModelIndex)
@@ -524,7 +524,7 @@ int LzmaDecode(CLzmaDecoderState *vs,
len += kMatchMinLen;
#ifdef _LZMA_OUT_READ
if (rep0 > distanceLimit)
if (rep0 > distanceLimit)
#else
if (rep0 > nowPos)
#endif

View File

@@ -1,4 +1,4 @@
/*
/*
LzmaDecode.h
LZMA Decoder interface
@@ -8,14 +8,14 @@
LZMA SDK is licensed under two licenses:
1) GNU Lesser General Public License (GNU LGPL)
2) Common Public License (CPL)
It means that you can select one of these two licenses and
It means that you can select one of these two licenses and
follow rules of that license.
SPECIAL EXCEPTION:
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
Igor Pavlov, as the author of this code, expressly permits you to
statically or dynamically link your code (or bind by name) to the
interfaces of this file without subjecting your linked code to the
terms of the CPL or GNU LGPL. Any modifications or additions
to this file, however, are subject to the LGPL or CPL terms.
*/
@@ -31,7 +31,7 @@
/* Use read function for output data */
/* #define _LZMA_PROB32 */
/* It can increase speed on some 32-bit CPUs,
/* It can increase speed on some 32-bit CPUs,
but memory usage will be doubled in that case */
/* #define _LZMA_LOC_OPT */

View File

@@ -1,5 +1,5 @@
/*
LzmaTypes.h
/*
LzmaTypes.h
Types for LZMA Decoder
@@ -13,12 +13,12 @@ This file is part of LZMA SDK 4.40 (2006-05-01)
#ifndef _7ZIP_BYTE_DEFINED
#define _7ZIP_BYTE_DEFINED
typedef unsigned char Byte;
#endif
#endif
#ifndef _7ZIP_UINT16_DEFINED
#define _7ZIP_UINT16_DEFINED
typedef unsigned short UInt16;
#endif
#endif
#ifndef _7ZIP_UINT32_DEFINED
#define _7ZIP_UINT32_DEFINED
@@ -27,7 +27,7 @@ typedef unsigned long UInt32;
#else
typedef unsigned int UInt32;
#endif
#endif
#endif
/* #define _LZMA_NO_SYSTEM_SIZE_T */
/* You can use it, if you don't want <stddef.h> */

View File

@@ -54,9 +54,9 @@ int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_l
UInt32 outSizeHigh = 0;
SizeT outSizeFull;
unsigned char *outStream;
int waitEOS = 1;
/* waitEOS = 1, if there is no uncompressed size in headers,
int waitEOS = 1;
/* waitEOS = 1, if there is no uncompressed size in headers,
so decoder will wait EOS (End of Stream Marker) in compressed stream */
SizeT compressedSize;
@@ -119,7 +119,7 @@ int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_l
else
outSizeHigh += (UInt32)(b) << ((i - 4) * 8);
}
if (waitEOS)
{
#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE)
@@ -169,7 +169,7 @@ int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_l
inStream = source + rpos;
}
if (state.Probs == 0
if (state.Probs == 0
|| (outStream == 0 && outSizeFull != 0)
|| (inStream == 0 && compressedSize != 0)
)