Re: [PATCH] [crypto] XTS: use proper alignment.

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

 



* Herbert Xu | 2008-03-05 19:16:02 [+0800]:

>> +struct sinfo {
>> +	be128 t;
>> +	struct crypto_tfm *tfm;
>> +	void (*fn)(struct crypto_tfm *, u8 *, const u8 *);
>> +};
>> +
>>  struct priv {
>> +	/* s.t being the first member in this struct enforces proper alignment
>> +	 * required by the underlying cipher without explicit knowing the it.
>> +	 */
>> +	struct sinfo s;
>
>tfm objects should be reentrant so you can't store any per-op
>info in the context structure.
I could also do kmalloc(), align() and kfree() after encrypt but this
was faster.

>
>> -	tw(crypto_cipher_tfm(ctx->tweak), (void *)&s.t, w->iv);
>> +	tw(crypto_cipher_tfm(ctx->tweak), (void *)&s->t, w->iv);
>
>However, the real question is why do we need this at all? The
>tw argument should be using the proper entry points that do
>copying for you if necessary.
>
>OK, I see that the issue is that we're using cia_encrypt instead
>of cit_encrypt_one.  So if we just change that then it should work
>correctly.
I'm not sure if we are allowed to modify the IV or if it should
remain untouched. If it is possible to modify it, I could encrypt it
inplace and save two memcpy().
I will check this tonight.

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