MCPcopy Create free account
hub / github.com/F-Stack/f-stack / generate_random_key

Function generate_random_key

dpdk/examples/l2fwd-crypto/main.c:654–669  ·  view source on GitHub ↗

Generate random key */

Source from the content-addressed store, hash-verified

652
653/** Generate random key */
654static void
655generate_random_key(uint8_t *key, unsigned length)
656{
657 int fd;
658 int ret;
659
660 fd = open("/dev/urandom", O_RDONLY);
661 if (fd < 0)
662 rte_exit(EXIT_FAILURE, "Failed to generate random key\n");
663
664 ret = read(fd, key, length);
665 close(fd);
666
667 if (ret != (signed)length)
668 rte_exit(EXIT_FAILURE, "Failed to generate random key\n");
669}
670
671/* Session is created and is later attached to the crypto operation. 8< */
672static void *

Callers 2

l2fwd_main_loopFunction · 0.85
initialize_cryptodevsFunction · 0.85

Calls 3

rte_exitFunction · 0.85
readFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected