Skip to content

Commit

Permalink
crypto: testmgr - add larger cast5 testvectors
Browse files Browse the repository at this point in the history
New ECB, CBC and CTR testvectors for cast5. We need larger testvectors to check
parallel code paths in the optimized implementation. Tests have also been added
to the tcrypt module.

Signed-off-by: Johannes Goetzfried <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Johannes Goetzfried authored and Herbert Xu committed Aug 1, 2012
1 parent 270b0c6 commit a2c5826
Show file tree
Hide file tree
Showing 4 changed files with 871 additions and 2 deletions.
32 changes: 32 additions & 0 deletions crypto/tcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,8 @@ static int do_test(int m)

case 14:
ret += tcrypt_test("ecb(cast5)");
ret += tcrypt_test("cbc(cast5)");
ret += tcrypt_test("ctr(cast5)");
break;

case 15:
Expand Down Expand Up @@ -1359,6 +1361,21 @@ static int do_test(int m)
speed_template_8);
break;

case 209:
test_cipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0,
speed_template_8_16);
test_cipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0,
speed_template_8_16);
test_cipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0,
speed_template_8_16);
test_cipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0,
speed_template_8_16);
test_cipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0,
speed_template_8_16);
test_cipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0,
speed_template_8_16);
break;

case 300:
/* fall through */

Expand Down Expand Up @@ -1639,6 +1656,21 @@ static int do_test(int m)
speed_template_8);
break;

case 506:
test_acipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0,
speed_template_8_16);
test_acipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0,
speed_template_8_16);
test_acipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0,
speed_template_8_16);
test_acipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0,
speed_template_8_16);
test_acipher_speed("ctr(cast5)", ENCRYPT, sec, NULL, 0,
speed_template_8_16);
test_acipher_speed("ctr(cast5)", DECRYPT, sec, NULL, 0,
speed_template_8_16);
break;

case 1000:
test_available();
break;
Expand Down
1 change: 1 addition & 0 deletions crypto/tcrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static struct cipher_speed_template des3_speed_template[] = {
*/
static u8 speed_template_8[] = {8, 0};
static u8 speed_template_24[] = {24, 0};
static u8 speed_template_8_16[] = {8, 16, 0};
static u8 speed_template_8_32[] = {8, 32, 0};
static u8 speed_template_16_32[] = {16, 32, 0};
static u8 speed_template_16_24_32[] = {16, 24, 32, 0};
Expand Down
30 changes: 30 additions & 0 deletions crypto/testmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,21 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}
}, {
.alg = "cbc(cast5)",
.test = alg_test_skcipher,
.suite = {
.cipher = {
.enc = {
.vecs = cast5_cbc_enc_tv_template,
.count = CAST5_CBC_ENC_TEST_VECTORS
},
.dec = {
.vecs = cast5_cbc_dec_tv_template,
.count = CAST5_CBC_DEC_TEST_VECTORS
}
}
}
}, {
.alg = "cbc(des)",
.test = alg_test_skcipher,
Expand Down Expand Up @@ -2053,6 +2068,21 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}
}, {
.alg = "ctr(cast5)",
.test = alg_test_skcipher,
.suite = {
.cipher = {
.enc = {
.vecs = cast5_ctr_enc_tv_template,
.count = CAST5_CTR_ENC_TEST_VECTORS
},
.dec = {
.vecs = cast5_ctr_dec_tv_template,
.count = CAST5_CTR_DEC_TEST_VECTORS
}
}
}
}, {
.alg = "ctr(serpent)",
.test = alg_test_skcipher,
Expand Down
Loading

0 comments on commit a2c5826

Please sign in to comment.