mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
crypto: testmgr - add blowfish test-vectors
Add tests for parallel blowfish-x86_64 code paths. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
75b766258e
commit
85b63e342c
@ -782,6 +782,7 @@ static int do_test(int m)
|
||||
case 7:
|
||||
ret += tcrypt_test("ecb(blowfish)");
|
||||
ret += tcrypt_test("cbc(blowfish)");
|
||||
ret += tcrypt_test("ctr(blowfish)");
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
@ -1755,6 +1755,21 @@ static const struct alg_test_desc alg_test_descs[] = {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
.alg = "ctr(blowfish)",
|
||||
.test = alg_test_skcipher,
|
||||
.suite = {
|
||||
.cipher = {
|
||||
.enc = {
|
||||
.vecs = bf_ctr_enc_tv_template,
|
||||
.count = BF_CTR_ENC_TEST_VECTORS
|
||||
},
|
||||
.dec = {
|
||||
.vecs = bf_ctr_dec_tv_template,
|
||||
.count = BF_CTR_DEC_TEST_VECTORS
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
.alg = "cts(cbc(aes))",
|
||||
.test = alg_test_skcipher,
|
||||
|
172
crypto/testmgr.h
172
crypto/testmgr.h
@ -2391,10 +2391,12 @@ static struct cipher_testvec des3_ede_cbc_dec_tv_template[] = {
|
||||
/*
|
||||
* Blowfish test vectors.
|
||||
*/
|
||||
#define BF_ENC_TEST_VECTORS 6
|
||||
#define BF_DEC_TEST_VECTORS 6
|
||||
#define BF_CBC_ENC_TEST_VECTORS 1
|
||||
#define BF_CBC_DEC_TEST_VECTORS 1
|
||||
#define BF_ENC_TEST_VECTORS 7
|
||||
#define BF_DEC_TEST_VECTORS 7
|
||||
#define BF_CBC_ENC_TEST_VECTORS 2
|
||||
#define BF_CBC_DEC_TEST_VECTORS 2
|
||||
#define BF_CTR_ENC_TEST_VECTORS 2
|
||||
#define BF_CTR_DEC_TEST_VECTORS 2
|
||||
|
||||
static struct cipher_testvec bf_enc_tv_template[] = {
|
||||
{ /* DES test vectors from OpenSSL */
|
||||
@ -2448,6 +2450,24 @@ static struct cipher_testvec bf_enc_tv_template[] = {
|
||||
.ilen = 8,
|
||||
.result = "\xc0\x45\x04\x01\x2e\x4e\x1f\x53",
|
||||
.rlen = 8,
|
||||
}, { /* Generated with Crypto++ */
|
||||
.key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
|
||||
"\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
|
||||
"\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
|
||||
"\x78\xBE\x9B\x78\x55\x32\x0F\x55",
|
||||
.klen = 32,
|
||||
.input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
|
||||
"\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
|
||||
"\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
|
||||
"\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
|
||||
"\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
|
||||
.ilen = 40,
|
||||
.result = "\x96\x87\x3D\x0C\x7B\xFB\xBD\x1F"
|
||||
"\xE3\xC1\x99\x6D\x39\xD4\xC2\x7D"
|
||||
"\xD7\x87\xA1\xF2\xDF\x51\x71\x26"
|
||||
"\xC2\xF4\x6D\xFF\xF6\xCD\x6B\x40"
|
||||
"\xE1\xB3\xBF\xD4\x38\x2B\xC8\x3B",
|
||||
.rlen = 40,
|
||||
},
|
||||
};
|
||||
|
||||
@ -2503,6 +2523,24 @@ static struct cipher_testvec bf_dec_tv_template[] = {
|
||||
.ilen = 8,
|
||||
.result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
|
||||
.rlen = 8,
|
||||
}, { /* Generated with Crypto++ */
|
||||
.key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
|
||||
"\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
|
||||
"\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
|
||||
"\x78\xBE\x9B\x78\x55\x32\x0F\x55",
|
||||
.klen = 32,
|
||||
.input = "\x96\x87\x3D\x0C\x7B\xFB\xBD\x1F"
|
||||
"\xE3\xC1\x99\x6D\x39\xD4\xC2\x7D"
|
||||
"\xD7\x87\xA1\xF2\xDF\x51\x71\x26"
|
||||
"\xC2\xF4\x6D\xFF\xF6\xCD\x6B\x40"
|
||||
"\xE1\xB3\xBF\xD4\x38\x2B\xC8\x3B",
|
||||
.ilen = 40,
|
||||
.result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
|
||||
"\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
|
||||
"\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
|
||||
"\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
|
||||
"\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
|
||||
.rlen = 40,
|
||||
},
|
||||
};
|
||||
|
||||
@ -2522,6 +2560,25 @@ static struct cipher_testvec bf_cbc_enc_tv_template[] = {
|
||||
"\x58\xde\xb9\xe7\x15\x46\x16\xd9"
|
||||
"\x59\xf1\x65\x2b\xd5\xff\x92\xcc",
|
||||
.rlen = 32,
|
||||
}, { /* Generated with Crypto++ */
|
||||
.key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
|
||||
"\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
|
||||
"\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
|
||||
"\x78\xBE\x9B\x78\x55\x32\x0F\x55",
|
||||
.klen = 32,
|
||||
.iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
|
||||
.input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
|
||||
"\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
|
||||
"\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
|
||||
"\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
|
||||
"\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
|
||||
.ilen = 40,
|
||||
.result = "\xB4\xFE\xA5\xBB\x3D\x2C\x27\x06"
|
||||
"\x06\x2B\x3A\x92\xB2\xF5\x5E\x62"
|
||||
"\x84\xCD\xF7\x66\x7E\x41\x6C\x8E"
|
||||
"\x1B\xD9\x02\xB6\x48\xB0\x87\x25"
|
||||
"\x01\x9C\x93\x63\x51\x60\x82\xD2",
|
||||
.rlen = 40,
|
||||
},
|
||||
};
|
||||
|
||||
@ -2541,6 +2598,113 @@ static struct cipher_testvec bf_cbc_dec_tv_template[] = {
|
||||
"\x68\x65\x20\x74\x69\x6d\x65\x20"
|
||||
"\x66\x6f\x72\x20\x00\x00\x00\x00",
|
||||
.rlen = 32,
|
||||
}, { /* Generated with Crypto++ */
|
||||
.key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
|
||||
"\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
|
||||
"\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
|
||||
"\x78\xBE\x9B\x78\x55\x32\x0F\x55",
|
||||
.klen = 32,
|
||||
.iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
|
||||
.input = "\xB4\xFE\xA5\xBB\x3D\x2C\x27\x06"
|
||||
"\x06\x2B\x3A\x92\xB2\xF5\x5E\x62"
|
||||
"\x84\xCD\xF7\x66\x7E\x41\x6C\x8E"
|
||||
"\x1B\xD9\x02\xB6\x48\xB0\x87\x25"
|
||||
"\x01\x9C\x93\x63\x51\x60\x82\xD2",
|
||||
.ilen = 40,
|
||||
.result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
|
||||
"\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
|
||||
"\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
|
||||
"\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
|
||||
"\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
|
||||
.rlen = 40,
|
||||
},
|
||||
};
|
||||
|
||||
static struct cipher_testvec bf_ctr_enc_tv_template[] = {
|
||||
{ /* Generated with Crypto++ */
|
||||
.key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
|
||||
"\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
|
||||
"\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
|
||||
"\x78\xBE\x9B\x78\x55\x32\x0F\x55",
|
||||
.klen = 32,
|
||||
.iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
|
||||
.input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
|
||||
"\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
|
||||
"\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
|
||||
"\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
|
||||
"\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
|
||||
.ilen = 40,
|
||||
.result = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D"
|
||||
"\x9E\xDF\x38\x18\x83\x07\xEF\xC1"
|
||||
"\x93\x3C\xAA\xAA\xFE\x06\x42\xCC"
|
||||
"\x0D\x70\x86\x5A\x44\xAD\x85\x17"
|
||||
"\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC",
|
||||
.rlen = 40,
|
||||
}, { /* Generated with Crypto++ */
|
||||
.key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
|
||||
"\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
|
||||
"\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
|
||||
"\x78\xBE\x9B\x78\x55\x32\x0F\x55",
|
||||
.klen = 32,
|
||||
.iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
|
||||
.input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
|
||||
"\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
|
||||
"\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
|
||||
"\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
|
||||
"\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
|
||||
"\x6D\x04\x9B",
|
||||
.ilen = 43,
|
||||
.result = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D"
|
||||
"\x9E\xDF\x38\x18\x83\x07\xEF\xC1"
|
||||
"\x93\x3C\xAA\xAA\xFE\x06\x42\xCC"
|
||||
"\x0D\x70\x86\x5A\x44\xAD\x85\x17"
|
||||
"\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC"
|
||||
"\x3D\xA7\xE9",
|
||||
.rlen = 43,
|
||||
},
|
||||
};
|
||||
|
||||
static struct cipher_testvec bf_ctr_dec_tv_template[] = {
|
||||
{ /* Generated with Crypto++ */
|
||||
.key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
|
||||
"\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
|
||||
"\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
|
||||
"\x78\xBE\x9B\x78\x55\x32\x0F\x55",
|
||||
.klen = 32,
|
||||
.iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
|
||||
.input = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D"
|
||||
"\x9E\xDF\x38\x18\x83\x07\xEF\xC1"
|
||||
"\x93\x3C\xAA\xAA\xFE\x06\x42\xCC"
|
||||
"\x0D\x70\x86\x5A\x44\xAD\x85\x17"
|
||||
"\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC",
|
||||
.ilen = 40,
|
||||
.result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
|
||||
"\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
|
||||
"\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
|
||||
"\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
|
||||
"\x1E\x92\x29\xC0\x34\xCB\x62\xF9",
|
||||
.rlen = 40,
|
||||
}, { /* Generated with Crypto++ */
|
||||
.key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9"
|
||||
"\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A"
|
||||
"\x27\x04\xE1\x27\x04\xE1\xBE\x9B"
|
||||
"\x78\xBE\x9B\x78\x55\x32\x0F\x55",
|
||||
.klen = 32,
|
||||
.iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F",
|
||||
.input = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D"
|
||||
"\x9E\xDF\x38\x18\x83\x07\xEF\xC1"
|
||||
"\x93\x3C\xAA\xAA\xFE\x06\x42\xCC"
|
||||
"\x0D\x70\x86\x5A\x44\xAD\x85\x17"
|
||||
"\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC"
|
||||
"\x3D\xA7\xE9",
|
||||
.ilen = 43,
|
||||
.result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31"
|
||||
"\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3"
|
||||
"\x3A\xD1\x45\xDC\x73\x0A\x7E\x15"
|
||||
"\xAC\x20\xB7\x4E\xE5\x59\xF0\x87"
|
||||
"\x1E\x92\x29\xC0\x34\xCB\x62\xF9"
|
||||
"\x6D\x04\x9B",
|
||||
.rlen = 43,
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user