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

Function pdcp_iv_gen_func_set

dpdk/lib/pdcp/pdcp_process.c:216–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216static int
217pdcp_iv_gen_func_set(struct rte_pdcp_entity *entity, const struct rte_pdcp_entity_conf *conf)
218{
219 struct rte_crypto_sym_xform *c_xfrm, *a_xfrm;
220 enum rte_security_pdcp_direction direction;
221 enum pdcp_cipher_algo cipher_algo;
222 enum pdcp_auth_algo auth_algo;
223 struct entity_priv *en_priv;
224 int ret;
225
226 en_priv = entity_priv_get(entity);
227
228 direction = conf->pdcp_xfrm.pkt_dir;
229 if (conf->reverse_iv_direction)
230 direction = !direction;
231
232 ret = pdcp_crypto_xfrm_get(conf, &c_xfrm, &a_xfrm);
233 if (ret)
234 return ret;
235
236 if (c_xfrm == NULL)
237 return -EINVAL;
238
239 memset(&en_priv->auth_iv_part, 0, sizeof(en_priv->auth_iv_part));
240 memset(&en_priv->cipher_iv_part, 0, sizeof(en_priv->cipher_iv_part));
241
242 switch (c_xfrm->cipher.algo) {
243 case RTE_CRYPTO_CIPHER_NULL:
244 cipher_algo = PDCP_CIPHER_ALGO_NULL;
245 break;
246 case RTE_CRYPTO_CIPHER_AES_CTR:
247 cipher_algo = PDCP_CIPHER_ALGO_AES;
248 en_priv->cipher_iv_part.aes_ctr.bearer = conf->pdcp_xfrm.bearer;
249 en_priv->cipher_iv_part.aes_ctr.direction = direction;
250 break;
251 case RTE_CRYPTO_CIPHER_SNOW3G_UEA2:
252 cipher_algo = PDCP_CIPHER_ALGO_SNOW3G;
253 en_priv->cipher_iv_part.zs.bearer = conf->pdcp_xfrm.bearer;
254 en_priv->cipher_iv_part.zs.direction = direction;
255 break;
256 case RTE_CRYPTO_CIPHER_ZUC_EEA3:
257 cipher_algo = PDCP_CIPHER_ALGO_ZUC;
258 en_priv->cipher_iv_part.zs.bearer = conf->pdcp_xfrm.bearer;
259 en_priv->cipher_iv_part.zs.direction = direction;
260 break;
261 default:
262 return -ENOTSUP;
263 }
264
265 if (a_xfrm != NULL) {
266 switch (a_xfrm->auth.algo) {
267 case RTE_CRYPTO_AUTH_NULL:
268 auth_algo = PDCP_AUTH_ALGO_NULL;
269 break;
270 case RTE_CRYPTO_AUTH_AES_CMAC:
271 auth_algo = PDCP_AUTH_ALGO_AES;
272 en_priv->auth_iv_part.aes_cmac.bearer = conf->pdcp_xfrm.bearer;
273 en_priv->auth_iv_part.aes_cmac.direction = direction;

Callers 1

pdcp_process_func_setFunction · 0.85

Calls 3

entity_priv_getFunction · 0.85
pdcp_crypto_xfrm_getFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected