From 2c6ffdb08b2207ff7c31041f77cc3755508d45c4 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Wed, 28 Jun 2023 11:28:38 -0700 Subject: Use openssl random number generator We already have a generator class. We should use it. Wrap this into a function that can be unit tested, and add unit tests. Note, some files also needed to change name, because random.hpp conflicts with the built in random, and causes circular build problems. This commit changes it to ossl_random. Tested: Unit tests pass. Now has coverage. Redfish service validator passes. Change-Id: I5f8eee1af5f4843a352c6fd0e26d67fd3320ef53 Signed-off-by: Ed Tanous --- src/ossl_random.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/ossl_random.cpp (limited to 'src') diff --git a/src/ossl_random.cpp b/src/ossl_random.cpp new file mode 100644 index 0000000000..f196a8b5a3 --- /dev/null +++ b/src/ossl_random.cpp @@ -0,0 +1,12 @@ +#include "ossl_random.hpp" + +#include +#include + +std::string bmcweb::getRandomUUID() +{ + using bmcweb::OpenSSLGenerator; + OpenSSLGenerator ossl; + return boost::uuids::to_string( + boost::uuids::basic_random_generator(ossl)()); +} -- cgit v1.2.3