Re: [PATCH 1/1]: CTR mode implementation

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

 



On Wed, Sep 19, 2007 at 05:51:15PM -0500, Joy Latten wrote:
>
> predictability into my sessions? I could truncate the salt
> in my counter block to 2 bytes and put 2 bytes of the IV for
> blocksizes of 8... does that sound, ok?
> Or am I totally misunderstanding it all?

I suggest that you make these parameters to your CTR template.
So instead of requesting for "ctr(aes)", you could request for
"ctr(aes, 4, 8)" where 4 is the length of the nonce in the
counter block and 8 is the length of the IV.  The counter
itself would then be calculated as block_size - 4 - 8.

> > > +static int crypto_ctr_encrypt(struct blkcipher_desc *desc,
> > > +			      struct scatterlist *dst, struct scatterlist *src,
> > > +			      unsigned int nbytes)
> > > +{
> > > +	struct blkcipher_walk walk;
> > > +	struct crypto_blkcipher *tfm = desc->tfm;
> > > +	struct crypto_ctr_ctx *ctx = crypto_blkcipher_ctx(tfm);
> > > +	struct crypto_cipher *child = ctx->child;
> > > +	u8 *counterblk = ctx->ctrblk;
> > 
> > We need to support simultaneous calls to the same tfm so you
> > need to allocate this somewhere else.  Just use the original
> > IV since it should be of the right length.
> 
> Just to make sure I understand what you meant, you mean just use
> ctx->ctrblk directly?

No I mean that you can't use anything from the ctx as the same
ctx may be used by multiple calls at the same time.  You'd have
to allocate it on the stack or via kmalloc.

Cheers,
-- 
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