diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1300c23..3bedfe7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,7 +60,7 @@
 
 set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
-set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
 
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
diff --git a/crow/include/crow/http_connection.h b/crow/include/crow/http_connection.h
index c02f4ec..d7598bd 100644
--- a/crow/include/crow/http_connection.h
+++ b/crow/include/crow/http_connection.h
@@ -345,7 +345,7 @@
             };
 
             ctx = detail::Context<Middlewares...>();
-            req->middlewareContext = (void*)&ctx;
+            req->middlewareContext = static_cast<void*>(&ctx);
             req->ioService = &adaptor.get_executor().context();
             detail::middlewareCallHelper<
                 0, decltype(ctx), decltype(*middlewares), Middlewares...>(
@@ -388,14 +388,13 @@
             needToCallAfterHandlers = false;
 
             // call all afterHandler of middlewares
-            detail::afterHandlersCallHelper<((int)sizeof...(Middlewares) - 1),
-                                            decltype(ctx),
-                                            decltype(*middlewares)>(
-                *middlewares, ctx, *req, res);
+            detail::afterHandlersCallHelper<
+                static_cast<int>(sizeof...(Middlewares) - 1), decltype(ctx),
+                decltype(*middlewares)>(*middlewares, ctx, *req, res);
         }
 
         // auto self = this->shared_from_this();
-        res.completeRequestHandler = res.completeRequestHandler = [] {};
+        res.completeRequestHandler = [] {};
 
         if (!adaptor.lowest_layer().is_open())
         {
diff --git a/crow/include/crow/http_request.h b/crow/include/crow/http_request.h
index 0ba0266..fa12c26 100644
--- a/crow/include/crow/http_request.h
+++ b/crow/include/crow/http_request.h
@@ -27,7 +27,7 @@
     {
     }
 
-    const boost::beast::http::verb method() const
+    boost::beast::http::verb method() const
     {
         return req.method();
     }
diff --git a/crow/include/crow/http_server.h b/crow/include/crow/http_server.h
index 75b49a4..eace64f 100644
--- a/crow/include/crow/http_server.h
+++ b/crow/include/crow/http_server.h
@@ -121,17 +121,17 @@
         boost::asio::deadline_timer timer(*ioService);
         timer.expires_from_now(boost::posix_time::seconds(1));
 
-        std::function<void(const boost::system::error_code& ec)> handler;
-        handler = [&](const boost::system::error_code& ec) {
+        std::function<void(const boost::system::error_code& ec)> fHandler;
+        fHandler = [&](const boost::system::error_code& ec) {
             if (ec)
             {
                 return;
             }
             timerQueue.process();
             timer.expires_from_now(boost::posix_time::seconds(1));
-            timer.async_wait(handler);
+            timer.async_wait(fHandler);
         };
-        timer.async_wait(handler);
+        timer.async_wait(fHandler);
 
         if (tickFunction && tickInterval.count() > 0)
         {
diff --git a/crow/include/crow/logging.h b/crow/include/crow/logging.h
index 9da47b7..0d24940 100644
--- a/crow/include/crow/logging.h
+++ b/crow/include/crow/logging.h
@@ -30,6 +30,7 @@
 {
   public:
     virtual void log(std::string message, LogLevel level) = 0;
+    virtual ~ILogHandler(){};
 };
 
 class CerrLogHandler : public ILogHandler
diff --git a/crow/include/crow/query_string.h b/crow/include/crow/query_string.h
index 553960e..b38d0ed 100644
--- a/crow/include/crow/query_string.h
+++ b/crow/include/crow/query_string.h
@@ -19,16 +19,16 @@
  *  Also decodes the value portion of the k/v pair *in-place*.  In a future
  *  enhancement it will also have a compile-time option of sorting qs_kv
  *  alphabetically by key.  */
-int qsParse(char* qs, char* qs_kv[], int qs_kv_size);
+size_t qsParse(char* qs, char* qs_kv[], size_t qs_kv_size);
 
 /*  Used by qs_parse to decode the value portion of a k/v pair  */
-int qsDecode(char* qs);
+size_t qsDecode(char* qs);
 
 /*  Looks up the value according to the key on a pre-processed query string
  *  A future enhancement will be a compile-time option to look up the key
  *  in a pre-sorted qs_kv array via a binary search.  */
 // char * qs_k2v(const char * key, char * qs_kv[], int qs_kv_size);
-char* qsK2v(const char* key, char* const* qs_kv, int qs_kv_size, int nth);
+char* qsK2v(const char* key, char* const* qs_kv, size_t qs_kv_size, size_t nth);
 
 /*  Non-destructive lookup of value, based on key.  User provides the
  *  destinaton string and length.  */
@@ -127,9 +127,9 @@
     }
 }
 
-inline int qsParse(char* qs, char* qs_kv[], int qs_kv_size)
+inline size_t qsParse(char* qs, char* qs_kv[], size_t qs_kv_size)
 {
-    int i, j;
+    size_t i, j;
     char* substrPtr;
 
     for (i = 0; i < qs_kv_size; i++)
@@ -184,9 +184,9 @@
     return i;
 }
 
-inline int qsDecode(char* qs)
+inline size_t qsDecode(char* qs)
 {
-    int i = 0, j = 0;
+    size_t i = 0, j = 0;
 
     while (BMCWEB_QS_ISQSCHR(qs[j]))
     {
@@ -217,10 +217,10 @@
     return i;
 }
 
-inline char* qsK2v(const char* key, char* const* qs_kv, int qs_kv_size,
-                   int nth = 0)
+inline char* qsK2v(const char* key, char* const* qs_kv, size_t qs_kv_size,
+                   size_t nth = 0)
 {
-    int i;
+    size_t i;
     size_t keyLen, skip;
 
     keyLen = strlen(key);
@@ -353,7 +353,8 @@
 
         keyValuePairs.resize(maxKeyValuePairsCount);
 
-        int count = qsParse(&url[0], &keyValuePairs[0], maxKeyValuePairsCount);
+        size_t count =
+            qsParse(&url[0], &keyValuePairs[0], maxKeyValuePairsCount);
         keyValuePairs.resize(count);
     }
 
@@ -391,7 +392,7 @@
         std::string plus = name + "[]";
         char* element = nullptr;
 
-        int count = 0;
+        size_t count = 0;
         while (1)
         {
             element = qsK2v(plus.c_str(), keyValuePairs.data(),
diff --git a/crow/include/crow/routing.h b/crow/include/crow/routing.h
index 746e115..d7e3fd3 100644
--- a/crow/include/crow/routing.h
+++ b/crow/include/crow/routing.h
@@ -63,7 +63,8 @@
     }
 
   protected:
-    uint32_t methodsBitfield{1 << (int)boost::beast::http::verb::get};
+    uint32_t methodsBitfield{
+        1 << static_cast<int>(boost::beast::http::verb::get)};
 
     std::string rule;
     std::string nameStr;
@@ -362,29 +363,33 @@
     using self_t = T;
     WebSocketRule& websocket()
     {
-        auto p = new WebSocketRule(((self_t*)this)->rule);
-        ((self_t*)this)->ruleToUpgrade.reset(p);
+        self_t* s = static_cast<self_t*>(this);
+        auto p = new WebSocketRule(s->rule);
+        s->ruleToUpgrade.reset(p);
         return *p;
     }
 
     self_t& name(std::string name) noexcept
     {
-        ((self_t*)this)->nameStr = std::move(name);
-        return (self_t&)*this;
+        self_t* s = static_cast<self_t*>(this);
+        s->nameStr = std::move(name);
+        return *s;
     }
 
     self_t& methods(boost::beast::http::verb method)
     {
-        ((self_t*)this)->methodsBitfield = 1 << (int)method;
-        return (self_t&)*this;
+        self_t* s = static_cast<self_t*>(this);
+        s->methodsBitfield = 1 << static_cast<int>(method);
+        return *s;
     }
 
     template <typename... MethodArgs>
     self_t& methods(boost::beast::http::verb method, MethodArgs... args_method)
     {
+        self_t* s = static_cast<self_t*>(this);
         methods(args_method...);
-        ((self_t*)this)->methodsBitfield |= 1 << (int)method;
-        return (self_t&)*this;
+        s->methodsBitfield |= 1 << static_cast<int>(method);
+        return *s;
     }
 };
 
@@ -581,7 +586,7 @@
     struct Node
     {
         unsigned ruleIndex{};
-        std::array<unsigned, (int)ParamType::MAX> paramChildrens{};
+        std::array<unsigned, static_cast<int>(ParamType::MAX)> paramChildrens{};
         boost::container::flat_map<std::string, unsigned> children;
 
         bool isSimpleNode() const
@@ -675,14 +680,15 @@
                     route_indexes.push_back(child->ruleIndex);
                 }
                 findRouteIndexes(req_url, route_indexes, child,
-                                 pos + fragment.size());
+                                 pos + static_cast<unsigned>(fragment.size()));
             }
             else
             {
                 if (req_url.compare(pos, fragment.size(), fragment) == 0)
                 {
-                    findRouteIndexes(req_url, route_indexes, child,
-                                     pos + fragment.size());
+                    findRouteIndexes(
+                        req_url, route_indexes, child,
+                        pos + static_cast<unsigned>(fragment.size()));
                 }
             }
         }
