| 21 | #include "test_cryptodev_sm4_test_vectors.h" |
| 22 | |
| 23 | static int |
| 24 | verify_algo_support(const struct blockcipher_test_case *t, |
| 25 | const uint8_t dev_id, const uint32_t digest_len) |
| 26 | { |
| 27 | int ret = 0; |
| 28 | const struct blockcipher_test_data *tdata = t->test_data; |
| 29 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 30 | const struct rte_cryptodev_symmetric_capability *capability; |
| 31 | |
| 32 | if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) { |
| 33 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 34 | cap_idx.algo.cipher = tdata->crypto_algo; |
| 35 | capability = rte_cryptodev_sym_capability_get(dev_id, &cap_idx); |
| 36 | if (capability == NULL) |
| 37 | return -1; |
| 38 | |
| 39 | if (cap_idx.algo.cipher != RTE_CRYPTO_CIPHER_NULL && |
| 40 | !(t->test_data->wrapped_key)) |
| 41 | ret = rte_cryptodev_sym_capability_check_cipher(capability, |
| 42 | tdata->cipher_key.len, |
| 43 | tdata->iv.len); |
| 44 | if (ret != 0) |
| 45 | return -1; |
| 46 | } |
| 47 | |
| 48 | if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) { |
| 49 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; |
| 50 | cap_idx.algo.auth = tdata->auth_algo; |
| 51 | capability = rte_cryptodev_sym_capability_get(dev_id, &cap_idx); |
| 52 | if (capability == NULL) |
| 53 | return -1; |
| 54 | |
| 55 | if (cap_idx.algo.auth != RTE_CRYPTO_AUTH_NULL) |
| 56 | ret = rte_cryptodev_sym_capability_check_auth(capability, |
| 57 | tdata->auth_key.len, |
| 58 | digest_len, |
| 59 | 0); |
| 60 | if (ret != 0) |
| 61 | return -1; |
| 62 | } |
| 63 | |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | static int |
| 68 | test_blockcipher_one_case(const struct blockcipher_test_case *t, |
no test coverage detected