an XTS blockcipher mode implementation without partial blocks
PATCH 1/1 an XTS blockcipher mode implementation without partial blocks
XTS currently considered to be the successor of the LRW mode by the IEEE1619 workgroup. LRW was discarded, because it was not secure if the encyption key itself is encrypted with LRW.
XTS does not have this problem. The implementation is pretty straightforward, a new function was added to gf128mul to handle GF(128) elements in ble format. Four testvectors from the specification
http://grouper.ieee.org/groups/1619/email/pdf00086.pdf
were added, and they verify on my system.
--- crypto/Kconfig | 11 ++ crypto/Makefile | 1 + crypto/gf128mul.c | 11 ++ crypto/tcrypt.c | 12 ++ crypto/tcrypt.h | 417 +++++++++++++++++++++++++++++++++++++++++++++ crypto/xts.c | 277 ++++++++++++++++++++++++++++++ include/crypto/gf128mul.h | 2 + 7 files changed, 731 insertions(+), 0 deletions(-) create mode 100644 crypto/xts.c
crypto/Kconfig +11 -0
@@ -183,6 +183,17 @@ config CRYPTO_LRW The first 128, 192 or 256 bits in the key are used for AES and the rest is used to tie each cipher block to its logical position. +config CRYPTO_XTS + tristate "XTS support (EXPERIMENTAL)" + depends on EXPERIMENTAL + select CRYPTO_BLKCIPHER + select CRYPTO_MANAGER + select CRYPTO_GF128MUL + help + XTS: IEEE1619/D16 narrow block cipher use with aes-xts-plain, + key size 256, 384 or 512 bits. This implementation currently + can't handle a sectorsize which is not a multiple of 16 bytes. + config CRYPTO_CRYPTD tristate "Software async crypto daemon" select CRYPTO_ABLKCIPHER
crypto/Makefile +1 -0
@@ -30,6 +30,7 @@ obj-$(CONFIG_CRYPTO_ECB) += ecb.o obj-$(CONFIG_CRYPTO_CBC) += cbc.o obj-$(CONFIG_CRYPTO_PCBC) += pcbc.o obj-$(CONFIG_CRYPTO_LRW) += lrw.o +obj-$(CONFIG_CRYPTO_XTS) += xts.o obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o obj-$(CONFIG_CRYPTO_DES) += des.o obj-$(CONFIG_CRYPTO_FCRYPT) += fcrypt.o
crypto/gf128mul.c +11 -0
@@ -142,6 +142,17 @@ static void gf128mul_x_bbe(be128 *r, const be128 *x) r->b =cpu_to_be64 ((b <<1 ) ^ _tt); } +void gf128mul_x_ble (be128 *r,const be128 *x) +{ +u64 a =le64_to_cpu (x->a); +u64 b =le64_to_cpu (x->b); +u64 _tt = gf128mul_table_bbe[b >>63 ]; + + r->a =cpu_to_le64 ((a <<1 ) ^ _tt); + r->b =cpu_to_le64 ((b <<1 ) | (a >>63 )); +} +EXPORT_SYMBOL (gf128mul_x_ble); +static void gf128mul_x8_lle (be128 *x) {u64 a =be64_to_cpu (x->a);
crypto/tcrypt.c +12 -0
@@ -955,6 +955,10 @@ static void do_test(void) AES_LRW_ENC_TEST_VECTORS);test_cipher ("lrw(aes)" ,DECRYPT , aes_lrw_dec_tv_template,AES_LRW_DEC_TEST_VECTORS ); +test_cipher ("xts(aes)" ,ENCRYPT , aes_xts_enc_tv_template, +AES_XTS_ENC_TEST_VECTORS ); +test_cipher ("xts(aes)" ,DECRYPT , aes_xts_dec_tv_template, +AES_XTS_DEC_TEST_VECTORS );//CAST5 test_cipher("ecb(cast5)", ENCRYPT, cast5_enc_tv_template,
@@ -1132,6 +1136,10 @@ static void do_test(void) AES_LRW_ENC_TEST_VECTORS);test_cipher ("lrw(aes)" ,DECRYPT , aes_lrw_dec_tv_template,AES_LRW_DEC_TEST_VECTORS ); +test_cipher ("xts(aes)" ,ENCRYPT , aes_xts_enc_tv_template, +AES_XTS_ENC_TEST_VECTORS ); +test_cipher ("xts(aes)" ,DECRYPT , aes_xts_dec_tv_template, +AES_XTS_DEC_TEST_VECTORS );break ;case 11 :
@@ -1307,6 +1315,10 @@ static void do_test(void) aes_lrw_speed_template);test_cipher_speed ("lrw(aes)" ,DECRYPT , sec,NULL ,0 , aes_lrw_speed_template); +test_cipher_speed ("xts(aes)" ,ENCRYPT , sec,NULL ,0 , + aes_xts_speed_template); +test_cipher_speed ("xts(aes)" ,DECRYPT , sec,NULL ,0 , + aes_xts_speed_template);break ;case 201 :
crypto/tcrypt.h +417 -0
435 lines not on this page · raw message
crypto/xts.c new file +277 -0
277 lines not on this page · raw message
include/crypto/gf128mul.h +2 -0
@@ -161,6 +161,8 @@ void gf128mul_lle(be128 *a, const be128 *b);void gf128mul_bbe (be128 *a,const be128 *b); +/* multiply by x in ble format, needed by XTS */ +void gf128mul_x_ble (be128 *a,const be128 *b);/* 4k table optimization */
Signature · 1 line
1.5.2.5
Quoted 43 lines · * Rik Snel | 2007-09-03 23:45:16 [+0200]:
crypto/xts.c new file +37
-0@@ -0,0 +1,277 @@ +/* XTS: as defined in IEEE1619/D16 +* http://grouper.ieee.org/groups/1619/email/pdf00086.pdf +* (sector sizes which are not a multiple of 16 bytes are, +* however currently unsupported) +* +* Copyright (c) 2007 Rik Snel <[email protected]> +* +* Based om ecb.c +* Copyright (c) 2006 Herbert Xu <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the Free +* Software Foundation; either version 2 of the License, or (at your option) +* any later version. +*/ +#include <crypto/algapi.h> +#include <linux/err.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/scatterlist.h> +#include <linux/slab.h> + +#include <crypto/b128ops.h> +#include <crypto/gf128mul.h> + +struct priv { +struct crypto_cipher *child; +struct crypto_cipher *tweak; +}; + +static int setkey (struct crypto_tfm *parent,const u8 *key, +unsigned int keylen) +{ +struct priv *ctx =crypto_tfm_ctx (parent); +struct crypto_cipher *child = ctx->tweak; +u32 *flags = &parent->crt_flags;
crypto/xts.c line 47
Quoted 10 lines
crypto/xts.c new file +10
-0+int err; + +/* key consists of keys of equal size concatenated, therefore +* the length must be even */ +if (keylen %2 ) { +/* does anyone read this flag, it is not set if key setup +* fails below (or is it?) */ + *flags |=CRYPTO_TFM_RES_BAD_KEY_LEN ; +return -EINVAL ; + }
A algo user might read this.
crypto/xts.c line 58
Quoted 11 lines
crypto/xts.c new file +11
-0+ +/* we need two cipher instances: one to compute the inital 'tweak' +* by encrypting the IV (usually the 'plain' iv) and the other +* one to encrypt and decrypt the data */ + +/* tweak cipher, uses Key2 i.e. the second half of *key */ +crypto_cipher_clear_flags (child,CRYPTO_TFM_REQ_MASK ); +crypto_cipher_set_flags (child,crypto_tfm_get_flags (parent) & +CRYPTO_TFM_REQ_MASK ); +if ((err =crypto_cipher_setkey (child, key + keylen/2 , keylen/2 ))) +return err;
why not
err = crypto_cipher_setkey(child, key + keylen/2, keylen/2); if (err) return err;
Quoted 10 lines
crypto/xts.c new file +10
-0+crypto_tfm_set_flags (parent,crypto_cipher_get_flags (child) & +CRYPTO_TFM_RES_MASK ); + + child = ctx->child; + +/* data cipher, uses Key1 i.e. the first half of *key */ +crypto_cipher_clear_flags (child,CRYPTO_TFM_REQ_MASK ); +crypto_cipher_set_flags (child,crypto_tfm_get_flags (parent) & +CRYPTO_TFM_REQ_MASK ); +if ((err =crypto_cipher_setkey (child, key, keylen/2 )))
...
Quoted 38 lines
crypto/xts.c new file +38
-0+return err; +crypto_tfm_set_flags (parent,crypto_cipher_get_flags (child) & +CRYPTO_TFM_RES_MASK ); + +return 0 ; +} + +struct sinfo { +be128 t; +struct crypto_tfm *tfm; +void (*fn)(struct crypto_tfm *,u8 *,const u8 *); +}; + +static inline void xts_round (struct sinfo *s,void *dst,const void *src) +{ +be128_xor (dst, &s->t, src);/* PP <- T xor P */ + s->fn (s->tfm, dst, dst);/* CC <- E(Key1,PP) */ +be128_xor (dst, dst, &s->t);/* C <- T xor CC */ +} + +static int crypt (struct blkcipher_desc *d, +struct blkcipher_walk *w,struct priv *ctx, +void (*tw)(struct crypto_tfm *,u8 *,const u8 *), +void (*fn)(struct crypto_tfm *,u8 *,const u8 *)) +{ +int err; +unsigned int avail; +const int bs =crypto_cipher_blocksize (ctx->child); +struct sinfo s = { + .tfm =crypto_cipher_tfm (ctx->child), + .fn = fn + }; +be128 *iv; +u8 *wsrc; +u8 *wdst; + + err =blkcipher_walk_virt (d, w); +if (!(avail = w->nbytes))
...
Quoted 6 lines
crypto/xts.c new file +6
-0+return err; + + wsrc = w->src.virt.addr; + wdst = w->dst.virt.addr; + +/* calculate first value of T */
crypto/xts.c line 122
Quoted 10 lines
crypto/xts.c new file +10
-0+ iv = (be128 *)w->iv; +tw (crypto_cipher_tfm (ctx->tweak), (void *)&s.t, w->iv); + + goto first; + +for (;;) { + do { + gf128mul_x_ble(&s.t, &s.t); + +first:
why not
int first = 0;
...
do {
if (!first) {
gf128mul_x_ble(&s.t, &s.t);
first = 1;
}The compiler should generate similar code.
crypto/xts.c line 130
Quoted 8 lines
crypto/xts.c new file +8
-0+xts_round (&s, wdst, wsrc); + + wsrc += bs; + wdst += bs; + }while ((avail -= bs) >= bs); + + err =blkcipher_walk_done (d, w, avail); +if (!(avail = w->nbytes))
avail = w->nbytes; if (!avail)
Quoted 43 lines
crypto/xts.c new file +43
-0+break ; + + wsrc = w->src.virt.addr; + wdst = w->dst.virt.addr; + } + +return err; +} + +static int encrypt (struct blkcipher_desc *desc,struct scatterlist *dst, +struct scatterlist *src,unsigned int nbytes) +{ +struct priv *ctx =crypto_blkcipher_ctx (desc->tfm); +struct blkcipher_walk w; + +blkcipher_walk_init (&w, dst, src, nbytes); +return crypt (desc, &w, ctx,crypto_cipher_alg (ctx->tweak)->cia_encrypt, +crypto_cipher_alg (ctx->child)->cia_encrypt); +} + +static int decrypt (struct blkcipher_desc *desc,struct scatterlist *dst, +struct scatterlist *src,unsigned int nbytes) +{ +struct priv *ctx =crypto_blkcipher_ctx (desc->tfm); +struct blkcipher_walk w; + +blkcipher_walk_init (&w, dst, src, nbytes); +return crypt (desc, &w, ctx,crypto_cipher_alg (ctx->tweak)->cia_encrypt, +crypto_cipher_alg (ctx->child)->cia_decrypt); +} + +static int init_tfm (struct crypto_tfm *tfm) +{ +struct crypto_cipher *cipher; +struct crypto_instance *inst = (void *)tfm->__crt_alg; +struct crypto_spawn *spawn =crypto_instance_ctx (inst); +struct priv *ctx =crypto_tfm_ctx (tfm); +u32 *flags = &tfm->crt_flags; + + cipher =crypto_spawn_cipher (spawn); +if (IS_ERR (cipher)) +return PTR_ERR (cipher); +
crypto/xts.c line 183
Quoted 10 lines
crypto/xts.c new file +10
-0+if (crypto_cipher_blocksize (cipher) !=16 ) { + *flags |=CRYPTO_TFM_RES_BAD_BLOCK_LEN ; +return -EINVAL ; + } + + ctx->child = cipher; + + cipher =crypto_spawn_cipher (spawn); +if (IS_ERR (cipher)) +return PTR_ERR (cipher);
don't you want to free ctx->child on error?
crypto/xts.c line 189
Quoted 6 lines
crypto/xts.c new file +6
-0+ +/* this check isn't really needed */ +if (crypto_cipher_blocksize (cipher) !=16 ) { + *flags |=CRYPTO_TFM_RES_BAD_BLOCK_LEN ; +return -EINVAL ; + }
and here both.
Right now you should get the same algo but I don't thing that a check will hurt.
Quoted 32 lines
crypto/xts.c new file +32
-0+ + ctx->tweak = cipher; + +return 0 ; +} + +static void exit_tfm (struct crypto_tfm *tfm) +{ +struct priv *ctx =crypto_tfm_ctx (tfm); +crypto_free_cipher (ctx->child); +crypto_free_cipher (ctx->tweak); +} + +static struct crypto_instance *alloc (struct rtattr **tb) +{ +struct crypto_instance *inst; +struct crypto_alg *alg; +int err; + + err =crypto_check_attr_type (tb,CRYPTO_ALG_TYPE_BLKCIPHER ); +if (err) +return ERR_PTR (err); + + alg =crypto_get_attr_alg (tb,CRYPTO_ALG_TYPE_CIPHER , +CRYPTO_ALG_TYPE_MASK ); +if (IS_ERR (alg)) +return ERR_PTR (PTR_ERR (alg)); + + inst =crypto_alloc_instance ("xts" , alg); +if (IS_ERR (inst)) + goto out_put_alg; +
crypto/xts.c line 231
Quoted 10 lines
crypto/xts.c new file +10
-0+ inst->alg.cra_flags =CRYPTO_ALG_TYPE_BLKCIPHER ; + inst->alg.cra_priority = alg->cra_priority; + inst->alg.cra_blocksize = alg->cra_blocksize; + +if (alg->cra_alignmask <7 ) inst->alg.cra_alignmask =7 ; +else inst->alg.cra_alignmask = alg->cra_alignmask; + inst->alg.cra_type = &crypto_blkcipher_type; + +if (!(alg->cra_blocksize %4 )) + inst->alg.cra_alignmask |=3 ;
please do
if (a)
do_on_a();
else
do_on_b();
besides that, what are you trying to do? The if() makes sure that the alignmask is atleast 7 (0b111). And then, depending on the block size you might set the lower two bits (3 is 0b11) which are allready set.
crypto/xts.c line 234
Quoted 3 lines
crypto/xts.c new file +3
-0+ inst->alg.cra_blkcipher.ivsize = alg->cra_blocksize; + inst->alg.cra_blkcipher.min_keysize =2 *alg->cra_cipher.cia_min_keysize; + inst->alg.cra_blkcipher.max_keysize =2 *alg->cra_cipher.cia_max_keysize;
a space between the operator might not be a bad idea.
Quoted 33 lines
crypto/xts.c new file +33
-0+ + inst->alg.cra_ctxsize =sizeof (struct priv ); + + inst->alg.cra_init = init_tfm; + inst->alg.cra_exit = exit_tfm; + + inst->alg.cra_blkcipher.setkey = setkey; + inst->alg.cra_blkcipher.encrypt = encrypt; + inst->alg.cra_blkcipher.decrypt = decrypt; + +out_put_alg: +crypto_mod_put (alg); +return inst; +} + +static void free (struct crypto_instance *inst) +{ +crypto_drop_spawn (crypto_instance_ctx (inst)); +kfree (inst); +} + +static struct crypto_template crypto_tmpl = { + .name ="xts" , + .alloc = alloc, + .free = free, + .module =THIS_MODULE , +}; + +static int __init crypto_module_init (void ) +{ +return crypto_register_template (&crypto_tmpl); +} +
crypto/xts.c line 277
Quoted 10 lines
crypto/xts.c new file +10
-0+static void __exit crypto_module_exit(void) +{ +crypto_unregister_template (&crypto_tmpl); +} + +module_init (crypto_module_init); +module_exit (crypto_module_exit); + +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("XTS block cipher mode" );
The other things are looking fine to me. You might want to consider using ./scripts/checkpatch.pl on your patch the next time :)
Sebastian
Hello Sebastian,
Thanks for your review of the patch. I will address your points below.
Quoted 12 lines · Sebastian Siewior
Quoted 1 line
crypto/xts.c +0
-0[...]
crypto/xts.c line 47
Quoted 8 lines
crypto/xts.c +8
-0+/* key consists of keys of equal size concatenated, therefore +* the length must be even */ +if (keylen %2 ) { +/* does anyone read this flag, it is not set if key setup +* fails below (or is it?) */ + *flags |=CRYPTO_TFM_RES_BAD_KEY_LEN ; +return -EINVAL ; + }A algo user might read this.
Ok. I see that the error flags from the keysetup below are also copied to the flags..., will update comment.
Quoted 14 lines
crypto/xts.c line 58
Quoted 12 lines
crypto/xts.c +11
-0+ +/* we need two cipher instances: one to compute the inital 'tweak' +* by encrypting the IV (usually the 'plain' iv) and the other +* one to encrypt and decrypt the data */ + +/* tweak cipher, uses Key2 i.e. the second half of *key */ +crypto_cipher_clear_flags (child,CRYPTO_TFM_REQ_MASK ); +crypto_cipher_set_flags (child,crypto_tfm_get_flags (parent) & +CRYPTO_TFM_REQ_MASK ); +if ((err =crypto_cipher_setkey (child, key + keylen/2 , keylen/2 ))) +return err;why not
Quoted 3 lines
err = crypto_cipher_setkey(child, key + keylen/2, keylen/2); if (err) return err;
Ok, I can see that it probably goes against the 'multiple statements on a single line' rules in CodingStyle, will change.
Quoted 11 lines
Quoted 10 lines
crypto/xts.c +10
-0+crypto_tfm_set_flags (parent,crypto_cipher_get_flags (child) & +CRYPTO_TFM_RES_MASK ); + + child = ctx->child; + +/* data cipher, uses Key1 i.e. the first half of *key */ +crypto_cipher_clear_flags (child,CRYPTO_TFM_REQ_MASK ); +crypto_cipher_set_flags (child,crypto_tfm_get_flags (parent) & +CRYPTO_TFM_REQ_MASK ); +if ((err =crypto_cipher_setkey (child, key, keylen/2 )))...
Copypaste from above...
Quoted 4 lines
Quoted 3 lines
[...]
crypto/xts.c +2
-0+ err =blkcipher_walk_virt (d, w); +if (!(avail = w->nbytes))...
Ok.
Quoted 22 lines
Quoted 6 lines
crypto/xts.c +6
-0+return err; + + wsrc = w->src.virt.addr; + wdst = w->dst.virt.addr; + +/* calculate first value of T */ crypto/xts.c line 122
Quoted 10 lines
crypto/xts.c +10
-0+ iv = (be128 *)w->iv; +tw (crypto_cipher_tfm (ctx->tweak), (void *)&s.t, w->iv); + + goto first; + +for (;;) { + do { + gf128mul_x_ble(&s.t, &s.t); + +first:why not
int first = 0;
...
do {
Quoted 6 lines
if (!first) { gf128mul_x_ble(&s.t, &s.t); first = 1; }The compiler should generate similar code.
I'd rather tell the compiler what I want than to introduce a new local variable and a conditional branch in the hope that the compiler will optimize it away, just to avoid a goto.
If you insist on getting rid of the goto, I could unroll the first iteration of the loop by hand. (when is submitted lrw.c it had the first iteration unrolled; Herbert replaced it with this goto)
Quoted 12 lines
crypto/xts.c line 130
Quoted 8 lines
crypto/xts.c +8
-0+xts_round (&s, wdst, wsrc); + + wsrc += bs; + wdst += bs; + }while ((avail -= bs) >= bs); + + err =blkcipher_walk_done (d, w, avail); +if (!(avail = w->nbytes))avail = w->nbytes; if (!avail)
Ok.
Quoted 5 lines
Quoted 5 lines
[...]
crypto/xts.c +4
-0+if (crypto_cipher_blocksize (cipher) !=16 ) { + *flags |=CRYPTO_TFM_RES_BAD_BLOCK_LEN ; +return -EINVAL ; + }
Quoted 8 lines
crypto/xts.c line 183
Quoted 6 lines
crypto/xts.c +6
-0+ + ctx->child = cipher; + + cipher =crypto_spawn_cipher (spawn); +if (IS_ERR (cipher)) +return PTR_ERR (cipher);don't you want to free
ctx->childon error?
Yes, of course. Fixed.
Quoted 8 lines
crypto/xts.c line 189
Quoted 6 lines
crypto/xts.c +6
-0+ +/* this check isn't really needed */ +if (crypto_cipher_blocksize (cipher) !=16 ) { + *flags |=CRYPTO_TFM_RES_BAD_BLOCK_LEN ; +return -EINVAL ; + }and here both.
Fixed.
Quoted 2 lines
Right now you should get the same algo but I don't thing that a check will hurt.
Agree.
Quoted 10 lines
crypto/xts.c line 231
Quoted 7 lines
[...]
crypto/xts.c +6
-0+if (alg->cra_alignmask <7 ) inst->alg.cra_alignmask =7 ; +else inst->alg.cra_alignmask = alg->cra_alignmask; + inst->alg.cra_type = &crypto_blkcipher_type; + +if (!(alg->cra_blocksize %4 )) + inst->alg.cra_alignmask |=3 ;please do
Quoted 4 lines
if (a)
do_on_a();
else
do_on_b();
Ok.
Quoted 3 lines
besides that, what are you trying to do? The
if()makes sure that the alignmask is atleast 7 (0b111). And then, depending on the block size you might set the lower two bits (3 is 0b11) which are allready set.
Mmmm, I don't know why I did that. It is probably safe to assume that alg->cra_alignmask = 2^n - 1 for some n, so I will remove the second if.
Quoted 5 lines
crypto/xts.c line 234
Quoted 3 lines
crypto/xts.c +3
-0+ inst->alg.cra_blkcipher.ivsize = alg->cra_blocksize; + inst->alg.cra_blkcipher.min_keysize =2 *alg->cra_cipher.cia_min_keysize; + inst->alg.cra_blkcipher.max_keysize =2 *alg->cra_cipher.cia_max_keysize;a space between the operator might not be a bad idea.
I wanted it to fit in 80 columns, will change.
Quoted 7 lines
crypto/xts.c line 277
Quoted 4 lines
[...]
crypto/xts.c +2
-0+MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("XTS block cipher mode" );The other things are looking fine to me. You might want to consider using
./scripts/checkpatch.plon your patch the next time :)
I did just that, and it catched a (void*) should be (void *).
Christoph encountered a deadlock after a few hours and 16GB of data (on an aes-xts-plain partition). Assuming there is an error in xts.c, is there an obvious way of finding it?
Is my re-usage of *spawn (in init_tfm) the right way to get two instances of the blockcipher?
A patch which fixes everything except the goto in crypt() will follow.
Greetings,
Rik.
Signature · 1 line
Nothing is ever a total loss; it can always serve as a bad example.
Herbert Xu
maintainerQuoted 4 lines · On Thu, Sep 06, 2007 at 04:57:26PM +0200, [email protected] wrote:
I'd rather tell the compiler what I want than to introduce a new local variable and a conditional branch in the hope that the compiler will optimize it away, just to avoid a goto.
Yes this code looks OK to me.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 9 lines · * [email protected] | 2007-09-06 16:57:26 [+0200]:
Quoted 1 line
The compiler should generate similar code.
I'd rather tell the compiler what I want than to introduce a new local variable and a conditional branch in the hope that the compiler will optimize it away, just to avoid a goto.
If you insist on getting rid of the goto, I could unroll the first iteration of the loop by hand. (when is submitted
lrw.cit had the first iteration unrolled; Herbert replaced it with this goto)
I didn't know that Herbert did it the same way. In that case you are fine :)
Quoted 3 lines
Christoph encountered a deadlock after a few hours and 16GB of data (on an aes-xts-plain partition). Assuming there is an error in
xts.c, is there an obvious way of finding it?
Haven't seen any locks in your code, so your part may be fine. How do I use this?
cryptsetup -c aes-xts
or?
Quoted 3 lines
Greetings,
Rik.
Sebastian
Hello,
Quoted 6 lines · Sebastian Siewior
[...]
Quoted 3 lines
Christoph encountered a deadlock after a few hours and 16GB of data (on an aes-xts-plain partition). Assuming there is an error in
xts.c, is there an obvious way of finding it?
Quoted 6 lines
Haven't seen any locks in your code, so your part may be fine. How do I use this?
cryptsetup -c aes-xts
or?
for example:
cryptsetup --hash sha256 -s 256 -c aes-xts-plain create test /dev/some_partition
The 'plain'-iv should give an on-disk format compatible with the requirements of IEEE1619/D16. Internally the 256-bit key is split in two 128-bit AES keys. Other allowed key sizes for aes-xts-* are 2*192=384 bit and 2*256=512 bit. (you may want to use a hash with more bits (I don't know what cryptsetup does if the hash gives less than keysize bits))
Christoph, is your testing machine stable if you run the same test with aes-lrw-plain and the same keysize?
Greetings,
Rik.
Signature · 1 line
Nothing is ever a total loss; it can always serve as a bad example.