Re: [PATCH 5/5] crypto: michael_mic - Switch to shash

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

 



On Tue, Dec 02, 2008 at 11:38:34PM +0100, Adrian-Ken Rueegsegger wrote:
> This patch changes michael_mic to the  new shash interface.
> 
> Signed-off-by: Adrian-Ken Rueegsegger <ken@xxxxxxxxxxx>

I've applied patches 1-4.

> -static int michael_setkey(struct crypto_tfm *tfm, const u8 *key,
> +static int michael_setkey(struct crypto_shash *tfm, const u8 *key,
>  			  unsigned int keylen)
>  {
> -	struct michael_mic_ctx *mctx = crypto_tfm_ctx(tfm);
> +	struct michael_mic_ctx *mctx = crypto_shash_ctx(tfm);
>  	const __le32 *data = (const __le32 *)key;
>  
>  	if (keylen != 8) {
> -		tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
> +		crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
>  		return -EINVAL;
>  	}

This looks broken though.  michael_mic is one of the few hashes
with a setkey function.  So you need to model it after crc32c
rather than the others.

In particular, you'll need to split the context structure between
the key part and the descritptor part.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <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