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

Function parse_table_action_sym_crypto

dpdk/examples/ip_pipeline/cli.c:3964–4026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3962
3963
3964static uint32_t
3965parse_table_action_sym_crypto(char **tokens,
3966 uint32_t n_tokens,
3967 struct table_rule_action *a)
3968{
3969 struct rte_table_action_sym_crypto_params *p = &a->sym_crypto;
3970 struct rte_crypto_sym_xform *xform = NULL;
3971 uint8_t *key = a->sym_crypto_key;
3972 uint32_t max_key_len = SYM_CRYPTO_MAX_KEY_SIZE;
3973 uint32_t used_n_tokens;
3974 uint32_t encrypt;
3975 int status;
3976
3977 if ((n_tokens < 12) ||
3978 strcmp(tokens[0], "sym_crypto") ||
3979 strcmp(tokens[2], "type"))
3980 return 0;
3981
3982 memset(p, 0, sizeof(*p));
3983
3984 if (strcmp(tokens[1], "encrypt") == 0)
3985 encrypt = 1;
3986 else
3987 encrypt = 0;
3988
3989 status = parser_read_uint32(&p->data_offset, tokens[n_tokens - 1]);
3990 if (status < 0)
3991 return 0;
3992
3993 if (strcmp(tokens[3], "cipher") == 0) {
3994 tokens += 3;
3995 n_tokens -= 3;
3996
3997 xform = parse_table_action_cipher(p, key, max_key_len, tokens,
3998 n_tokens, encrypt, &used_n_tokens);
3999 } else if (strcmp(tokens[3], "cipher_auth") == 0) {
4000 tokens += 3;
4001 n_tokens -= 3;
4002
4003 xform = parse_table_action_cipher_auth(p, key, max_key_len,
4004 tokens, n_tokens, encrypt, &used_n_tokens);
4005 } else if (strcmp(tokens[3], "aead") == 0) {
4006 tokens += 3;
4007 n_tokens -= 3;
4008
4009 xform = parse_table_action_aead(p, key, max_key_len, tokens,
4010 n_tokens, encrypt, &used_n_tokens);
4011 }
4012
4013 if (xform == NULL)
4014 return 0;
4015
4016 p->xform = xform;
4017
4018 if (strcmp(tokens[used_n_tokens], "data_offset")) {
4019 parse_free_sym_crypto_param_data(p);
4020 return 0;
4021 }

Callers 1

parse_table_actionFunction · 0.85

Calls 7

strcmpFunction · 0.85
memsetFunction · 0.85
parse_table_action_aeadFunction · 0.85
parser_read_uint32Function · 0.70

Tested by

no test coverage detected