@@ -713,7 +719,7 @@
                 }
             };
 
-        if (node->paramChildrens[(int)ParamType::INT])
+        if (node->paramChildrens[static_cast<int>(ParamType::INT)])
         {
             char c = req_url[pos];
             if ((c >= '0' && c <= '9') || c == '+' || c == '-')
@@ -725,17 +731,18 @@
                 if (errno != ERANGE && eptr != req_url.data() + pos)
                 {
                     params->intParams.push_back(value);
-                    auto ret =
-                        find(req_url,
-                             &nodes[node->paramChildrens[(int)ParamType::INT]],
-                             eptr - req_url.data(), params);
+                    auto ret = find(
+                        req_url,
+                        &nodes[node->paramChildrens[static_cast<int>(
+                            ParamType::INT)]],
+                        static_cast<unsigned>(eptr - req_url.data()), params);
                     updateFound(ret);
                     params->intParams.pop_back();
                 }
             }
         }
 
-        if (node->paramChildrens[(int)ParamType::UINT])
+        if (node->paramChildrens[static_cast<int>(ParamType::UINT)])
         {
             char c = req_url[pos];
             if ((c >= '0' && c <= '9') || c == '+')
@@ -747,17 +754,18 @@
                 if (errno != ERANGE && eptr != req_url.data() + pos)
                 {
                     params->uintParams.push_back(value);
-                    auto ret =
-                        find(req_url,
-                             &nodes[node->paramChildrens[(int)ParamType::UINT]],
-                             eptr - req_url.data(), params);
+                    auto ret = find(
+                        req_url,
+                        &nodes[node->paramChildrens[static_cast<int>(
+                            ParamType::UINT)]],
+                        static_cast<unsigned>(eptr - req_url.data()), params);
                     updateFound(ret);
                     params->uintParams.pop_back();
                 }
             }
         }
 
