Skip to content

Commit 015f535

Browse files
shemmingerdavid-marchand
authored andcommitted
pipeline: use a better random generator
The rand() function is weak and using it for salt might be a future security issue. Use rte_rand() which has a bigger period and more secure. Signed-off-by: Stephen Hemminger <[email protected]> Reviewed-by: Tyler Retzlaff <[email protected]>
1 parent a02b2a2 commit 015f535

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/pipeline/rte_swx_ipsec.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <arpa/inet.h>
1010

1111
#include <rte_common.h>
12+
#include <rte_random.h>
1213
#include <rte_ip.h>
1314
#include <rte_tailq.h>
1415
#include <rte_eal_memconfig.h>
@@ -1455,7 +1456,7 @@ crypto_xform_get(struct rte_swx_ipsec_sa_params *p,
14551456
switch (p->crypto.cipher_auth.cipher.alg) {
14561457
case RTE_CRYPTO_CIPHER_AES_CBC:
14571458
case RTE_CRYPTO_CIPHER_3DES_CBC:
1458-
salt = (uint32_t)rand();
1459+
salt = rte_rand();
14591460
break;
14601461

14611462
case RTE_CRYPTO_CIPHER_AES_CTR:

0 commit comments

Comments
 (0)