Re: [PATCH 2/3 v5] crypto: ux500: Add driver for HASH hardware

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

 



On Tue, Apr 10, 2012 at 02:03:45PM +0200, Andreas Westin wrote:
>
> +/**
> + * hash_hw_update - Updates current HASH computation hashing another part of
> + *                  the message.
> + * @req:	Byte array containing the message to be hashed (caller
> + *		allocated).
> + */
> +int hash_hw_update(struct ahash_request *req)
> +{
> +	int ret = 0;
> +	u8 index = 0;
> +	u8 *buffer;
> +	struct hash_device_data *device_data;
> +	u8 *data_buffer;
> +	struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
> +	struct hash_ctx *ctx = crypto_ahash_ctx(tfm);
> +	struct crypto_hash_walk walk;
> +	int msg_length = crypto_hash_walk_first(req, &walk);
> +
> +	/* Empty message ("") is correct indata */
> +	if (msg_length == 0)
> +		return ret;
> +
> +	index = ctx->state.index;
> +	buffer = (u8 *)ctx->state.buffer;

Hmm, if this buffer is written to by the update function, then
this doesn't work because the buffer resides in the tfm which
can be used by multiple entities simultaneously.

All writable data must reside in the request, not the tfm.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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