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

Function verify_crypto_xform

dpdk/examples/ipsec-secgw/ipsec.c:60–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60static inline int
61verify_crypto_xform(const struct rte_cryptodev_capabilities *capabilities,
62 struct rte_crypto_sym_xform *crypto_xform)
63{
64 const struct rte_cryptodev_capabilities *crypto_cap;
65 int j = 0;
66
67 while ((crypto_cap = &capabilities[j++])->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) {
68 if (crypto_cap->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC &&
69 crypto_cap->sym.xform_type == crypto_xform->type) {
70 if (crypto_xform->type == RTE_CRYPTO_SYM_XFORM_AEAD &&
71 crypto_cap->sym.aead.algo == crypto_xform->aead.algo) {
72 if (rte_cryptodev_sym_capability_check_aead(&crypto_cap->sym,
73 crypto_xform->aead.key.length,
74 crypto_xform->aead.digest_length,
75 crypto_xform->aead.aad_length,
76 crypto_xform->aead.iv.length) == 0)
77 return 0;
78 }
79 if (crypto_xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER &&
80 crypto_cap->sym.cipher.algo == crypto_xform->cipher.algo) {
81 if (rte_cryptodev_sym_capability_check_cipher(&crypto_cap->sym,
82 crypto_xform->cipher.key.length,
83 crypto_xform->cipher.iv.length) == 0)
84 return 0;
85 }
86 if (crypto_xform->type == RTE_CRYPTO_SYM_XFORM_AUTH &&
87 crypto_cap->sym.auth.algo == crypto_xform->auth.algo) {
88 if (rte_cryptodev_sym_capability_check_auth(&crypto_cap->sym,
89 crypto_xform->auth.key.length,
90 crypto_xform->auth.digest_length,
91 crypto_xform->auth.iv.length) == 0)
92 return 0;
93 }
94 }
95 }
96
97 return -ENOTSUP;
98}
99
100static inline int
101verify_crypto_capabilities(const struct rte_cryptodev_capabilities *capabilities,

Callers 1

Tested by

no test coverage detected