| 11486 | } |
| 11487 | |
| 11488 | static int |
| 11489 | test_docsis_proto_downlink(const void *data) |
| 11490 | { |
| 11491 | const struct docsis_test_data *d_td = data; |
| 11492 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 11493 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 11494 | uint8_t *plaintext = NULL; |
| 11495 | uint8_t *ciphertext = NULL; |
| 11496 | uint8_t *iv_ptr; |
| 11497 | int32_t cipher_len, crc_len; |
| 11498 | int ret = TEST_SUCCESS; |
| 11499 | |
| 11500 | void *ctx = rte_cryptodev_get_sec_ctx(ts_params->valid_devs[0]); |
| 11501 | |
| 11502 | /* Verify the capabilities */ |
| 11503 | struct rte_security_capability_idx sec_cap_idx; |
| 11504 | const struct rte_security_capability *sec_cap; |
| 11505 | const struct rte_cryptodev_capabilities *crypto_cap; |
| 11506 | const struct rte_cryptodev_symmetric_capability *sym_cap; |
| 11507 | int j = 0; |
| 11508 | |
| 11509 | /* Set action type */ |
| 11510 | ut_params->type = gbl_action_type == RTE_SECURITY_ACTION_TYPE_NONE ? |
| 11511 | RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL : |
| 11512 | gbl_action_type; |
| 11513 | |
| 11514 | if (security_proto_supported(ut_params->type, |
| 11515 | RTE_SECURITY_PROTOCOL_DOCSIS) < 0) |
| 11516 | return TEST_SKIPPED; |
| 11517 | |
| 11518 | sec_cap_idx.action = ut_params->type; |
| 11519 | sec_cap_idx.protocol = RTE_SECURITY_PROTOCOL_DOCSIS; |
| 11520 | sec_cap_idx.docsis.direction = RTE_SECURITY_DOCSIS_DOWNLINK; |
| 11521 | |
| 11522 | sec_cap = rte_security_capability_get(ctx, &sec_cap_idx); |
| 11523 | if (sec_cap == NULL) |
| 11524 | return TEST_SKIPPED; |
| 11525 | |
| 11526 | while ((crypto_cap = &sec_cap->crypto_capabilities[j++])->op != |
| 11527 | RTE_CRYPTO_OP_TYPE_UNDEFINED) { |
| 11528 | if (crypto_cap->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC && |
| 11529 | crypto_cap->sym.xform_type == |
| 11530 | RTE_CRYPTO_SYM_XFORM_CIPHER && |
| 11531 | crypto_cap->sym.cipher.algo == |
| 11532 | RTE_CRYPTO_CIPHER_AES_DOCSISBPI) { |
| 11533 | sym_cap = &crypto_cap->sym; |
| 11534 | if (rte_cryptodev_sym_capability_check_cipher(sym_cap, |
| 11535 | d_td->key.len, |
| 11536 | d_td->iv.len) == 0) |
| 11537 | break; |
| 11538 | } |
| 11539 | } |
| 11540 | |
| 11541 | if (crypto_cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED) |
| 11542 | return TEST_SKIPPED; |
| 11543 | |
| 11544 | /* Setup source mbuf payload */ |
| 11545 | ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
nothing calls this directly
no test coverage detected