RTE_CACHE_LINE_SIZE);
if (unlikely(!fle)) {
DPAA2_SEC_DP_ERR("Proto:SG: Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs));
DPAA2_SET_FLE_ADDR(fle, (size_t)op);
retval = rte_mempool_get(priv->fle_pool, (void **)(&fle));
if (retval) {
DPAA2_SEC_DP_ERR("Memory alloc failed");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_POOL_BUF_SIZE);
DPAA2_SET_FLE_ADDR(fle, (size_t)op);
RTE_CACHE_LINE_SIZE);
if (unlikely(!fle)) {
DPAA2_SEC_ERR("GCM SG: Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs));
DPAA2_SET_FLE_ADDR(fle, (size_t)op);
retval = rte_mempool_get(priv->fle_pool, (void **)(&fle));
if (retval) {
DPAA2_SEC_ERR("GCM: Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_POOL_BUF_SIZE);
DPAA2_SET_FLE_ADDR(fle, (size_t)op);
RTE_CACHE_LINE_SIZE);
if (unlikely(!fle)) {
DPAA2_SEC_ERR("AUTHENC SG: Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs));
DPAA2_SET_FLE_ADDR(fle, (size_t)op);
retval = rte_mempool_get(priv->fle_pool, (void **)(&fle));
if (retval) {
DPAA2_SEC_ERR("Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_POOL_BUF_SIZE);
DPAA2_SET_FLE_ADDR(fle, (size_t)op);
sess->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) {
if ((data_len & 7) || (data_offset & 7)) {
DPAA2_SEC_ERR("AUTH: len/offset must be full bytes");
- return -1;
+ return -ENOTSUP;
}
data_len = data_len >> 3;
RTE_CACHE_LINE_SIZE);
if (unlikely(!fle)) {
DPAA2_SEC_ERR("AUTH SG: Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs));
/* first FLE entry used to store mbuf and session ctxt */
sess->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) {
if ((data_len & 7) || (data_offset & 7)) {
DPAA2_SEC_ERR("AUTH: len/offset must be full bytes");
- return -1;
+ return -ENOTSUP;
}
data_len = data_len >> 3;
retval = rte_mempool_get(priv->fle_pool, (void **)(&fle));
if (retval) {
DPAA2_SEC_ERR("AUTH Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_POOL_BUF_SIZE);
/* TODO we are using the first FLE entry to store Mbuf.
sess->cipher_alg == RTE_CRYPTO_CIPHER_ZUC_EEA3) {
if ((data_len & 7) || (data_offset & 7)) {
DPAA2_SEC_ERR("CIPHER: len/offset must be full bytes");
- return -1;
+ return -ENOTSUP;
}
data_len = data_len >> 3;
RTE_CACHE_LINE_SIZE);
if (!fle) {
DPAA2_SEC_ERR("CIPHER SG: Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_SG_MEM_SIZE(mbuf->nb_segs + sym_op->m_src->nb_segs));
/* first FLE entry used to store mbuf and session ctxt */
sess->cipher_alg == RTE_CRYPTO_CIPHER_ZUC_EEA3) {
if ((data_len & 7) || (data_offset & 7)) {
DPAA2_SEC_ERR("CIPHER: len/offset must be full bytes");
- return -1;
+ return -ENOTSUP;
}
data_len = data_len >> 3;
retval = rte_mempool_get(priv->fle_pool, (void **)(&fle));
if (retval) {
DPAA2_SEC_ERR("CIPHER: Memory alloc failed for SGE");
- return -1;
+ return -ENOMEM;
}
memset(fle, 0, FLE_POOL_BUF_SIZE);
/* TODO we are using the first FLE entry to store Mbuf.
op->sym->sec_session);
#endif
else
- return -1;
+ return -ENOTSUP;
if (!sess)
- return -1;
+ return -EINVAL;
/* Any of the buffer is segmented*/
if (!rte_pktmbuf_is_contiguous(op->sym->m_src) ||
case DPAA2_SEC_HASH_CIPHER:
default:
DPAA2_SEC_ERR("error: Unsupported session");
+ ret = -ENOTSUP;
}
}
return ret;
RTE_CACHE_LINE_SIZE);
if (!qp) {
DPAA2_SEC_ERR("malloc failed for rx/tx queues");
- return -1;
+ return -ENOMEM;
}
qp->rx_vq.crypto_data = dev->data;
RTE_CACHE_LINE_SIZE);
if (!qp->rx_vq.q_storage) {
DPAA2_SEC_ERR("malloc failed for q_storage");
- return -1;
+ return -ENOMEM;
}
memset(qp->rx_vq.q_storage, 0, sizeof(struct queue_storage_info_t));
if (dpaa2_alloc_dq_storage(qp->rx_vq.q_storage)) {
DPAA2_SEC_ERR("Unable to allocate dequeue storage");
- return -1;
+ return -ENOMEM;
}
dev->data->queue_pairs[qp_id] = qp;
{
struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
struct alginfo cipherdata;
- int bufsize;
+ int bufsize, ret = 0;
struct ctxt_priv *priv;
struct sec_flow_context *flc;
RTE_CACHE_LINE_SIZE);
if (priv == NULL) {
DPAA2_SEC_ERR("No Memory for priv CTXT");
- return -1;
+ return -ENOMEM;
}
priv->fle_pool = dev_priv->fle_pool;
if (session->cipher_key.data == NULL) {
DPAA2_SEC_ERR("No Memory for cipher key");
rte_free(priv);
- return -1;
+ return -ENOMEM;
}
session->cipher_key.length = xform->cipher.key.length;
case RTE_CRYPTO_CIPHER_NULL:
DPAA2_SEC_ERR("Crypto: Unsupported Cipher alg %u",
xform->cipher.algo);
+ ret = -ENOTSUP;
goto error_out;
default:
DPAA2_SEC_ERR("Crypto: Undefined Cipher specified %u",
xform->cipher.algo);
+ ret = -ENOTSUP;
goto error_out;
}
if (bufsize < 0) {
DPAA2_SEC_ERR("Crypto: Descriptor build failed");
+ ret = -EINVAL;
goto error_out;
}
for (i = 0; i < bufsize; i++)
DPAA2_SEC_DEBUG("DESC[%d]:0x%x", i, priv->flc_desc[0].desc[i]);
#endif
- return 0;
+ return ret;
error_out:
rte_free(session->cipher_key.data);
rte_free(priv);
- return -1;
+ return ret;
}
static int
{
struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
struct alginfo authdata;
- int bufsize;
+ int bufsize, ret = 0;
struct ctxt_priv *priv;
struct sec_flow_context *flc;
RTE_CACHE_LINE_SIZE);
if (priv == NULL) {
DPAA2_SEC_ERR("No Memory for priv CTXT");
- return -1;
+ return -ENOMEM;
}
priv->fle_pool = dev_priv->fle_pool;
if (session->auth_key.data == NULL) {
DPAA2_SEC_ERR("Unable to allocate memory for auth key");
rte_free(priv);
- return -1;
+ return -ENOMEM;
}
session->auth_key.length = xform->auth.key.length;
case RTE_CRYPTO_AUTH_AES_CBC_MAC:
DPAA2_SEC_ERR("Crypto: Unsupported auth alg %un",
xform->auth.algo);
+ ret = -ENOTSUP;
goto error_out;
default:
DPAA2_SEC_ERR("Crypto: Undefined Auth specified %u",
xform->auth.algo);
+ ret = -ENOTSUP;
goto error_out;
}
if (bufsize < 0) {
DPAA2_SEC_ERR("Crypto: Invalid buffer length");
+ ret = -EINVAL;
goto error_out;
}
i, priv->flc_desc[DESC_INITFINAL].desc[i]);
#endif
- return 0;
+ return ret;
error_out:
rte_free(session->auth_key.data);
rte_free(priv);
- return -1;
+ return ret;
}
static int
struct ctxt_priv *priv;
struct sec_flow_context *flc;
struct rte_crypto_aead_xform *aead_xform = &xform->aead;
- int err;
+ int err, ret = 0;
PMD_INIT_FUNC_TRACE();
RTE_CACHE_LINE_SIZE);
if (priv == NULL) {
DPAA2_SEC_ERR("No Memory for priv CTXT");
- return -1;
+ return -ENOMEM;
}
priv->fle_pool = dev_priv->fle_pool;
if (session->aead_key.data == NULL && aead_xform->key.length > 0) {
DPAA2_SEC_ERR("No Memory for aead key");
rte_free(priv);
- return -1;
+ return -ENOMEM;
}
memcpy(session->aead_key.data, aead_xform->key.data,
aead_xform->key.length);
case RTE_CRYPTO_AEAD_AES_CCM:
DPAA2_SEC_ERR("Crypto: Unsupported AEAD alg %u",
aead_xform->algo);
+ ret = -ENOTSUP;
goto error_out;
default:
DPAA2_SEC_ERR("Crypto: Undefined AEAD specified %u",
aead_xform->algo);
+ ret = -ENOTSUP;
goto error_out;
}
session->dir = (aead_xform->op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ?
if (err < 0) {
DPAA2_SEC_ERR("Crypto: Incorrect key lengths");
+ ret = -EINVAL;
goto error_out;
}
if (priv->flc_desc[0].desc[1] & 1) {
session->digest_length);
if (bufsize < 0) {
DPAA2_SEC_ERR("Crypto: Invalid buffer length");
+ ret = -EINVAL;
goto error_out;
}
DPAA2_SEC_DEBUG("DESC[%d]:0x%x\n",
i, priv->flc_desc[0].desc[i]);
#endif
- return 0;
+ return ret;
error_out:
rte_free(session->aead_key.data);
rte_free(priv);
- return -1;
+ return ret;
}
struct sec_flow_context *flc;
struct rte_crypto_cipher_xform *cipher_xform;
struct rte_crypto_auth_xform *auth_xform;
- int err;
+ int err, ret = 0;
PMD_INIT_FUNC_TRACE();
RTE_CACHE_LINE_SIZE);
if (priv == NULL) {
DPAA2_SEC_ERR("No Memory for priv CTXT");
- return -1;
+ return -ENOMEM;
}
priv->fle_pool = dev_priv->fle_pool;
if (session->cipher_key.data == NULL && cipher_xform->key.length > 0) {
DPAA2_SEC_ERR("No Memory for cipher key");
rte_free(priv);
- return -1;
+ return -ENOMEM;
}
session->cipher_key.length = cipher_xform->key.length;
session->auth_key.data = rte_zmalloc(NULL, auth_xform->key.length,
DPAA2_SEC_ERR("No Memory for auth key");
rte_free(session->cipher_key.data);
rte_free(priv);
- return -1;
+ return -ENOMEM;
}
session->auth_key.length = auth_xform->key.length;
memcpy(session->cipher_key.data, cipher_xform->key.data,
case RTE_CRYPTO_AUTH_ZUC_EIA3:
DPAA2_SEC_ERR("Crypto: Unsupported auth alg %u",
auth_xform->algo);
+ ret = -ENOTSUP;
goto error_out;
default:
DPAA2_SEC_ERR("Crypto: Undefined Auth specified %u",
auth_xform->algo);
+ ret = -ENOTSUP;
goto error_out;
}
cipherdata.key = (size_t)session->cipher_key.data;
case RTE_CRYPTO_CIPHER_KASUMI_F8:
DPAA2_SEC_ERR("Crypto: Unsupported Cipher alg %u",
cipher_xform->algo);
+ ret = -ENOTSUP;
goto error_out;
default:
DPAA2_SEC_ERR("Crypto: Undefined Cipher specified %u",
cipher_xform->algo);
+ ret = -ENOTSUP;
goto error_out;
}
session->dir = (cipher_xform->op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
if (err < 0) {
DPAA2_SEC_ERR("Crypto: Incorrect key lengths");
+ ret = -EINVAL;
goto error_out;
}
if (priv->flc_desc[0].desc[2] & 1) {
session->dir);
if (bufsize < 0) {
DPAA2_SEC_ERR("Crypto: Invalid buffer length");
+ ret = -EINVAL;
goto error_out;
}
} else {
DPAA2_SEC_ERR("Hash before cipher not supported");
+ ret = -ENOTSUP;
goto error_out;
}
i, priv->flc_desc[0].desc[i]);
#endif
- return 0;
+ return ret;
error_out:
rte_free(session->cipher_key.data);
rte_free(session->auth_key.data);
rte_free(priv);
- return -1;
+ return ret;
}
static int
if (unlikely(sess == NULL)) {
DPAA2_SEC_ERR("Invalid session struct");
- return -1;
+ return -EINVAL;
}
memset(session, 0, sizeof(dpaa2_sec_session));
RTE_CACHE_LINE_SIZE);
if (session->aead_key.data == NULL && aead_xform->key.length > 0) {
DPAA2_SEC_ERR("No Memory for aead key");
- return -1;
+ return -ENOMEM;
}
memcpy(session->aead_key.data, aead_xform->key.data,
aead_xform->key.length);
default:
DPAA2_SEC_ERR("Crypto: Undefined GCM digest %d",
session->digest_length);
- return -1;
+ return -EINVAL;
}
aeaddata->algmode = OP_ALG_AAI_GCM;
session->aead_alg = RTE_CRYPTO_AEAD_AES_GCM;
default:
DPAA2_SEC_ERR("Crypto: Undefined CCM digest %d",
session->digest_length);
- return -1;
+ return -EINVAL;
}
aeaddata->algmode = OP_ALG_AAI_CCM;
session->aead_alg = RTE_CRYPTO_AEAD_AES_CCM;
default:
DPAA2_SEC_ERR("Crypto: Undefined AEAD specified %u",
aead_xform->algo);
- return -1;
+ return -ENOTSUP;
}
session->dir = (aead_xform->op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ?
DIR_ENC : DIR_DEC;
case RTE_CRYPTO_AUTH_ZUC_EIA3:
DPAA2_SEC_ERR("Crypto: Unsupported auth alg %u",
session->auth_alg);
- return -1;
+ return -ENOTSUP;
default:
DPAA2_SEC_ERR("Crypto: Undefined Auth specified %u",
session->auth_alg);
- return -1;
+ return -ENOTSUP;
}
cipherdata->key = (size_t)session->cipher_key.data;
cipherdata->keylen = session->cipher_key.length;
case RTE_CRYPTO_CIPHER_KASUMI_F8:
DPAA2_SEC_ERR("Crypto: Unsupported Cipher alg %u",
session->cipher_alg);
- return -1;
+ return -ENOTSUP;
default:
DPAA2_SEC_ERR("Crypto: Undefined Cipher specified %u",
session->cipher_alg);
- return -1;
+ return -ENOTSUP;
}
return 0;
rte_free(session->auth_key.data);
rte_free(session->cipher_key.data);
rte_free(priv);
- return -1;
+ return -EINVAL;
}
static int
if (!dpseci) {
DPAA2_SEC_ERR(
"Error in allocating the memory for dpsec object");
- return -1;
+ return -ENOMEM;
}
dpseci->regs = rte_mcp_ptr_list[0];