Commit ba0e14acc417eceb895efda1ff46366f4d1728f8

Authored by Puneet Saxena
Committed by Herbert Xu
1 parent ec8e8dfe5f

crypto: testmgr - add support for aes ofb mode

the fix add testcase for testing aes ofb mode.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 2 changed files with 76 additions and 0 deletions Side-by-side Diff

... ... @@ -2219,6 +2219,22 @@
2219 2219 }
2220 2220 }
2221 2221 }, {
  2222 + .alg = "ofb(aes)",
  2223 + .test = alg_test_skcipher,
  2224 + .fips_allowed = 1,
  2225 + .suite = {
  2226 + .cipher = {
  2227 + .enc = {
  2228 + .vecs = aes_ofb_enc_tv_template,
  2229 + .count = AES_OFB_ENC_TEST_VECTORS
  2230 + },
  2231 + .dec = {
  2232 + .vecs = aes_ofb_dec_tv_template,
  2233 + .count = AES_OFB_DEC_TEST_VECTORS
  2234 + }
  2235 + }
  2236 + }
  2237 + }, {
2222 2238 .alg = "pcbc(fcrypt)",
2223 2239 .test = alg_test_skcipher,
2224 2240 .suite = {
... ... @@ -2980,6 +2980,8 @@
2980 2980 #define AES_XTS_DEC_TEST_VECTORS 4
2981 2981 #define AES_CTR_ENC_TEST_VECTORS 3
2982 2982 #define AES_CTR_DEC_TEST_VECTORS 3
  2983 +#define AES_OFB_ENC_TEST_VECTORS 1
  2984 +#define AES_OFB_DEC_TEST_VECTORS 1
2983 2985 #define AES_CTR_3686_ENC_TEST_VECTORS 7
2984 2986 #define AES_CTR_3686_DEC_TEST_VECTORS 6
2985 2987 #define AES_GCM_ENC_TEST_VECTORS 9
... ... @@ -5504,6 +5506,64 @@
5504 5506 "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
5505 5507 .rlen = 32,
5506 5508 },
  5509 +};
  5510 +
  5511 +static struct cipher_testvec aes_ofb_enc_tv_template[] = {
  5512 + /* From NIST Special Publication 800-38A, Appendix F.5 */
  5513 + {
  5514 + .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
  5515 + "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
  5516 + .klen = 16,
  5517 + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07\x08"
  5518 + "\x09\x0a\x0b\x0c\x0d\x0e\x0f",
  5519 + .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  5520 + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  5521 + "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  5522 + "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  5523 + "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  5524 + "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  5525 + "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  5526 + "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  5527 + .ilen = 64,
  5528 + .result = "\x3b\x3f\xd9\x2e\xb7\x2d\xad\x20"
  5529 + "\x33\x34\x49\xf8\xe8\x3c\xfb\x4a"
  5530 + "\x77\x89\x50\x8d\x16\x91\x8f\x03\xf5"
  5531 + "\x3c\x52\xda\xc5\x4e\xd8\x25"
  5532 + "\x97\x40\x05\x1e\x9c\x5f\xec\xf6\x43"
  5533 + "\x44\xf7\xa8\x22\x60\xed\xcc"
  5534 + "\x30\x4c\x65\x28\xf6\x59\xc7\x78"
  5535 + "\x66\xa5\x10\xd9\xc1\xd6\xae\x5e",
  5536 + .rlen = 64,
  5537 + }
  5538 +};
  5539 +
  5540 +static struct cipher_testvec aes_ofb_dec_tv_template[] = {
  5541 + /* From NIST Special Publication 800-38A, Appendix F.5 */
  5542 + {
  5543 + .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
  5544 + "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
  5545 + .klen = 16,
  5546 + .iv = "\x00\x01\x02\x03\x04\x05\x06\x07\x08"
  5547 + "\x09\x0a\x0b\x0c\x0d\x0e\x0f",
  5548 + .input = "\x3b\x3f\xd9\x2e\xb7\x2d\xad\x20"
  5549 + "\x33\x34\x49\xf8\xe8\x3c\xfb\x4a"
  5550 + "\x77\x89\x50\x8d\x16\x91\x8f\x03\xf5"
  5551 + "\x3c\x52\xda\xc5\x4e\xd8\x25"
  5552 + "\x97\x40\x05\x1e\x9c\x5f\xec\xf6\x43"
  5553 + "\x44\xf7\xa8\x22\x60\xed\xcc"
  5554 + "\x30\x4c\x65\x28\xf6\x59\xc7\x78"
  5555 + "\x66\xa5\x10\xd9\xc1\xd6\xae\x5e",
  5556 + .ilen = 64,
  5557 + .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
  5558 + "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
  5559 + "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
  5560 + "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
  5561 + "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
  5562 + "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
  5563 + "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
  5564 + "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
  5565 + .rlen = 64,
  5566 + }
5507 5567 };
5508 5568  
5509 5569 static struct aead_testvec aes_gcm_enc_tv_template[] = {