diff options
author | Balakrishna Garapati <balakrishna.garapati@linaro.org> | 2016-04-26 07:44:01 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-04-27 16:05:21 +0300 |
commit | 0d494cf898db61fd8a22ade99df964a95f033e38 (patch) | |
tree | a72ed76e6c5d5039e84398017a969c40ac52da77 /test | |
parent | c05e53db3bbc57917067cf20c0504fded2d3640f (diff) |
validation: crypto: verify odp crypto capability
test update to verify the crypto capability functionality
Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/validation/crypto/odp_crypto_test_inp.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/validation/crypto/odp_crypto_test_inp.c b/test/validation/crypto/odp_crypto_test_inp.c index fc125f7f2..0c5b1107c 100644 --- a/test/validation/crypto/odp_crypto_test_inp.c +++ b/test/validation/crypto/odp_crypto_test_inp.c @@ -46,6 +46,7 @@ static void alg_test(odp_crypto_op_t op, ) { odp_crypto_session_t session; + odp_crypto_capability_t capability; int rc; odp_crypto_ses_create_err_t status; odp_bool_t posted; @@ -53,6 +54,51 @@ static void alg_test(odp_crypto_op_t op, odp_crypto_compl_t compl_event; odp_crypto_op_result_t result; + rc = odp_crypto_capability(&capability); + CU_ASSERT(!rc); + + if (capability.hw_ciphers.all_bits) { + if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC && + !(capability.hw_ciphers.bit.trides_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC && + !(capability.hw_ciphers.bit.aes128_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM && + !(capability.hw_ciphers.bit.aes128_gcm)) + rc = -1; + } else { + if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC && + !(capability.ciphers.bit.trides_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC && + !(capability.ciphers.bit.aes128_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM && + !(capability.ciphers.bit.aes128_gcm)) + rc = -1; + } + + CU_ASSERT(!rc); + + if (capability.hw_auths.all_bits) { + if (auth_alg == ODP_AUTH_ALG_AES128_GCM && + !(capability.hw_auths.bit.aes128_gcm)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_NULL && + !(capability.hw_auths.bit.null)) + rc = -1; + } else { + if (auth_alg == ODP_AUTH_ALG_AES128_GCM && + !(capability.auths.bit.aes128_gcm)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_NULL && + !(capability.auths.bit.null)) + rc = -1; + } + + CU_ASSERT(!rc); + /* Create a crypto session */ odp_crypto_session_params_t ses_params; memset(&ses_params, 0, sizeof(ses_params)); |