12c6ffdb0SEd Tanous #pragma once 22c6ffdb0SEd Tanous 3c160ae72SEd Tanous #include "logging.hpp" 4c160ae72SEd Tanous 52c6ffdb0SEd Tanous #include <limits> 62c6ffdb0SEd Tanous #include <string> 72c6ffdb0SEd Tanous 82c6ffdb0SEd Tanous namespace bmcweb 92c6ffdb0SEd Tanous { 102c6ffdb0SEd Tanous 112c6ffdb0SEd Tanous struct OpenSSLGenerator 122c6ffdb0SEd Tanous { 13*b7f3a82bSEd Tanous uint8_t operator()(); 142c6ffdb0SEd Tanous maxbmcweb::OpenSSLGenerator152c6ffdb0SEd Tanous static constexpr uint8_t max() 162c6ffdb0SEd Tanous { 172c6ffdb0SEd Tanous return std::numeric_limits<uint8_t>::max(); 182c6ffdb0SEd Tanous } minbmcweb::OpenSSLGenerator192c6ffdb0SEd Tanous static constexpr uint8_t min() 202c6ffdb0SEd Tanous { 212c6ffdb0SEd Tanous return std::numeric_limits<uint8_t>::min(); 222c6ffdb0SEd Tanous } 232c6ffdb0SEd Tanous errorbmcweb::OpenSSLGenerator242c6ffdb0SEd Tanous bool error() const 252c6ffdb0SEd Tanous { 262c6ffdb0SEd Tanous return err; 272c6ffdb0SEd Tanous } 282c6ffdb0SEd Tanous 292c6ffdb0SEd Tanous // all generators require this variable 302c6ffdb0SEd Tanous using result_type = uint8_t; 312c6ffdb0SEd Tanous 322c6ffdb0SEd Tanous private: 332c6ffdb0SEd Tanous // RAND_bytes() returns 1 on success, 0 otherwise. -1 if bad function 342c6ffdb0SEd Tanous static constexpr int opensslSuccess = 1; 352c6ffdb0SEd Tanous bool err = false; 362c6ffdb0SEd Tanous }; 372c6ffdb0SEd Tanous 382c6ffdb0SEd Tanous std::string getRandomUUID(); 392c6ffdb0SEd Tanous 40*b7f3a82bSEd Tanous std::string getRandomIdOfLength(size_t length); 41*b7f3a82bSEd Tanous 422c6ffdb0SEd Tanous } // namespace bmcweb 43