The hash initial value for the security association database was taken from rte_rand(). A predictable hash seed lets an attacker pick SPI values that collide in the same bucket and degrade lookups.
Use rte_random_bytes(), which is done once when the database is created. Signed-off-by: Stephen Hemminger <[email protected]> --- lib/ipsec/ipsec_sad.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ipsec/ipsec_sad.c b/lib/ipsec/ipsec_sad.c index 15ea868f77..0ea797604e 100644 --- a/lib/ipsec/ipsec_sad.c +++ b/lib/ipsec/ipsec_sad.c @@ -300,7 +300,12 @@ rte_ipsec_sad_create(const char *name, const struct rte_ipsec_sad_conf *conf) memcpy(sad->name, sad_name, sizeof(sad_name)); hash_params.hash_func = DEFAULT_HASH_FUNC; - hash_params.hash_func_init_val = rte_rand(); + if (rte_random_bytes(&hash_params.hash_func_init_val, + sizeof(hash_params.hash_func_init_val)) != 0) { + rte_free(sad); + rte_errno = EIO; + return NULL; + } sad->init_val = hash_params.hash_func_init_val; hash_params.socket_id = conf->socket_id; hash_params.name = hash_name; -- 2.53.0