-        if (node->paramChildrens[(int)ParamType::DOUBLE])
+        if (node->paramChildrens[static_cast<int>(ParamType::DOUBLE)])
         {
             char c = req_url[pos];
             if ((c >= '0' && c <= '9') || c == '+' || c == '-' || c == '.')
@@ -770,17 +778,18 @@
                     params->doubleParams.push_back(value);
                     auto ret = find(
                         req_url,
-                        &nodes[node->paramChildrens[(int)ParamType::DOUBLE]],
-                        eptr - req_url.data(), params);
+                        &nodes[node->paramChildrens[static_cast<int>(
+                            ParamType::DOUBLE)]],
+                        static_cast<unsigned>(eptr - req_url.data()), params);
                     updateFound(ret);
                     params->doubleParams.pop_back();
                 }
             }
         }
 
-        if (node->paramChildrens[(int)ParamType::STRING])
+        if (node->paramChildrens[static_cast<int>(ParamType::STRING)])
         {
-            size_t epos = pos;
+            unsigned epos = pos;
             for (; epos < req_url.size(); epos++)
             {
                 if (req_url[epos] == '/')
@@ -791,26 +800,27 @@
             {
                 params->stringParams.emplace_back(
                     req_url.substr(pos, epos - pos));
-                auto ret =
-                    find(req_url,
-                         &nodes[node->paramChildrens[(int)ParamType::STRING]],
-                         epos, params);
+                auto ret = find(req_url,
+                                &nodes[node->paramChildrens[static_cast<int>(
+                                    ParamType::STRING)]],
+                                epos, params);
                 updateFound(ret);
                 params->stringParams.pop_back();
             }
         }
 
-        if (node->paramChildrens[(int)ParamType::PATH])
+        if (node->paramChildrens[static_cast<int>(ParamType::PATH)])
         {
-            size_t epos = req_url.size();
+            unsigned epos = static_cast<unsigned>(req_url.size());
 
             if (epos != pos)
             {
                 params->stringParams.emplace_back(
                     req_url.substr(pos, epos - pos));
-                auto ret = find(
-                    req_url, &nodes[node->paramChildrens[(int)ParamType::PATH]],
-                    epos, params);
+                auto ret = find(req_url,
+                                &nodes[node->paramChildrens[static_cast<int>(
+                                    ParamType::PATH)]],
+                                epos, params);
                 updateFound(ret);
                 params->stringParams.pop_back();
             }
@@ -823,7 +833,9 @@
 
             if (req_url.compare(pos, fragment.size(), fragment) == 0)
             {
-                auto ret = find(req_url, child, pos + fragment.size(), params);
+                auto ret =
+                    find(req_url, child,
+                         pos + static_cast<unsigned>(fragment.size()), params);
                 updateFound(ret);
             }
         }
@@ -858,12 +870,16 @@
                 {
                     if (url.compare(i, x.name.size(), x.name) == 0)
                     {
-                        if (!nodes[idx].paramChildrens[(int)x.type])
+                        if (!nodes[idx]
+                                 .paramChildrens[static_cast<size_t>(x.type)])
                         {
                             auto newNodeIdx = newNode();
-                            nodes[idx].paramChildrens[(int)x.type] = newNodeIdx;
+                            nodes[idx]
+                                .paramChildrens[static_cast<size_t>(x.type)] =
+                                newNodeIdx;
                         }
-                        idx = nodes[idx].paramChildrens[(int)x.type];
+                        idx = nodes[idx]
+                                  .paramChildrens[static_cast<size_t>(x.type)];
                         i += x.name.size();
                         break;
                     }
@@ -888,15 +904,15 @@
     }
 
   private:
-    void debugNodePrint(Node* n, int level)
+    void debugNodePrint(Node* n, unsigned level)
     {
-        for (int i = 0; i < (int)ParamType::MAX; i++)
+        for (size_t i = 0; i < static_cast<size_t>(ParamType::MAX); i++)
         {
             if (n->paramChildrens[i])
             {
                 BMCWEB_LOG_DEBUG << std::string(
                     2 * level, ' ') /*<< "("<<n->paramChildrens[i]<<") "*/;
-                switch ((ParamType)i)
+                switch (static_cast<ParamType>(i))
                 {
                     case ParamType::INT:
                         BMCWEB_LOG_DEBUG << "<int>";
@@ -950,7 +966,7 @@
     unsigned newNode()
     {
         nodes.resize(nodes.size() + 1);
-        return nodes.size() - 1;
+        return static_cast<unsigned>(nodes.size() - 1);
     }
 
     std::vector<Node> nodes;
@@ -991,13 +1007,14 @@
                                std::unique_ptr<BaseRule> ruleObject)
     {
         rules.emplace_back(std::move(ruleObject));
-        trie.add(rule, rules.size() - 1);
+        trie.add(rule, static_cast<unsigned>(rules.size() - 1));
 
         // directory case:
         //   request to `/about' url matches `/about/' rule
         if (rule.size() > 2 && rule.back() == '/')
         {
-            trie.add(rule.substr(0, rule.size() - 1), rules.size() - 1);
+            trie.add(rule.substr(0, rule.size() - 1),
+                     static_cast<unsigned>(rules.size() - 1));
         }
     }
 
@@ -1056,12 +1073,12 @@
             return;
         }
 
-        if ((rules[ruleIndex]->getMethods() & (1 << (uint32_t)req.method())) ==
-            0)
+        if ((rules[ruleIndex]->getMethods() &
+             (1 << static_cast<uint32_t>(req.method()))) == 0)
         {
             BMCWEB_LOG_DEBUG << "Rule found but method mismatch: " << req.url
                              << " with " << req.methodString() << "("
-                             << (uint32_t)req.method() << ") / "
+                             << static_cast<uint32_t>(req.method()) << ") / "
                              << rules[ruleIndex]->getMethods();
             res = Response(boost::beast::http::status::not_found);
             res.end();
@@ -1069,7 +1086,7 @@
         }
 
         BMCWEB_LOG_DEBUG << "Matched rule (upgrade) '" << rules[ruleIndex]->rule
-                         << "' " << (uint32_t)req.method() << " / "
+                         << "' " << static_cast<uint32_t>(req.method()) << " / "
                          << rules[ruleIndex]->getMethods();
 
         // any uncaught exceptions become 500s
@@ -1134,12 +1151,12 @@
             return;
         }
 
-        if ((rules[ruleIndex]->getMethods() & (1 << (uint32_t)req.method())) ==
-            0)
+        if ((rules[ruleIndex]->getMethods() &
+             (1 << static_cast<uint32_t>(req.method()))) == 0)
         {
             BMCWEB_LOG_DEBUG << "Rule found but method mismatch: " << req.url
                              << " with " << req.methodString() << "("
-                             << (uint32_t)req.method() << ") / "
+                             << static_cast<uint32_t>(req.method()) << ") / "
                              << rules[ruleIndex]->getMethods();
             res = Response(boost::beast::http::status::not_found);
             res.end();
@@ -1147,7 +1164,7 @@
         }
 
         BMCWEB_LOG_DEBUG << "Matched rule '" << rules[ruleIndex]->rule << "' "
-                         << (uint32_t)req.method() << " / "
+                         << static_cast<uint32_t>(req.method()) << " / "
                          << rules[ruleIndex]->getMethods();
 
         // any uncaught exceptions become 500s
diff --git a/crow/include/crow/timer_queue.h b/crow/include/crow/timer_queue.h
index bf1e084..556fdb3 100644
--- a/crow/include/crow/timer_queue.h
+++ b/crow/include/crow/timer_queue.h
@@ -22,10 +22,11 @@
 
     void cancel(int k)
     {
-        unsigned int index = static_cast<unsigned int>(k - step);
-        if (index < dq.size())
+        int index = k - step;
+
+        if (index < static_cast<int>(dq.size()))
         {
-            dq[index].second = nullptr;
+            dq[static_cast<size_t>(index)].second = nullptr;
         }
     }
 
@@ -33,7 +34,7 @@
     {
         dq.push_back(
             std::make_pair(std::chrono::steady_clock::now(), std::move(f)));
-        int ret = step + dq.size() - 1;
+        int ret = step + static_cast<int>(dq.size()) - 1;
 
         BMCWEB_LOG_DEBUG << "timer add inside: " << this << ' ' << ret;
         return ret;
diff --git a/crow/include/crow/utility.h b/crow/include/crow/utility.h
index a07c041..5c7a7f6 100644
--- a/crow/include/crow/utility.h
+++ b/crow/include/crow/utility.h
@@ -524,7 +524,7 @@
 };
 
 inline static std::string base64encode(
-    const char* data, size_t size,
+    const uint8_t* data, size_t size,
     const char* key =
         "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
 {
@@ -533,36 +533,36 @@
     auto it = ret.begin();
     while (size >= 3)
     {
-        *it++ = key[(((unsigned char)*data) & 0xFC) >> 2];
-        unsigned char h = (((unsigned char)*data++) & 0x03) << 4;
-        *it++ = key[h | ((((unsigned char)*data) & 0xF0) >> 4)];
-        h = (((unsigned char)*data++) & 0x0F) << 2;
-        *it++ = key[h | ((((unsigned char)*data) & 0xC0) >> 6)];
-        *it++ = key[((unsigned char)*data++) & 0x3F];
+        *it++ = key[(*data & 0xFC) >> 2];
+        uint8_t h = static_cast<uint8_t>((*data++ & 0x03) << 4);
+        *it++ = key[h | ((*data & 0xF0) >> 4)];
+        h = static_cast<uint8_t>((*data++ & 0x0F) << 2);
+        *it++ = key[h | ((*data & 0xC0) >> 6)];
+        *it++ = key[*data++ & 0x3F];
 
         size -= 3;
     }
     if (size == 1)
     {
-        *it++ = key[(((unsigned char)*data) & 0xFC) >> 2];
-        unsigned char h = (((unsigned char)*data++) & 0x03) << 4;
+        *it++ = key[(*data & 0xFC) >> 2];
+        uint8_t h = static_cast<uint8_t>((*data++ & 0x03) << 4);
         *it++ = key[h];
         *it++ = '=';
         *it++ = '=';
     }
     else if (size == 2)
     {
-        *it++ = key[(((unsigned char)*data) & 0xFC) >> 2];
-        unsigned char h = (((unsigned char)*data++) & 0x03) << 4;
-        *it++ = key[h | ((((unsigned char)*data) & 0xF0) >> 4)];
-        h = (((unsigned char)*data++) & 0x0F) << 2;
+        *it++ = key[(*data & 0xFC) >> 2];
+        uint8_t h = static_cast<uint8_t>((*data++ & 0x03) << 4);
+        *it++ = key[h | ((*data & 0xF0) >> 4)];
+        h = static_cast<uint8_t>((*data++ & 0x0F) << 2);
         *it++ = key[h];
         *it++ = '=';
     }
     return ret;
 }
 
-inline static std::string base64encodeUrlsafe(const char* data, size_t size)
+inline static std::string base64encodeUrlsafe(const uint8_t* data, size_t size)
 {
     return base64encode(
         data, size,
@@ -669,10 +669,14 @@
 
 inline void escapeHtml(std::string& data)
 {
+    if (data.empty())
+    {
+        return;
+    }
     std::string buffer;
-    // less than 5% of characters should be larger, so reserve a buffer of the
+    // less than 10% of characters should be larger, so reserve a buffer of the
     // right size
-    buffer.reserve(data.size() * 1.05);
+    buffer.reserve(data.size() * 11 / 10);
     for (size_t pos = 0; pos != data.size(); ++pos)
     {
         switch (data[pos])
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index 1b82697..cddafc8 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -150,7 +150,7 @@
             nlohmann::json::iterator paths = j.find("paths");
             if (paths != j.end())
             {
-                int interfaceCount = thisSession.interfaces.size();
+                size_t interfaceCount = thisSession.interfaces.size();
                 if (interfaceCount == 0)
                 {
                     interfaceCount = 1;
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index e45bb9a..947bc86 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -48,8 +48,8 @@
                                  std::string& result)
 {
     int count = 0;
-    auto first = path.begin();
-    auto last = path.end();
+    std::string::const_iterator first = path.begin();
+    std::string::const_iterator last = path.end();
     for (auto it = path.begin(); it < path.end(); it++)
     {
         // skip first character as it's either a leading slash or the first
@@ -80,7 +80,8 @@
     {
         first++;
     }
-    result = path.substr(first - path.begin(), last - first);
+    result = path.substr(static_cast<size_t>(first - path.begin()),
+                         static_cast<size_t>(last - first));
     return true;
 }
 
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index ab35bb2..e596920 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -570,8 +570,9 @@
             {
                 return -1;
             }
-            r = sd_bus_message_append_basic(m, argCode[0],
-                                            (void *)stringValue->c_str());
+            r = sd_bus_message_append_basic(
+                m, argCode[0],
+                reinterpret_cast<const void *>(stringValue->c_str()));
             if (r < 0)
             {
                 return r;
@@ -737,13 +738,13 @@
             }
 
             nlohmann::json::const_iterator it = j->begin();
-            for (const std::string &argCode : dbusArgSplit(arg_type))
+            for (const std::string &argCode2 : dbusArgSplit(arg_type))
             {
                 if (it == j->end())
                 {
                     return -1;
                 }
-                r = convertJsonToDbus(m, argCode, *it);
+                r = convertJsonToDbus(m, argCode2, *it);
                 if (r < 0)
                 {
                     return r;
diff --git a/include/pam_authenticate.hpp b/include/pam_authenticate.hpp
index f211a29..1469aef 100644
--- a/include/pam_authenticate.hpp
+++ b/include/pam_authenticate.hpp
@@ -25,7 +25,7 @@
     std::strcpy(pass, appPass);
 
     *resp = reinterpret_cast<pam_response*>(
-        calloc(numMsg, sizeof(struct pam_response)));
+        calloc(static_cast<size_t>(numMsg), sizeof(struct pam_response)));
 
     if (resp == nullptr)
     {
diff --git a/include/persistent_data_middleware.hpp b/include/persistent_data_middleware.hpp
index b384f02..4cd75e8 100644
--- a/include/persistent_data_middleware.hpp
+++ b/include/persistent_data_middleware.hpp
@@ -24,7 +24,7 @@
 {
     // todo(ed) should read this from a fixed location somewhere, not CWD
     static constexpr const char* filename = "bmcweb_persistent_data.json";
-    int jsonRevision = 1;
+    uint64_t jsonRevision = 1;
 
   public:
     struct Context
@@ -58,7 +58,7 @@
     void readData()
     {
         std::ifstream persistentFile(filename);
-        int fileRevision = 0;
+        uint64_t fileRevision = 0;
         if (persistentFile.is_open())
         {
             // call with exceptions disabled
diff --git a/include/sessions.hpp b/include/sessions.hpp
index 6bc1c99..d55b199 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -119,22 +119,22 @@
         // https://www.owasp.org/index.php/Session_Management_Cheat_Sheet#Session_ID_Entropy
         std::string sessionToken;
         sessionToken.resize(20, '0');
-        std::uniform_int_distribution<int> dist(0, alphanum.size() - 1);
-        for (int i = 0; i < sessionToken.size(); ++i)
+        std::uniform_int_distribution<size_t> dist(0, alphanum.size() - 1);
+        for (size_t i = 0; i < sessionToken.size(); ++i)
         {
             sessionToken[i] = alphanum[dist(rd)];
         }
         // Only need csrf tokens for cookie based auth, token doesn't matter
         std::string csrfToken;
         csrfToken.resize(20, '0');
-        for (int i = 0; i < csrfToken.size(); ++i)
+        for (size_t i = 0; i < csrfToken.size(); ++i)
         {
             csrfToken[i] = alphanum[dist(rd)];
         }
 
         std::string uniqueId;
         uniqueId.resize(10, '0');
-        for (int i = 0; i < uniqueId.size(); ++i)
+        for (size_t i = 0; i < uniqueId.size(); ++i)
         {
             uniqueId[i] = alphanum[dist(rd)];
         }
@@ -205,7 +205,7 @@
     {
         return needWrite;
     }
-    int getTimeoutInSeconds() const
+    long getTimeoutInSeconds() const
     {
         return std::chrono::seconds(timeoutInMinutes).count();
     };
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index 34a7c04..133d40d 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -17,9 +17,7 @@
 namespace ensuressl
 {
 static void initOpenssl();
-static void cleanupOpenssl();
-static EVP_PKEY *createRsaKey();
-static EVP_PKEY *createEcKey();
+static EVP_PKEY *createKey();
 static void handleOpensslError();
 
 inline bool verifyOpensslKeyCert(const std::string &filepath)
@@ -110,7 +108,7 @@
     // EVP_PKEY *pRsaPrivKey = create_rsa_key();
 
     std::cerr << "Generating EC key\n";
-    EVP_PKEY *pRsaPrivKey = createEcKey();
+    EVP_PKEY *pRsaPrivKey = createKey();
     if (pRsaPrivKey != nullptr)
     {
         std::cerr << "Generating x509 Certificate\n";
@@ -177,9 +175,16 @@
 
     // cleanup_openssl();
 }
-
-EVP_PKEY *createRsaKey()
+EVP_PKEY *createKey()
 {
+    EVP_PKEY *pKey = NULL;
+    pKey = EVP_PKEY_new();
+    if (pKey == nullptr)
+    {
+        handleOpensslError();
+        return nullptr;
+    }
+#if BMCWEB_RSA_KEY
     RSA *pRSA = NULL;
 #if OPENSSL_VERSION_NUMBER < 0x00908000L
     pRSA = RSA_generate_key(2048, RSA_3, NULL, NULL);
@@ -187,60 +192,54 @@
     RSA_generate_key_ex(pRSA, 2048, NULL, NULL);
 #endif
 
-    EVP_PKEY *pKey = EVP_PKEY_new();
-    if ((pRSA != nullptr) && (pKey != nullptr) &&
-        EVP_PKEY_assign_RSA(pKey, pRSA))
-    {
-        /* pKey owns pRSA from now */
-        if (RSA_check_key(pRSA) <= 0)
-        {
-            fprintf(stderr, "RSA_check_key failed.\n");
-            handleOpensslError();
-            EVP_PKEY_free(pKey);
-            pKey = NULL;
-        }
-    }
-    else
+    if ((pRSA != nullptr) || EVP_PKEY_assign_RSA(pKey, pRSA) != 1)
     {
         handleOpensslError();
         if (pRSA != nullptr)
         {
             RSA_free(pRSA);
-            pRSA = NULL;
         }
         if (pKey != nullptr)
         {
             EVP_PKEY_free(pKey);
-            pKey = NULL;
         }
+        return nullptr;
     }
-    return pKey;
-}
 
-EVP_PKEY *createEcKey()
-{
-    EVP_PKEY *pKey = NULL;
-    int eccgrp = 0;
-    eccgrp = OBJ_txt2nid("prime256v1");
-
-    EC_KEY *myecc = EC_KEY_new_by_curve_name(eccgrp);
-    if (myecc != nullptr)
+    /* pKey owns pRSA from now */
+    if (RSA_check_key(pRSA) != 1)
     {
-        EC_KEY_set_asn1_flag(myecc, OPENSSL_EC_NAMED_CURVE);
-        EC_KEY_generate_key(myecc);
-        pKey = EVP_PKEY_new();
-        if (pKey != nullptr)
-        {
-            if (EVP_PKEY_assign_EC_KEY(pKey, myecc))
-            {
-                /* pKey owns pRSA from now */
-                if (EC_KEY_check_key(myecc) <= 0)
-                {
-                    fprintf(stderr, "EC_check_key failed.\n");
-                }
-            }
-        }
+        fprintf(stderr, "RSA_check_key failed.\n");
+        handleOpensslError();
+        EVP_PKEY_free(pKey);
+        return nullptr;
     }
+
+#else
+    int eccgrp = OBJ_txt2nid("prime256v1");
+    EC_KEY *myecc = EC_KEY_new_by_curve_name(eccgrp);
+    if (myecc == nullptr)
+    {
+        handleOpensslError();
+        return nullptr;
+    }
+
+    EC_KEY_set_asn1_flag(myecc, OPENSSL_EC_NAMED_CURVE);
+    if (EC_KEY_generate_key(myecc) != 1)
+    {
+        handleOpensslError();
+        EC_KEY_free(myecc);
+        return nullptr;
+    }
+
+    if (EVP_PKEY_assign_EC_KEY(pKey, myecc) != 1)
+    {
+        handleOpensslError();
+        EC_KEY_free(myecc);
+        return nullptr;
+    }
+
+#endif
     return pKey;
 }
 
@@ -253,16 +252,6 @@
 #endif
 }
 
-void cleanupOpenssl()
-{
-    CRYPTO_cleanup_all_ex_data();
-    ERR_free_strings();
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
-    ERR_remove_thread_state(0);
-#endif
-    EVP_cleanup();
-}
-
 void handleOpensslError()
 {
     ERR_print_errors_fp(stderr);
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index 3b20c9f..15e1af4 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -34,10 +34,10 @@
     "Login", "ConfigureManager", "ConfigureComponents", "ConfigureSelf",
     "ConfigureUsers"};
 
-constexpr const int basePrivilegeCount = basePrivileges.size();
+constexpr const size_t basePrivilegeCount = basePrivileges.size();
 
 /** @brief Max number of privileges per type  */
-constexpr const int maxPrivilegeCount = 32;
+constexpr const size_t maxPrivilegeCount = 32;
 
 /** @brief A vector of all privilege names and their indexes */
 static const std::vector<std::string> privilegeNames{basePrivileges.begin(),
@@ -96,7 +96,7 @@
      */
     bool setSinglePrivilege(const char* privilege)
     {
-        for (int searchIndex = 0; searchIndex < privilegeNames.size();
+        for (size_t searchIndex = 0; searchIndex < privilegeNames.size();
              searchIndex++)
         {
             if (privilege == privilegeNames[searchIndex])
@@ -136,8 +136,8 @@
     {
         std::vector<const std::string*> activePrivileges;
 
-        int searchIndex = 0;
-        int endIndex = basePrivilegeCount;
+        size_t searchIndex = 0;
+        size_t endIndex = basePrivilegeCount;
         if (type == PrivilegeType::OEM)
         {
             searchIndex = basePrivilegeCount - 1;
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 476e03a..b992018 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -302,7 +302,8 @@
                         boost::container::flat_set<IPv4AddressData>::iterator,
                         bool>
                         it = ipv4_config.insert(
-                            {objpath.first.str.substr(ipv4PathStart.size())});
+                            {objpath.first.str.substr(ipv4PathStart.size()), "",
+                             "", "", "", "", LinkType::Local});
                     IPv4AddressData &ipv4_address = *it.first;
                     for (auto &property : interface.second)
                     {
@@ -478,45 +479,6 @@
 }
 
 /**
- * @brief Changes IPv4 address type property (Address, Gateway)
- *
- * @param[in] ifaceId     Id of interface whose IP should be modified
- * @param[in] ipIdx       Index of IP in input array that should be modified
- * @param[in] ipHash      DBus Hash id of modified IP
- * @param[in] name        Name of field in JSON representation
- * @param[in] newValue    New value that should be written
- * @param[io] asyncResp   Response object that will be returned to client
- *
- * @return true if give IP is valid and has been sent do D-Bus, false
- * otherwise
- */
-inline void changeIPv4AddressProperty(
-    const std::string &ifaceId, int ipIdx, const std::string &ipHash,
-    const std::string &name, const std::string &newValue,
-    const std::shared_ptr<AsyncResp> asyncResp)
-{
-    auto callback = [asyncResp, ipIdx, name{std::string(name)},
-                     newValue{std::move(newValue)}](
-                        const boost::system::error_code ec) {
-        if (ec)
-        {
-            messages::internalError(asyncResp->res);
-        }
-        else
-        {
-            asyncResp->res.jsonValue["IPv4Addresses"][ipIdx][name] = newValue;
-        }
-    };
-
-    crow::connections::systemBus->async_method_call(
-        std::move(callback), "xyz.openbmc_project.Network",
-        "/xyz/openbmc_project/network/" + ifaceId + "/ipv4/" + ipHash,
-        "org.freedesktop.DBus.Properties", "Set",
-        "xyz.openbmc_project.Network.IP", name,
-        std::variant<std::string>(newValue));
-}
-
-/**
  * @brief Changes IPv4 address origin property
  *
  * @param[in] ifaceId       Id of interface whose IP should be modified
@@ -530,7 +492,7 @@
  * @return true if give IP is valid and has been sent do D-Bus, false
  * otherwise
  */
-inline void changeIPv4Origin(const std::string &ifaceId, int ipIdx,
+inline void changeIPv4Origin(const std::string &ifaceId, size_t ipIdx,
                              const std::string &ipHash,
                              const std::string &newValue,
                              const std::string &newValueDbus,
@@ -570,7 +532,8 @@
  *
  * @return None
  */
-inline void changeIPv4SubnetMaskProperty(const std::string &ifaceId, int ipIdx,
+inline void changeIPv4SubnetMaskProperty(const std::string &ifaceId,
+                                         size_t ipIdx,
                                          const std::string &ipHash,
                                          const std::string &newValueStr,
                                          uint8_t &newValue,
@@ -637,9 +600,8 @@
  *
  * @return None
  */
-inline void createIPv4(const std::string &ifaceId, unsigned int ipIdx,
-                       uint8_t subnetMask, const std::string &gateway,
-                       const std::string &address,
+inline void createIPv4(const std::string &ifaceId, uint8_t subnetMask,
+                       const std::string &gateway, const std::string &address,
                        std::shared_ptr<AsyncResp> asyncResp)
 {
     auto createIpHandler = [asyncResp](const boost::system::error_code ec) {
@@ -1099,6 +1061,7 @@
             if (gateway)
             {
                 if (!ipv4VerifyIpAndGetBitcount(*gateway))
+
                 {
                     messages::propertyValueFormatError(asyncResp->res, *gateway,
                                                        pathString + "/Gateway");
@@ -1198,8 +1161,7 @@
                     continue;
                 }
 
-                createIPv4(ifaceId, entryIdx, prefixLength, *gateway, *address,
-                           asyncResp);
+                createIPv4(ifaceId, entryIdx, *gateway, *address, asyncResp);
 
                 nlohmann::json &ipv4AddressJson =
                     asyncResp->res.jsonValue["IPv4Addresses"][entryIdx];
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 61cbd9e..b07d6b1 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -46,8 +46,8 @@
     size_t length = 0;
     int ret = 0;
     // Get the metadata from the requested field of the journal entry
-    ret = sd_journal_get_data(journal, field.data(), (const void **)&data,
-                              &length);
+    ret = sd_journal_get_data(journal, field.data(),
+                              reinterpret_cast<const void **>(&data), &length);
     if (ret < 0)
     {
         return ret;
@@ -70,7 +70,7 @@
     {
         return ret;
     }
-    contents = strtol(metadata.data(), nullptr, base);
+    contents = static_cast<int>(strtol(metadata.data(), nullptr, base));
     return ret;
 }
 
@@ -215,12 +215,12 @@
         {
             index = std::stoul(std::string(indexStr), &pos);
         }
-        catch (std::invalid_argument)
+        catch (std::invalid_argument &)
         {
             messages::resourceMissingAtURI(res, entryID);
             return false;
         }
-        catch (std::out_of_range)
+        catch (std::out_of_range &)
         {
             messages::resourceMissingAtURI(res, entryID);
             return false;
@@ -237,12 +237,12 @@
     {
         timestamp = std::stoull(std::string(tsStr), &pos);
     }
-    catch (std::invalid_argument)
+    catch (std::invalid_argument &)
     {
         messages::resourceMissingAtURI(res, entryID);
         return false;
     }
-    catch (std::out_of_range)
+    catch (std::out_of_range &)
     {
         messages::resourceMissingAtURI(res, entryID);
         return false;
@@ -382,8 +382,8 @@
             {
                 continue;
             }
-            int argNum = std::strtoul(field.data(), nullptr, 10);
-            if (argNum == 0)
+            unsigned long argNum = std::strtoul(field.data(), nullptr, 10);
+            if (argNum == 0 || argNum > std::numeric_limits<size_t>::max())
             {
                 continue;
             }
@@ -392,7 +392,7 @@
             // Make sure we have enough space in messageArgs
             if (argNum > messageArgs.size())
             {
-                messageArgs.resize(argNum);
+                messageArgs.resize(static_cast<size_t>(argNum));
             }
             messageArgs[argNum - 1] = std::string(field);
         }
@@ -482,7 +482,7 @@
         std::unique_ptr<sd_journal, decltype(&sd_journal_close)> journal(
             journalTmp, sd_journal_close);
         journalTmp = nullptr;
-        uint64_t entryCount = 0;
+        long entryCount = 0;
         SD_JOURNAL_FOREACH(journal.get())
         {
             // Look for only journal entries that contain a REDFISH_MESSAGE_ID
@@ -803,7 +803,7 @@
         std::unique_ptr<sd_journal, decltype(&sd_journal_close)> journal(
             journalTmp, sd_journal_close);
         journalTmp = nullptr;
-        uint64_t entryCount = 0;
+        long entryCount = 0;
         SD_JOURNAL_FOREACH(journal.get())
         {
             entryCount++;
@@ -1094,7 +1094,7 @@
             messages::internalError(asyncResp->res);
             return;
         }
-        const uint8_t logId = std::atoi(params[0].c_str());
+        const int logId = std::atoi(params[0].c_str());
         auto getStoredLogCallback = [asyncResp, logId](
                                         const boost::system::error_code ec,
                                         const std::variant<std::string> &resp) {
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index f9c2f38..0aa4478 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -785,10 +785,10 @@
             for (auto& step : *steps)
             {
                 double target;
-                double output;
+                double out;
 
                 if (!redfish::json_util::readJson(step, response->res, "Target",
-                                                  target, "Output", output))
+                                                  target, "Output", out))
                 {
                     BMCWEB_LOG_ERROR << "Line:" << __LINE__
                                      << ", Illegal Property "
@@ -796,7 +796,7 @@
                     return CreatePIDRet::fail;
                 }
                 readings.emplace_back(target);
-                outputs.emplace_back(output);
+                outputs.emplace_back(out);
             }
             output["Reading"] = std::move(readings);
             output["Output"] = std::move(outputs);
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index b1df101..78f1d8a 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -38,9 +38,8 @@
     }
 
   private:
-    std::initializer_list<const char*> typeList = {
-        "/xyz/openbmc_project/sensors/voltage",
-        "/xyz/openbmc_project/sensors/power"};
+    std::vector<const char*> typeList = {"/xyz/openbmc_project/sensors/voltage",
+                                         "/xyz/openbmc_project/sensors/power"};
     void doGet(crow::Response& res, const crow::Request& req,
                const std::vector<std::string>& params) override
     {
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index bbed047..51895ee 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -49,7 +49,7 @@
 {
   public:
     SensorsAsyncResp(crow::Response& response, const std::string& chassisId,
-                     const std::initializer_list<const char*> types,
+                     const std::vector<const char*> types,
                      const std::string& subNode) :
         res(response),
         chassisId(chassisId), types(types), chassisSubNode(subNode)
@@ -539,11 +539,11 @@
         auto interfaceProperties = interfacesDict.find(std::get<0>(p));
         if (interfaceProperties != interfacesDict.end())
         {
-            auto valueIt = interfaceProperties->second.find(std::get<1>(p));
-            if (valueIt != interfaceProperties->second.end())
+            auto valIt = interfaceProperties->second.find(std::get<1>(p));
+            if (valIt != interfaceProperties->second.end())
             {
-                const SensorVariant& valueVariant = valueIt->second;
-                nlohmann::json& valueIt = sensor_json[std::get<2>(p)];
+                const SensorVariant& valueVariant = valIt->second;
+                nlohmann::json& jValueIt = sensor_json[std::get<2>(p)];
                 // Attempt to pull the int64 directly
                 const int64_t* int64Value = std::get_if<int64_t>(&valueVariant);
 
@@ -566,11 +566,11 @@
                 temp = temp * std::pow(10, scaleMultiplier);
                 if (forceToInt)
                 {
-                    valueIt = static_cast<int64_t>(temp);
+                    jValueIt = static_cast<int64_t>(temp);
                 }
                 else
                 {
-                    valueIt = temp;
+                    jValueIt = temp;
                 }
             }
         }
@@ -985,7 +985,7 @@
  */
 void setSensorOverride(crow::Response& res, const crow::Request& req,
                        const std::vector<std::string>& params,
-                       const std::initializer_list<const char*> typeList,
+                       const std::vector<const char*> typeList,
                        const std::string& chassisSubNode)
 {
 
diff --git a/redfish-core/lib/thermal.hpp b/redfish-core/lib/thermal.hpp
index f266c40..58e7cd4 100644
--- a/redfish-core/lib/thermal.hpp
+++ b/redfish-core/lib/thermal.hpp
@@ -37,7 +37,7 @@
     }
 
   private:
-    std::initializer_list<const char*> typeList = {
+    std::vector<const char*> typeList = {
         "/xyz/openbmc_project/sensors/fan_tach",
         "/xyz/openbmc_project/sensors/temperature",
         "/xyz/openbmc_project/sensors/fan_pwm"};
