Message ID | 20190104041625.3259-2-ebiggers@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | crypto: skcipher template simplifications and conversions | expand |
On Fri, Jan 04, 2019 at 09:03:10PM +0000, Sasha Levin wrote: > Hi, > > [This is an automated email] > > This commit has been processed because it contains a "Fixes:" tag, > fixing commit: a7d85e06ed80 crypto: cfb - add support for Cipher FeedBack mode. > > The bot has tested the following trees: v4.20.0, v4.19.13. > > v4.20.0: Failed to apply! Possible dependencies: > 7da66670775d ("crypto: testmgr - add AES-CFB tests") > > v4.19.13: Failed to apply! Possible dependencies: > 7da66670775d ("crypto: testmgr - add AES-CFB tests") > dfb89ab3f0a7 ("crypto: tcrypt - add OFB functional tests") > > > How should we proceed with this patch? > > -- > Thanks, > Sasha The following will need to be applied to 4.19 and 4.20 first. Both had Cc stable: fa4600734b74 ("crypto: cfb - fix decryption") 7da66670775d ("crypto: testmgr - add AES-CFB tests") Herbert, why was CFB accepted without any test vectors in the first place? - Eric
On Fri, Jan 04, 2019 at 07:07:48PM -0800, Eric Biggers wrote: > > Herbert, why was CFB accepted without any test vectors in the first place? That was an oversight. Longer term we should restructure how the test vectors are stored by moving them in with the generic implementation. That should also ensure that we would never add an algorithm without both a generic implementation as well as test vectors. Cheers,
diff --git a/crypto/cfb.c b/crypto/cfb.c index e81e456734985..183e8a9c33128 100644 --- a/crypto/cfb.c +++ b/crypto/cfb.c @@ -298,6 +298,12 @@ static int crypto_cfb_create(struct crypto_template *tmpl, struct rtattr **tb) inst->alg.base.cra_blocksize = 1; inst->alg.base.cra_alignmask = alg->cra_alignmask; + /* + * To simplify the implementation, configure the skcipher walk to only + * give a partial block at the very end, never earlier. + */ + inst->alg.chunksize = alg->cra_blocksize; + inst->alg.ivsize = alg->cra_blocksize; inst->alg.min_keysize = alg->cra_cipher.cia_min_keysize; inst->alg.max_keysize = alg->cra_cipher.cia_max_keysize; diff --git a/crypto/testmgr.h b/crypto/testmgr.h index e8f47d7b92cdd..7f4dae7a57a1c 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -12870,6 +12870,31 @@ static const struct cipher_testvec aes_cfb_tv_template[] = { "\x75\xa3\x85\x74\x1a\xb9\xce\xf8" "\x20\x31\x62\x3d\x55\xb1\xe4\x71", .len = 64, + .also_non_np = 1, + .np = 2, + .tap = { 31, 33 }, + }, { /* > 16 bytes, not a multiple of 16 bytes */ + .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" + "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", + .klen = 16, + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .ptext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" + "\xae", + .ctext = "\x3b\x3f\xd9\x2e\xb7\x2d\xad\x20" + "\x33\x34\x49\xf8\xe8\x3c\xfb\x4a" + "\xc8", + .len = 17, + }, { /* < 16 bytes */ + .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" + "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", + .klen = 16, + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" + "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + .ptext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f", + .ctext = "\x3b\x3f\xd9\x2e\xb7\x2d\xad", + .len = 7, }, };