| 3894 | } |
| 3895 | |
| 3896 | static int |
| 3897 | test_kasumi_encryption_oop(const struct kasumi_test_data *tdata) |
| 3898 | { |
| 3899 | struct crypto_testsuite_params *ts_params = &testsuite_params; |
| 3900 | struct crypto_unittest_params *ut_params = &unittest_params; |
| 3901 | |
| 3902 | int retval; |
| 3903 | uint8_t *plaintext, *ciphertext; |
| 3904 | unsigned plaintext_pad_len; |
| 3905 | unsigned plaintext_len; |
| 3906 | |
| 3907 | /* Verify the capabilities */ |
| 3908 | struct rte_cryptodev_sym_capability_idx cap_idx; |
| 3909 | cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; |
| 3910 | cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_KASUMI_F8; |
| 3911 | /* Data-path service does not support OOP */ |
| 3912 | if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], |
| 3913 | &cap_idx) == NULL) |
| 3914 | return TEST_SKIPPED; |
| 3915 | |
| 3916 | if (global_api_test_type == CRYPTODEV_RAW_API_TEST) |
| 3917 | return TEST_SKIPPED; |
| 3918 | |
| 3919 | if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) |
| 3920 | return TEST_SKIPPED; |
| 3921 | |
| 3922 | /* Create KASUMI session */ |
| 3923 | retval = create_wireless_algo_cipher_session(ts_params->valid_devs[0], |
| 3924 | RTE_CRYPTO_CIPHER_OP_ENCRYPT, |
| 3925 | RTE_CRYPTO_CIPHER_KASUMI_F8, |
| 3926 | tdata->key.data, tdata->key.len, |
| 3927 | tdata->cipher_iv.len); |
| 3928 | if (retval < 0) |
| 3929 | return retval; |
| 3930 | |
| 3931 | ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
| 3932 | ut_params->obuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); |
| 3933 | |
| 3934 | /* Clear mbuf payload */ |
| 3935 | memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, |
| 3936 | rte_pktmbuf_tailroom(ut_params->ibuf)); |
| 3937 | |
| 3938 | plaintext_len = ceil_byte_length(tdata->plaintext.len); |
| 3939 | /* Append data which is padded to a multiple */ |
| 3940 | /* of the algorithms block size */ |
| 3941 | plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 8); |
| 3942 | plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, |
| 3943 | plaintext_pad_len); |
| 3944 | rte_pktmbuf_append(ut_params->obuf, plaintext_pad_len); |
| 3945 | memcpy(plaintext, tdata->plaintext.data, plaintext_len); |
| 3946 | |
| 3947 | debug_hexdump(stdout, "plaintext:", plaintext, plaintext_len); |
| 3948 | |
| 3949 | /* Create KASUMI operation */ |
| 3950 | retval = create_wireless_algo_cipher_operation_oop(tdata->cipher_iv.data, |
| 3951 | tdata->cipher_iv.len, |
| 3952 | RTE_ALIGN_CEIL(tdata->validCipherLenInBits.len, 8), |
| 3953 | tdata->validCipherOffsetInBits.len); |
no test coverage detected