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

Function transform_cipher_param

dpdk/lib/vhost/vhost_crypto.c:238–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236};
237
238static int
239transform_cipher_param(struct rte_crypto_sym_xform *xform,
240 VhostUserCryptoSessionParam *param)
241{
242 int ret;
243
244 ret = cipher_algo_transform(param->cipher_algo, &xform->cipher.algo);
245 if (unlikely(ret < 0))
246 return ret;
247
248 if (param->cipher_key_len > VHOST_USER_CRYPTO_MAX_CIPHER_KEY_LENGTH) {
249 VC_LOG_DBG("Invalid cipher key length");
250 return -VIRTIO_CRYPTO_BADMSG;
251 }
252
253 xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
254 xform->cipher.key.length = param->cipher_key_len;
255 if (xform->cipher.key.length > 0)
256 xform->cipher.key.data = param->cipher_key_buf;
257 if (param->dir == VIRTIO_CRYPTO_OP_ENCRYPT)
258 xform->cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
259 else if (param->dir == VIRTIO_CRYPTO_OP_DECRYPT)
260 xform->cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT;
261 else {
262 VC_LOG_DBG("Bad operation type");
263 return -VIRTIO_CRYPTO_BADMSG;
264 }
265
266 ret = get_iv_len(xform->cipher.algo);
267 if (unlikely(ret < 0))
268 return ret;
269 xform->cipher.iv.length = (uint16_t)ret;
270 xform->cipher.iv.offset = IV_OFFSET;
271 return 0;
272}
273
274static int
275transform_chain_param(struct rte_crypto_sym_xform *xforms,

Callers 1

vhost_crypto_create_sessFunction · 0.85

Calls 2

cipher_algo_transformFunction · 0.85
get_iv_lenFunction · 0.85

Tested by

no test coverage detected