DeepCover Embedded Security in IoT: Public-key Secured Data Paths

Dependencies:   MaximInterface

The MAXREFDES155# is an internet-of-things (IoT) embedded-security reference design, built to authenticate and control a sensing node using elliptic-curve-based public-key cryptography with control and notification from a web server.

The hardware includes an ARM® mbed™ shield and attached sensor endpoint. The shield contains a DS2476 DeepCover® ECDSA/SHA-2 coprocessor, Wifi communication, LCD push-button controls, and status LEDs. The sensor endpoint is attached to the shield using a 300mm cable and contains a DS28C36 DeepCover ECDSA/SHA-2 authenticator, IR-thermal sensor, and aiming laser for the IR sensor. The MAXREFDES155# is equipped with a standard Arduino® form-factor shield connector for immediate testing using an mbed board such as the MAX32600MBED#. The combination of these two devices represent an IoT device. Communication to the web server is accomplished with the shield Wifi circuitry. Communication from the shield to the attached sensor module is accomplished over I2C . The sensor module represents an IoT endpoint that generates small data with a requirement for message authenticity/integrity and secure on/off operational control.

The design is hierarchical with each mbed platform and shield communicating data from the sensor node to a web server that maintains a centralized log and dispatches notifications as necessary. The simplicity of this design enables rapid integration into any star-topology IoT network to provide security with the low overhead and cost provided by the ECDSA-P256 asymmetric-key and SHA-256 symmetric-key algorithms.

More information about the MAXREFDES155# is available on the Maxim Integrated website.

Revision:
8:a0d75dff3c9b
Parent:
0:33d4e66780c0
Child:
10:71359af61af8
--- a/Graphic.cpp	Thu Mar 09 11:38:33 2017 -0600
+++ b/Graphic.cpp	Thu Apr 06 15:16:30 2017 -0500
@@ -31,17 +31,15 @@
 *******************************************************************************/
 
 #include <algorithm>
+#include "Display.hpp"
 #include "Graphic.hpp"
 
 static const int minWidthHeight = 1;
 
-Graphic::Graphic(Graphic * parent) :
+Graphic::Graphic() :
     m_parent(NULL), m_children(), m_focusedChild(NULL),
     m_x(0), m_y(0), m_width(minWidthHeight), m_height(minWidthHeight),
-    m_regionValid(false), m_layoutValid(false)
-{
-    setParent(parent);
-}
+    m_valid(false) { }
 
 static void setParentNull(Graphic * node)
 {
@@ -50,7 +48,7 @@
 
 Graphic::~Graphic()
 {    
-    // Set childrens' parent to NULL.
+    // Set children's parent to NULL.
     std::for_each(m_children.begin(), m_children.end(), setParentNull);
     // Remove from parent.
     setParent(NULL);
@@ -70,17 +68,15 @@
         {
             m_parent->m_focusedChild = NULL;
         }
-        // Old parent's region and layout are both invalid.
-        m_parent->invalidateRegion();
-        m_parent->invalidateLayout();
+        // Signal children changed event on old parent.
+        m_parent->childrenChanged();
     }
     if (parent != NULL)
     {
         // Add this to new parent's list of children.
         parent->m_children.push_back(this);
-        // New parent's region and layout are both invalid.
-        parent->invalidateRegion();
-        parent->invalidateLayout();
+        // Signal children changed event on new parent.
+        parent->childrenChanged();
     }
     m_parent = parent;
 }
@@ -114,103 +110,82 @@
     if (node == this)
         return;
     
-    // Invalidate region of currently focused graphic.
-    node->invalidateRegion();
     // Create new focus chain by setting the focused child of each parent.
     m_focusedChild = NULL;
-    for (node = this; node->m_parent != NULL; node = node->m_parent)
+    for (Graphic * node = this; node->m_parent != NULL; node = node->m_parent)
     {
         node->m_parent->m_focusedChild = node;
     }
-    // Invalidate region of this graphic.
-    invalidateRegion();
+    // Raise focus changed events on both nodes.
+    node->focusChanged(false);
+    focusChanged(true);
 }
 
-void Graphic::setX(int x)
+void Graphic::move(int x, int y)
 {
-    if (m_x != x)
+    if (m_x != x || m_y != y)
     {
         m_x = x;
-        if (m_parent != NULL)
-        {
-            m_parent->invalidateLayout();
-        }
-    }
-}
-
-void Graphic::setY(int y)
-{
-    if (m_y != y)
-    {
         m_y = y;
-        if (m_parent != NULL)
-        {
-            m_parent->invalidateLayout();
-        }
+        invalidate();
+        moved();
     }
 }
 
