preliminary ABL implementation
Subsystems (2)
Hello Herbert/list,
These patches implement the 'Arbitrary Block Length' blockcipher mode as proposed by John Viega and David McGrew in
http://grouper.ieee.org/groups/1619/email/rtf00000.rtf (October 28, 2004) and
http://grouper.ieee.org/groups/1619/email/pdf00005.pdf (April 15, 2004).
The spec is unreviewed. Are there cryptologists on this list who are willing to review the security proof of ABL in the April 15th paper and my implementations (both this one and the "independent" implementation at
http://cube.dyndns.org/~rsnel/abl/).
ABL is the only patent-unencumbered wide block cipher mode that I know. It can encrypt whole 512 byte sectors as whole blocks, this means that if one bit in the unencrypted sector, it changes the corresponding cipherblock completely. It can also operate on 4k blocks (or larger), this is useful for deniable harddisk encryption. (it means all in-filesystem-block modifications look like total block modifications). (operation on 4k block through dm-crypt requires a patch which will be sent seperately)
I have emailed the authors, David McGrew confirmed that ABL is unencumbered by patents (as far as he and John Viega know). David had no test vectors. John might have some, but he hasn't responed yet.
Unfortunately the SISWG (http://siswg.org/) seems to be uninterested in making ABL a standard because another contender (XCF) is faster. XCF is however patented by Cisco.
Greetings,
Rik.
PATCH 1/2 crypto: bewbi IV, big endian wide block count for ABL-32-AES
From: Rik Snel <[email protected]>
ABL-32-AES needs a certain IV. This IV should be provided dm-crypt. The block cipher mode could, in principle, generate the correct IV from the plain IV, but I think that it is cleaner to supply the right IV directly.
The sector -> wide block calculation is currently just a conversion to bigendian and an increment, but if dm-crypt will support cypher blocksizes larger than 512 bytes (which would be interesting for wide blocks) the conversion will include a shift also.
--- drivers/md/dm-crypt.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)
drivers/md/dm-crypt.c +19 -1
@@ -109,6 +109,9 @@ static kmem_cache_t *_crypt_io_pool;* benbi: the 64-bit "big-endian 'narrow block'-count", starting at 1 * (needed for LRW-32-AES and possible other narrow block modes) * +* bewbi: the 64-bit "big-endian 'wide block'-count", starting at 1 +* (needed for ABL-32-AES and possible other wide block modes) +* * plumb: unimplemented, see: * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454 */
@@ -248,6 +251,14 @@ static int crypt_iv_benbi_gen(struct cryreturn 0 ; } +static int crypt_iv_bewbi_gen (struct crypt_config *cc,u8 *iv,sector_t sector) +{ +memset (iv,0 , cc->iv_size -sizeof (u32)); + *((u32 *)iv +3 ) =cpu_to_be32 ((sector &0xffffffff ) +1 ); + +return 0 ; +} +static struct crypt_iv_operations crypt_iv_plain_ops = { .generator = crypt_iv_plain_gen };
@@ -264,6 +275,10 @@ static struct crypt_iv_operations crypt_ .generator = crypt_iv_benbi_gen }; +static struct crypt_iv_operations crypt_iv_bewbi_ops = { + .generator = crypt_iv_bewbi_gen +}; + static int crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, struct scatterlist *in, unsigned int length,
@@ -632,7 +647,8 @@ static int crypt_ctr(struct dm_target *t cc->tfm = tfm;/* -* Choose ivmode. Valid modes: "plain", "essiv:<esshash>", "benbi". +* Choose ivmode. Valid modes: "plain", "essiv:<esshash>", +* "benbi", "bewbi". * * See comments at iv code */
@@ -645,6 +661,8 @@ static int crypt_ctr(struct dm_target *t cc->iv_gen_ops = &crypt_iv_essiv_ops; else if (strcmp(ivmode, "benbi") == 0) cc->iv_gen_ops = &crypt_iv_benbi_ops; + else if (strcmp(ivmode, "bewbi") == 0) + cc->iv_gen_ops = &crypt_iv_bewbi_ops; else { ti->error ="Invalid IV mode" ; goto bad2;
Signature · 1 line
1.4.2.1
PATCH 2/2 ABL, Arbitrary Block Length, a tweakable wide block cipher mode
In reply to Rik SnelFrom: Rik Snel <[email protected]>
This is a preliminary implementation of ABL as specified by David McGrew and John Viega in:
- http://grouper.ieee.org/groups/1619/email/rtf00000.rtf (October 28, 2004)
- http://grouper.ieee.org/groups/1619/email/pdf00005.pdf (April 15, 2004)
Preliminary, because the specification has not been sufficiently reviewed and is subject to change because the two contradict eachother in a few places (see the comments at the top of abl.c).
Currently I have no official test vectors This implementation is only checked against an "independent" and minimal userspace implementation I wrote, which is available at: http://cube.dyndns.org/~rsnel/abl/
I added a self-generated test vector to tcrypt.h and also an ABL specific speed_test_template because this implementation cannot handle input shorter than two blocks. The spec allows it, but I chose not to implement it because it is not needed for harddisk encryption. This implementation also does not handle partial blocks, while the spec allows it.
Please do not use this mode for anything serious yet.
--- crypto/Kconfig | 14 ++ crypto/Makefile | 1 crypto/abl.c | 395 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ crypto/tcrypt.c | 12 ++ crypto/tcrypt.h | 300 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 722 insertions(+), 0 deletions(-)
crypto/Kconfig +14 -0
@@ -169,6 +169,20 @@ config CRYPTO_LRW 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_ABL + tristate "ABL support (EXPERIMENTAL)" + depends on EXPERIMENTAL + select CRYPTO_BLKCIPHER + select CRYPTO_GF128MUL + default n + help + ABL: Arbitrary Block Length, a tweakable, non malleable, non movable + wide block cipher mode. Use it with cipher specification string + aes-lrw-bewbi, the key must be 128, 192 or 256 bits. + + WARNING: The ABL spec is not finalized and still has to be reviewed. + Do not use this mode for anything serious yet. + config CRYPTO_DES tristate "DES and Triple DES EDE cipher algorithms" select CRYPTO_ALGAPI
crypto/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mu obj-$(CONFIG_CRYPTO_ECB) += ecb.o obj-$(CONFIG_CRYPTO_CBC) += cbc.o obj-$(CONFIG_CRYPTO_LRW) += lrw.o +obj-$(CONFIG_CRYPTO_ABL) += abl.o obj-$(CONFIG_CRYPTO_DES) += des.o obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish.o obj-$(CONFIG_CRYPTO_TWOFISH) += twofish.o
crypto/abl.c new file +395 -0
395 lines not on this page · raw message
crypto/tcrypt.c +12 -0
@@ -910,6 +910,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 ("abl(aes)" ,ENCRYPT , aes_abl_enc_tv_template, +AES_ABL_ENC_TEST_VECTORS ); +test_cipher ("abl(aes)" ,DECRYPT , aes_abl_dec_tv_template, +AES_ABL_DEC_TEST_VECTORS );//CAST5 test_cipher("ecb(cast5)", ENCRYPT, cast5_enc_tv_template,
@@ -1060,6 +1064,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 ("abl(aes)" ,ENCRYPT , aes_abl_enc_tv_template, +AES_ABL_ENC_TEST_VECTORS ); +test_cipher ("abl(aes)" ,DECRYPT , aes_abl_dec_tv_template, +AES_ABL_DEC_TEST_VECTORS );break ;case 11 :
@@ -1203,6 +1211,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 ("abl(aes)" ,ENCRYPT , sec,NULL ,0 , + aes_abl_speed_template); +test_cipher_speed ("abl(aes)" ,DECRYPT , sec,NULL ,0 , + aes_abl_speed_template);break ;case 201 :
crypto/tcrypt.h +300 -0
318 lines not on this page · raw message
Signature · 1 line
1.4.2.1