Break out random ID methods

The method of creating a random ID from an openssl random generator of a
particular length is something that is generally useful, and something
we can write unit tests for.  Add it.

Tested:
Redfish service validator login flows work correctly in redfish service
validator.

Change-Id: Ic3b58d33f1421f3eb39e2d57585958f87f6fb8ea
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/include/ossl_random.hpp b/include/ossl_random.hpp
index 4d4bc04..0a92e37 100644
--- a/include/ossl_random.hpp
+++ b/include/ossl_random.hpp
@@ -2,11 +2,6 @@
 
 #include "logging.hpp"
 
-extern "C"
-{
-#include <openssl/rand.h>
-}
-
 #include <limits>
 #include <string>
 
@@ -15,18 +10,7 @@
 
 struct OpenSSLGenerator
 {
-    uint8_t operator()()
-    {
-        uint8_t index = 0;
-        int rc = RAND_bytes(&index, sizeof(index));
-        if (rc != opensslSuccess)
-        {
-            BMCWEB_LOG_ERROR("Cannot get random number");
-            err = true;
-        }
-
-        return index;
-    }
+    uint8_t operator()();
 
     static constexpr uint8_t max()
     {
@@ -53,4 +37,6 @@
 
 std::string getRandomUUID();
 
+std::string getRandomIdOfLength(size_t length);
+
 } // namespace bmcweb