src/dpdk/drivers/crypto/openssl/rte_openssl_pmd.c
int
openssl_set_session_parameters(struct openssl_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;
	int ret;

	sess->chain_order = openssl_get_chain_order(xform);
	switch (sess->chain_order) {
	case OPENSSL_CHAIN_ONLY_CIPHER:
		cipher_xform = xform;
		break;
	case OPENSSL_CHAIN_ONLY_AUTH:
		auth_xform = xform;
		break;
	case OPENSSL_CHAIN_CIPHER_AUTH:
		cipher_xform = xform;
		auth_xform = xform->next;
		break;
	case OPENSSL_CHAIN_AUTH_CIPHER:
		auth_xform = xform;
		cipher_xform = xform->next;
		break;
	case OPENSSL_CHAIN_COMBINED:
		aead_xform = xform;
		break;
	default:
		return -EINVAL;
	}

	/* Default IV length = 0 */
	sess->iv.length = 0;

	/* cipher_xform must be check before auth_xform */
	if (cipher_xform) {
		ret = openssl_set_session_cipher_parameters(
				sess, cipher_xform);
		if (ret != 0) {
			OPENSSL_LOG(ERR,
				"Invalid/unsupported cipher parameters");
			return ret;
		}
	}

	if (auth_xform) {
		ret = openssl_set_session_auth_parameters(sess, auth_xform);
		if (ret != 0) {
			OPENSSL_LOG(ERR,
				"Invalid/unsupported auth parameters");
			return ret;
		}
	}

	if (aead_xform) {
		ret = openssl_set_session_aead_parameters(sess, aead_xform);
		if (ret != 0) {
			OPENSSL_LOG(ERR,
				"Invalid/unsupported AEAD parameters");
			return ret;
		}
	}

	return 0;
}
/** Parse crypto xform chain and set private session parameters */
Parse crypto xform chain and set private session parameters
Parse crypto xform chain and set private session parameters
int
openssl_set_session_parameters(struct openssl_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;
	int ret;
	sess->chain_order = openssl_get_chain_order(xform);
	switch (sess->chain_order) {
	case OPENSSL_CHAIN_ONLY_CIPHER:
		cipher_xform = xform;
		break;
	case OPENSSL_CHAIN_ONLY_AUTH:
		auth_xform = xform;
		break;
	case OPENSSL_CHAIN_CIPHER_AUTH:
		cipher_xform = xform;
		auth_xform = xform->next;
		break;
	case OPENSSL_CHAIN_AUTH_CIPHER:
		auth_xform = xform;
		cipher_xform = xform->next;
		break;
	case OPENSSL_CHAIN_COMBINED:
		aead_xform = xform;
		break;
	default:
		return -EINVAL;
	}
	sess->iv.length = 0;
	if (cipher_xform) {
		ret = openssl_set_session_cipher_parameters(
				sess, cipher_xform);
		if (ret != 0) {
			OPENSSL_LOG(ERR,
				"Invalid/unsupported cipher parameters");
			return ret;
		}
	}
	if (auth_xform) {
		ret = openssl_set_session_auth_parameters(sess, auth_xform);
		if (ret != 0) {
			OPENSSL_LOG(ERR,
				"Invalid/unsupported auth parameters");
			return ret;
		}
	}
	if (aead_xform) {
		ret = openssl_set_session_aead_parameters(sess, aead_xform);
		if (ret != 0) {
			OPENSSL_LOG(ERR,
				"Invalid/unsupported AEAD parameters");
			return ret;
		}
	}
	return 0;
}
int openssl_set_session_parameters ( struct openssl_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 ; int ret ; sess -> chain_order = openssl_get_chain_order ( xform ) ; switch ( sess -> chain_order ) { case OPENSSL_CHAIN_ONLY_CIPHER : cipher_xform = xform ; break ; case OPENSSL_CHAIN_ONLY_AUTH : auth_xform = xform ; break ; case OPENSSL_CHAIN_CIPHER_AUTH : cipher_xform = xform ; auth_xform = xform -> next ; break ; case OPENSSL_CHAIN_AUTH_CIPHER : auth_xform = xform ; cipher_xform = xform -> next ; break ; case OPENSSL_CHAIN_COMBINED : aead_xform = xform ; break ; default : return - EINVAL ; } sess -> iv . length = 0 ; if ( cipher_xform ) { ret = openssl_set_session_cipher_parameters ( sess , cipher_xform ) ; if ( ret != 0 ) { OPENSSL_LOG ( ERR , " " ) ; return ret ; } } if ( auth_xform ) { ret = openssl_set_session_auth_parameters ( sess , auth_xform ) ; if ( ret != 0 ) { OPENSSL_LOG ( ERR , " " ) ; return ret ; } } if ( aead_xform ) { ret = openssl_set_session_aead_parameters ( sess , aead_xform ) ; if ( ret != 0 ) { OPENSSL_LOG ( ERR , " " ) ; return ret ; } } return 0 ; }
Parse crypto xform chain and set private session parameters
Parse crypto xform chain and set private session parameters
/* Default IV length = 0 */ /* cipher_xform must be check before auth_xform */