-void Graphic::setWidth(int width)
+void Graphic::resize(int width, int height)
 {
-    width = std::max(width, minWidthHeight);
-    if (m_width != width)
+    if (m_width != width || m_height != height)
     {
-        m_width = width;
-        invalidateRegion();
-        invalidateLayout();
+        m_width = std::max(width, minWidthHeight);
+        m_height = std::max(height, minWidthHeight);
+        invalidate();
+        resized();
     }
 }
 
-void Graphic::setHeight(int height)
-{
-    height = std::max(height, minWidthHeight);
-    if (m_height != height)
-    {
-        m_height = height;
-        invalidateRegion();
-        invalidateLayout();
-    }
-}
-
-// Functor overlays rendered graphics onto a bitmap.
-class RenderOverlay
-{
-public:
-    RenderOverlay(Bitmap & bitmap) : bitmap(bitmap) { }
-    
-    void operator()(const Graphic * graphic)
-    {
-        if (graphic != NULL)
-        {
-            bitmap.overlay(graphic->render(), graphic->x(), graphic->y());
-        }
-    }
-    
-private:
-    Bitmap & bitmap;
-};
-
 Bitmap Graphic::render() const
 {
     Bitmap bitmap(width(), height());
-    std::for_each(m_children.begin(), m_children.end(), RenderOverlay(bitmap));
+    doRender(bitmap);
     return bitmap;
 }
 
-bool Graphic::update()
+bool Graphic::doUpdate(bool setValid)
 {
     bool redraw = false;
-    if (doLayoutAll())
+    // Perform updated event on this graphic.
+    updated();
+    // Call recursively on each child.
+    for (ChildContainer::iterator it = m_children.begin(); it != m_children.end(); it++)
+    {
+        if ((*it)->doUpdate(setValid))
+        {
+            redraw = true;
+        }
+    }
+    // Request redraw if region invalid.
+    if (!m_valid)
     {
         redraw = true;
-    }
-    if (doPostLayoutAll())
-    {
-        redraw = true;
+        if (setValid)
+        {
+            m_valid = true;
+        }
     }
     return redraw;
 }
 
+void Graphic::update(Display * display)
+{
+    bool redraw = doUpdate(display != NULL);
+    if (display != NULL && redraw)
+    {
+        Bitmap bitmap(Display::width, Display::height);
+        bitmap.overlay(render(), x(), y());
+        display->update(bitmap);
+    }
+}
+
 bool Graphic::processKey(Key key)
 {
     // Find focused child.
@@ -229,45 +204,37 @@
     return handled;
 }
 
-bool Graphic::doLayoutAll()
+void Graphic::childrenChanged() { }
+
+void Graphic::focusChanged(bool) { }
+
+void Graphic::moved() { }
+
+void Graphic::resized() { }
+
+void Graphic::updated() { }
+
+// Functor overlays rendered graphics onto a bitmap.
+class RenderOverlay
 {
-    bool redraw = false;
-    // Perform layout on this graphic if invalid.
-    if (!m_layoutValid)
+public:
+    RenderOverlay(Bitmap & bitmap) : bitmap(bitmap) { }
+    
+    void operator()(const Graphic * graphic)
     {
-        doLayout();
-        m_layoutValid = true;
-        redraw = true;
-    }
-    // Call recursively on each child.
-    for (ChildContainer::iterator it = m_children.begin(); it != m_children.end(); it++)
-    {
-        if ((*it)->doLayoutAll())
+        if (graphic != NULL)
         {
-            redraw = true;
+            bitmap.overlay(graphic->render(), graphic->x(), graphic->y());
         }
     }
-    return redraw;
+    
+private:
+    Bitmap & bitmap;
+};
+
+void Graphic::doRender(Bitmap & bitmap) const
+{
+    std::for_each(m_children.begin(), m_children.end(), RenderOverlay(bitmap));
 }
 
-bool Graphic::doPostLayoutAll()
-{
-    bool redraw = false;
-    // Perform post-layout on this graphic.
-    doPostLayout();
-    // Call recursively on each child.
-    for (ChildContainer::iterator it = m_children.begin(); it != m_children.end(); it++)
-    {
-        if ((*it)->doPostLayoutAll())
-        {
-            redraw = true;
-        }
-    }
-    // Request redraw if region invalid.
-    if (!m_regionValid)
-    {
-        redraw = true;
-        m_regionValid = true;
-    }
-    return redraw;
-}
+bool Graphic::doProcessKey(Key) { return false; }