Commit 5208ed2c authored by Nitesh Lal's avatar Nitesh Lal Committed by Herbert Xu

crypto: testmgr - add aead cbc des, des3_ede tests

Test vectors were taken from existing test for
CBC(DES3_EDE). Associated data has been added to test vectors.
HMAC computed with Crypto++ has been used. Following algos have
been covered.

        (a) "authenc(hmac(sha1),cbc(des))"
        (b) "authenc(hmac(sha1),cbc(des3_ede))"
        (c) "authenc(hmac(sha224),cbc(des))"
        (d) "authenc(hmac(sha224),cbc(des3_ede))"
        (e) "authenc(hmac(sha256),cbc(des))"
        (f) "authenc(hmac(sha256),cbc(des3_ede))"
        (g) "authenc(hmac(sha384),cbc(des))"
        (h) "authenc(hmac(sha384),cbc(des3_ede))"
        (i) "authenc(hmac(sha512),cbc(des))"
        (j) "authenc(hmac(sha512),cbc(des3_ede))"
Signed-off-by: default avatarVakul Garg <vakul@freescale.com>
[NiteshNarayanLal@freescale.com: added hooks for the missing algorithms test and tested the patch]
Signed-off-by: default avatarNitesh Lal <NiteshNarayanLal@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 9bac019d
......@@ -1519,7 +1519,36 @@ static int do_test(int m)
case 157:
ret += tcrypt_test("authenc(hmac(sha1),ecb(cipher_null))");
break;
case 181:
ret += tcrypt_test("authenc(hmac(sha1),cbc(des))");
break;
case 182:
ret += tcrypt_test("authenc(hmac(sha1),cbc(des3_ede))");
break;
case 183:
ret += tcrypt_test("authenc(hmac(sha224),cbc(des))");
break;
case 184:
ret += tcrypt_test("authenc(hmac(sha224),cbc(des3_ede))");
break;
case 185:
ret += tcrypt_test("authenc(hmac(sha256),cbc(des))");
break;
case 186:
ret += tcrypt_test("authenc(hmac(sha256),cbc(des3_ede))");
break;
case 187:
ret += tcrypt_test("authenc(hmac(sha384),cbc(des))");
break;
case 188:
ret += tcrypt_test("authenc(hmac(sha384),cbc(des3_ede))");
break;
case 189:
ret += tcrypt_test("authenc(hmac(sha512),cbc(des))");
break;
case 190:
ret += tcrypt_test("authenc(hmac(sha512),cbc(des3_ede))");
break;
case 200:
test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
speed_template_16_24_32);
......
......@@ -1834,8 +1834,38 @@ static const struct alg_test_desc alg_test_descs[] = {
.suite = {
.aead = {
.enc = {
.vecs = hmac_sha1_aes_cbc_enc_tv_template,
.count = HMAC_SHA1_AES_CBC_ENC_TEST_VECTORS
.vecs =
hmac_sha1_aes_cbc_enc_tv_temp,
.count =
HMAC_SHA1_AES_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha1),cbc(des))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha1_des_cbc_enc_tv_temp,
.count =
HMAC_SHA1_DES_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha1),cbc(des3_ede))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha1_des3_ede_cbc_enc_tv_temp,
.count =
HMAC_SHA1_DES3_EDE_CBC_ENC_TEST_VEC
}
}
}
......@@ -1846,12 +1876,44 @@ static const struct alg_test_desc alg_test_descs[] = {
.suite = {
.aead = {
.enc = {
.vecs = hmac_sha1_ecb_cipher_null_enc_tv_template,
.count = HMAC_SHA1_ECB_CIPHER_NULL_ENC_TEST_VECTORS
.vecs =
hmac_sha1_ecb_cipher_null_enc_tv_temp,
.count =
HMAC_SHA1_ECB_CIPHER_NULL_ENC_TEST_VEC
},
.dec = {
.vecs = hmac_sha1_ecb_cipher_null_dec_tv_template,
.count = HMAC_SHA1_ECB_CIPHER_NULL_DEC_TEST_VECTORS
.vecs =
hmac_sha1_ecb_cipher_null_dec_tv_temp,
.count =
HMAC_SHA1_ECB_CIPHER_NULL_DEC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha224),cbc(des))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha224_des_cbc_enc_tv_temp,
.count =
HMAC_SHA224_DES_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha224),cbc(des3_ede))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha224_des3_ede_cbc_enc_tv_temp,
.count =
HMAC_SHA224_DES3_EDE_CBC_ENC_TEST_VEC
}
}
}
......@@ -1862,8 +1924,66 @@ static const struct alg_test_desc alg_test_descs[] = {
.suite = {
.aead = {
.enc = {
.vecs = hmac_sha256_aes_cbc_enc_tv_template,
.count = HMAC_SHA256_AES_CBC_ENC_TEST_VECTORS
.vecs =
hmac_sha256_aes_cbc_enc_tv_temp,
.count =
HMAC_SHA256_AES_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha256),cbc(des))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha256_des_cbc_enc_tv_temp,
.count =
HMAC_SHA256_DES_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha256),cbc(des3_ede))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha256_des3_ede_cbc_enc_tv_temp,
.count =
HMAC_SHA256_DES3_EDE_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha384),cbc(des))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha384_des_cbc_enc_tv_temp,
.count =
HMAC_SHA384_DES_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha384),cbc(des3_ede))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha384_des3_ede_cbc_enc_tv_temp,
.count =
HMAC_SHA384_DES3_EDE_CBC_ENC_TEST_VEC
}
}
}
......@@ -1874,8 +1994,38 @@ static const struct alg_test_desc alg_test_descs[] = {
.suite = {
.aead = {
.enc = {
.vecs = hmac_sha512_aes_cbc_enc_tv_template,
.count = HMAC_SHA512_AES_CBC_ENC_TEST_VECTORS
.vecs =
hmac_sha512_aes_cbc_enc_tv_temp,
.count =
HMAC_SHA512_AES_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha512),cbc(des))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha512_des_cbc_enc_tv_temp,
.count =
HMAC_SHA512_DES_CBC_ENC_TEST_VEC
}
}
}
}, {
.alg = "authenc(hmac(sha512),cbc(des3_ede))",
.test = alg_test_aead,
.fips_allowed = 1,
.suite = {
.aead = {
.enc = {
.vecs =
hmac_sha512_des3_ede_cbc_enc_tv_temp,
.count =
HMAC_SHA512_DES3_EDE_CBC_ENC_TEST_VEC
}
}
}
......@@ -3276,8 +3426,8 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
panic("%s: %s alg self test failed in fips mode!\n", driver, alg);
if (fips_enabled && !rc)
printk(KERN_INFO "alg: self-tests for %s (%s) passed\n",
driver, alg);
pr_info(KERN_INFO "alg: self-tests for %s (%s) passed\n",
driver, alg);
return rc;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment