Re: [PATCH 3/3] crypto: talitos - Add ahash algorithms (1st cut, digest only)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 15 Mar 2009 20:21:50 -0500
Lee Nipper <lee.nipper@xxxxxxxxx> wrote:

> +	/* first DWORD empty */
> +	desc->ptr[0].len = 0;
> +	desc->ptr[0].ptr = 0;
> +	desc->ptr[0].j_extent = 0;
> +
> +	/* second DWORD empty */
> +	desc->ptr[1].len = 0;
> +	desc->ptr[1].ptr = 0;
> +	desc->ptr[1].j_extent = 0;
> +
> +	/* cipher key */
> +	if (ctx->keylen)
> +		map_single_talitos_ptr(dev, &desc->ptr[2], ctx->keylen,
> +				       (char *)&ctx->key, 0, DMA_TO_DEVICE);
> +	else {
> +		desc->ptr[2].len = 0;
> +		desc->ptr[2].ptr = 0;
> +		desc->ptr[2].j_extent = 0;
> +	}

just

map_single_talitos_ptr(dev, &desc->ptr[2], ctx->keylen,
		       (char *)&ctx->key, 0, DMA_TO_DEVICE);

should do since theoretically the device should ignore pointer entries
with len == 0 and j_extent == 0 (unless you have observed otherwise
practically).

> +	if (sg_count == 1) {
> +		desc->ptr[3].ptr = cpu_to_be32(sg_dma_address(areq->src));
> +	} else {
> +		sg_count = sg_to_link_tbl(areq->src, sg_count, length,
> +					  &edesc->link_tbl[0]);
> +		if (sg_count > 1) {
> +			desc->ptr[3].j_extent |= DESC_PTR_LNKTBL_JUMP;
> +			desc->ptr[3].ptr = cpu_to_be32(edesc->dma_link_tbl);
> +			dma_sync_single_for_device(ctx->dev, edesc->dma_link_tbl,
> +						   edesc->dma_len, DMA_BIDIRECTIONAL);
> +		} else {
> +			/* Only one segment now, so no link tbl needed */
> +			desc->ptr[3].ptr = cpu_to_be32(sg_dma_address(areq->src));
> +		}
> +	}

same readability comment as in prior patch.

> diff --git a/drivers/crypto/talitos.h b/drivers/crypto/talitos.h
> index 575981f..85deb0a 100644
> --- a/drivers/crypto/talitos.h
> +++ b/drivers/crypto/talitos.h
> @@ -162,6 +162,8 @@
>  #define	DESC_HDR_MODE0_MDEU_MD5		cpu_to_be32(0x00200000)
>  #define	DESC_HDR_MODE0_MDEU_SHA256	cpu_to_be32(0x00100000)
>  #define	DESC_HDR_MODE0_MDEU_SHA1	cpu_to_be32(0x00000000)
> +#define	DESC_HDR_MODE0_MDEU_SHA384	cpu_to_be32(0x00000000) /*MDEUB*/
> +#define	DESC_HDR_MODE0_MDEU_SHA512	cpu_to_be32(0x00200000) /*MDEUB*/
>  #define	DESC_HDR_MODE0_MDEU_MD5_HMAC	(DESC_HDR_MODE0_MDEU_MD5 | \
>  					 DESC_HDR_MODE0_MDEU_HMAC)
>  #define	DESC_HDR_MODE0_MDEU_SHA256_HMAC	(DESC_HDR_MODE0_MDEU_SHA256 | \
> @@ -183,6 +185,9 @@
>  #define	DESC_HDR_MODE1_MDEU_MD5		cpu_to_be32(0x00000200)
>  #define	DESC_HDR_MODE1_MDEU_SHA256	cpu_to_be32(0x00000100)
>  #define	DESC_HDR_MODE1_MDEU_SHA1	cpu_to_be32(0x00000000)
> +#define	DESC_HDR_MODE1_MDEU_SHA384	cpu_to_be32(0x00000000) /*MDEUB*/
> +#define	DESC_HDR_MODE1_MDEU_SHA512	cpu_to_be32(0x00000200) /*MDEUB*/

DESC_HDR_MODE0_MDEUB_SHA384 instead of having the comment?

Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux