src/dpdk/drivers/crypto/mvsam/rte_mrvl_pmd.c
int
mrvl_crypto_set_session_parameters(struct mrvl_crypto_session *sess,
		const struct rte_crypto_sym_xform *xform)
{
	const struct rte_crypto_sym_xform *cipher_xform = NULL;
	const struct rte_crypto_sym_xform *auth_xform = NULL;
	const struct rte_crypto_sym_xform *aead_xform = NULL;

	/* Filter out spurious/broken requests */
	if (xform == NULL)
		return -EINVAL;

	sess->chain_order = mrvl_crypto_get_chain_order(xform);
	switch (sess->chain_order) {
	case MRVL_CRYPTO_CHAIN_CIPHER_AUTH:
		cipher_xform = xform;
		auth_xform = xform->next;
		break;
	case MRVL_CRYPTO_CHAIN_AUTH_CIPHER:
		auth_xform = xform;
		cipher_xform = xform->next;
		break;
	case MRVL_CRYPTO_CHAIN_CIPHER_ONLY:
		cipher_xform = xform;
		break;
	case MRVL_CRYPTO_CHAIN_AUTH_ONLY:
		auth_xform = xform;
		break;
	case MRVL_CRYPTO_CHAIN_COMBINED:
		aead_xform = xform;
		break;
	default:
		return -EINVAL;
	}

	if ((cipher_xform != NULL) &&
		(mrvl_crypto_set_cipher_session_parameters(
			sess, cipher_xform) < 0)) {
		MRVL_LOG(ERR, "Invalid/unsupported cipher parameters!");
		return -EINVAL;
	}

	if ((auth_xform != NULL) &&
		(mrvl_crypto_set_auth_session_parameters(
			sess, auth_xform) < 0)) {
		MRVL_LOG(ERR, "Invalid/unsupported auth parameters!");
		return -EINVAL;
	}

	if ((aead_xform != NULL) &&
		(mrvl_crypto_set_aead_session_parameters(
			sess, aead_xform) < 0)) {
		MRVL_LOG(ERR, "Invalid/unsupported aead parameters!");
		return -EINVAL;
	}

	return 0;
}
/**
 * Parse crypto transform chain and setup session parameters.
 *
 * @param dev Pointer to crypto device
 * @param sess Poiner to crypto session
 * @param xform Pointer to configuration structure chain for crypto operations.
 * @returns 0 in case of success, negative value otherwise.
 */
Parse crypto transform chain and setup session parameters.
@param dev Pointer to crypto device
@param sess Poiner to crypto session
@param xform Pointer to configuration structure chain for crypto operations.
@returns 0 in case of success, negative value otherwise.
Parse crypto transform chain and setup session parameters . @param dev Pointer to crypto device @param sess Poiner to crypto session @param xform Pointer to configuration structure chain for crypto operations . @returns 0 in case of success negative value otherwise .
int
mrvl_crypto_set_session_parameters(struct mrvl_crypto_session *sess,
		const struct rte_crypto_sym_xform *xform)
{
	const struct rte_crypto_sym_xform *cipher_xform = NULL;
	const struct rte_crypto_sym_xform *auth_xform = NULL;
	const struct rte_crypto_sym_xform *aead_xform = NULL;
	if (xform == NULL)
		return -EINVAL;
	sess->chain_order = mrvl_crypto_get_chain_order(xform);
	switch (sess->chain_order) {
	case MRVL_CRYPTO_CHAIN_CIPHER_AUTH:
		cipher_xform = xform;
		auth_xform = xform->next;
		break;
	case MRVL_CRYPTO_CHAIN_AUTH_CIPHER:
		auth_xform = xform;
		cipher_xform = xform->next;
		break;
	case MRVL_CRYPTO_CHAIN_CIPHER_ONLY:
		cipher_xform = xform;
		break;
	case MRVL_CRYPTO_CHAIN_AUTH_ONLY:
		auth_xform = xform;
		break;
	case MRVL_CRYPTO_CHAIN_COMBINED:
		aead_xform = xform;
		break;
	default:
		return -EINVAL;
	}
	if ((cipher_xform != NULL) &&
		(mrvl_crypto_set_cipher_session_parameters(
			sess, cipher_xform) < 0)) {
		MRVL_LOG(ERR, "Invalid/unsupported cipher parameters!");
		return -EINVAL;
	}
	if ((auth_xform != NULL) &&
		(mrvl_crypto_set_auth_session_parameters(
			sess, auth_xform) < 0)) {
		MRVL_LOG(ERR, "Invalid/unsupported auth parameters!");
		return -EINVAL;
	}
	if ((aead_xform != NULL) &&
		(mrvl_crypto_set_aead_session_parameters(
			sess, aead_xform) < 0)) {
		MRVL_LOG(ERR, "Invalid/unsupported aead parameters!");
		return -EINVAL;
	}
	return 0;
}
int mrvl_crypto_set_session_parameters ( struct mrvl_crypto_session * sess , const struct rte_crypto_sym_xform * xform ) { const struct rte_crypto_sym_xform * cipher_xform = NULL ; const struct rte_crypto_sym_xform * auth_xform = NULL ; const struct rte_crypto_sym_xform * aead_xform = NULL ; if ( xform == NULL ) return - EINVAL ; sess -> chain_order = mrvl_crypto_get_chain_order ( xform ) ; switch ( sess -> chain_order ) { case MRVL_CRYPTO_CHAIN_CIPHER_AUTH : cipher_xform = xform ; auth_xform = xform -> next ; break ; case MRVL_CRYPTO_CHAIN_AUTH_CIPHER : auth_xform = xform ; cipher_xform = xform -> next ; break ; case MRVL_CRYPTO_CHAIN_CIPHER_ONLY : cipher_xform = xform ; break ; case MRVL_CRYPTO_CHAIN_AUTH_ONLY : auth_xform = xform ; break ; case MRVL_CRYPTO_CHAIN_COMBINED : aead_xform = xform ; break ; default : return - EINVAL ; } if ( ( cipher_xform != NULL ) && ( mrvl_crypto_set_cipher_session_parameters ( sess , cipher_xform ) < 0 ) ) { MRVL_LOG ( ERR , " " ) ; return - EINVAL ; } if ( ( auth_xform != NULL ) && ( mrvl_crypto_set_auth_session_parameters ( sess , auth_xform ) < 0 ) ) { MRVL_LOG ( ERR , " " ) ; return - EINVAL ; } if ( ( aead_xform != NULL ) && ( mrvl_crypto_set_aead_session_parameters ( sess , aead_xform ) < 0 ) ) { MRVL_LOG ( ERR , " " ) ; return - EINVAL ; } return 0 ; }
Parse crypto transform chain and setup session parameters.
Parse crypto transform chain and setup session parameters .
/* Filter out spurious/broken requests */