Skip to content

Commit

Permalink
drivers/crypto: fix session-less mode
Browse files Browse the repository at this point in the history
[ upstream commit a0c2b3d ]

When OpenSSL or AESNI-MB cryptodev is being used in sessionless mode
for symmetric crypto operation (e.g. SHA256 hash), the driver prints
error message:

    CRYPTODEV: set_sym_session_private_data() line 489:
               Set private data for driver 0 not allowed

Then, AESNI-MB driver segfaults in post_process_mb_job().

Bugzilla ID: 377
Fixes: b3bbd9e ("cryptodev: support device independent sessions")
Fixes: c68d7aa ("crypto/aesni_mb: use architecture independent macros")

Signed-off-by: Junxiao Shi <git@mail1.yoursunny.com>
  • Loading branch information
yoursunny authored and kevintraynor committed Feb 19, 2020
1 parent 68f15f0 commit fc86473
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
Expand Up @@ -662,10 +662,10 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
op->sym->session,
cryptodev_driver_id);
} else {
void *_sess = NULL;
void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp);
void *_sess_private_data = NULL;

if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
if (_sess == NULL)
return NULL;

if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
Expand Down
4 changes: 2 additions & 2 deletions drivers/crypto/openssl/rte_openssl_pmd.c
Expand Up @@ -762,10 +762,10 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
return NULL;

/* provide internal session */
void *_sess = NULL;
void *_sess = rte_cryptodev_sym_session_create(qp->sess_mp);
void *_sess_private_data = NULL;

if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
if (_sess == NULL)
return NULL;

if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
Expand Down

0 comments on commit fc86473

Please sign in to comment.