MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_snow3g_authentication

Function test_snow3g_authentication

dpdk/app/test/test_cryptodev.c:3193–3284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3191}
3192
3193static int
3194test_snow3g_authentication(const struct snow3g_hash_test_data *tdata)
3195{
3196 struct crypto_testsuite_params *ts_params = &testsuite_params;
3197 struct crypto_unittest_params *ut_params = &unittest_params;
3198
3199 int retval;
3200 unsigned plaintext_pad_len;
3201 unsigned plaintext_len;
3202 uint8_t *plaintext;
3203 struct rte_cryptodev_info dev_info;
3204
3205 rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
3206 uint64_t feat_flags = dev_info.feature_flags;
3207
3208 if (!(feat_flags & RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA) &&
3209 ((tdata->validAuthLenInBits.len % 8) != 0)) {
3210 printf("Device doesn't support NON-Byte Aligned Data.\n");
3211 return TEST_SKIPPED;
3212 }
3213
3214 if ((global_api_test_type == CRYPTODEV_RAW_API_TEST) &&
3215 (!(feat_flags & RTE_CRYPTODEV_FF_SYM_RAW_DP))) {
3216 printf("Device doesn't support RAW data-path APIs.\n");
3217 return TEST_SKIPPED;
3218 }
3219
3220 if (gbl_action_type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO)
3221 return TEST_SKIPPED;
3222
3223 /* Verify the capabilities */
3224 struct rte_cryptodev_sym_capability_idx cap_idx;
3225 cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH;
3226 cap_idx.algo.auth = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
3227 if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0],
3228 &cap_idx) == NULL)
3229 return TEST_SKIPPED;
3230
3231 /* Create SNOW 3G session */
3232 retval = create_wireless_algo_hash_session(ts_params->valid_devs[0],
3233 tdata->key.data, tdata->key.len,
3234 tdata->auth_iv.len, tdata->digest.len,
3235 RTE_CRYPTO_AUTH_OP_GENERATE,
3236 RTE_CRYPTO_AUTH_SNOW3G_UIA2);
3237 if (retval < 0)
3238 return retval;
3239
3240 /* alloc mbuf and set payload */
3241 ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool);
3242
3243 memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0,
3244 rte_pktmbuf_tailroom(ut_params->ibuf));
3245
3246 plaintext_len = ceil_byte_length(tdata->plaintext.len);
3247 /* Append data which is padded to a multiple of */
3248 /* the algorithms block size */
3249 plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16);
3250 plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,

Calls 13

rte_cryptodev_info_getFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
memsetFunction · 0.85
rte_pktmbuf_tailroomFunction · 0.85
ceil_byte_lengthFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
process_sym_raw_dp_opFunction · 0.85
process_crypto_requestFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected