Skip to content

Commit

Permalink
cryptodev: fix asymmetric private session variable size
Browse files Browse the repository at this point in the history
When creating the asymmetric session mempool, the maximum private
session size of all devices is used when creating the mempool
object size.
The return value for ``rte_cryptodev_asym_get_private_session_size``
is unsigned int, whereas the variable was uint8_t, leading to a
possible overflow issue.

To fix this, the variable for private session size is now changed to
unsigned int to match the function return type.

Fixes: 1f1e4b7 ("cryptodev: use single mempool for asymmetric session")

Reported-by: Arek Kusztal <[email protected]>
Signed-off-by: Ciara Power <[email protected]>
Acked-by: Fan Zhang <[email protected]>
Acked-by: Arek Kusztal <[email protected]>
  • Loading branch information
ciarapow authored and Akhil Goyal committed Feb 22, 2022
1 parent f819a16 commit 080c84c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/cryptodev/rte_cryptodev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,8 @@ rte_cryptodev_asym_session_pool_create(const char *name, uint32_t nb_elts,
struct rte_mempool *mp;
struct rte_cryptodev_asym_session_pool_private_data *pool_priv;
uint32_t obj_sz, obj_sz_aligned;
uint8_t dev_id, priv_sz, max_priv_sz = 0;
uint8_t dev_id;
unsigned int priv_sz, max_priv_sz = 0;

for (dev_id = 0; dev_id < RTE_CRYPTO_MAX_DEVS; dev_id++)
if (rte_cryptodev_is_valid_dev(dev_id)) {
Expand Down

0 comments on commit 080c84c

Please sign in to comment.