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:
13:6a6225690c2e
Parent:
11:989eabe2a376
--- a/Bitmap.cpp	Thu Jun 01 14:21:58 2017 -0500
+++ b/Bitmap.cpp	Mon Nov 06 18:12:27 2017 -0600
@@ -37,141 +37,114 @@
 static const int pixelsPerSegment = 8;
 
 template <typename T>
-static T divideRoundUp(const T dividend, const T divisor)
-{
-    return (dividend / divisor) + (((dividend % divisor) == 0) ? 0 : 1);
+static T divideRoundUp(const T dividend, const T divisor) {
+  return (dividend / divisor) + (((dividend % divisor) == 0) ? 0 : 1);
 }
 
-static int calculateSegmentsPerLine(int width)
-{
-    return divideRoundUp(width, pixelsPerSegment);
+static int calculateSegmentsPerLine(int width) {
+  return divideRoundUp(width, pixelsPerSegment);
 }
 
-static int calculateHeight(size_t size, int width)
-{
-    return static_cast<int>(divideRoundUp(size, static_cast<size_t>(calculateSegmentsPerLine(width))));
+static int calculateHeight(size_t size, int width) {
+  return static_cast<int>(divideRoundUp(
+      size, static_cast<size_t>(calculateSegmentsPerLine(width))));
 }
 
-static int calculateSegmentIndex(int x, int y, int width)
-{
-    return y * calculateSegmentsPerLine(width) + x / pixelsPerSegment;
+static int calculateSegmentIndex(int x, int y, int width) {
+  return y * calculateSegmentsPerLine(width) + x / pixelsPerSegment;
 }
 
-static int calculatePixelMask(int x)
-{
-    return 1 << (pixelsPerSegment - 1 - (x % pixelsPerSegment));
+static int calculatePixelMask(int x) {
+  return 1 << (pixelsPerSegment - 1 - (x % pixelsPerSegment));
 }
 
-Bitmap::Bitmap(int width, int height) :
-    m_width(std::max(width, minWidthHeight)),
-    m_height(std::max(height, minWidthHeight)),
-    m_data(calculateSegmentsPerLine(m_width) * m_height, 0x00) { }
+Bitmap::Bitmap(int width, int height)
+    : m_width(std::max(width, minWidthHeight)),
+      m_height(std::max(height, minWidthHeight)),
+      m_data(calculateSegmentsPerLine(m_width) * m_height, 0x00) {}
 
-Bitmap::Bitmap(const uint8_t * data, size_t size, int width) :
-    m_width(std::max(width, minWidthHeight)),
-    m_height(std::max(calculateHeight(size, width), minWidthHeight)),
-    m_data(calculateSegmentsPerLine(m_width) * m_height, 0x00)
-{
-    std::copy(data, data + size, m_data.begin());
+Bitmap::Bitmap(const uint8_t * data, size_t size, int width)
+    : m_width(std::max(width, minWidthHeight)),
+      m_height(std::max(calculateHeight(size, width), minWidthHeight)),
+      m_data(calculateSegmentsPerLine(m_width) * m_height, 0x00) {
+  std::copy(data, data + size, m_data.begin());
 }
 
-bool Bitmap::pixelEnabled(int x, int y) const
-{
-    bool enabled = false;
-    if ((x >= 0) && (x < m_width) && (y >= 0) && (y < m_height))
-    {
-        enabled = m_data[calculateSegmentIndex(x, y, m_width)] & calculatePixelMask(x);
-    }
-    return enabled;
+bool Bitmap::pixelEnabled(int x, int y) const {
+  bool enabled = false;
+  if ((x >= 0) && (x < m_width) && (y >= 0) && (y < m_height)) {
+    enabled =
+        m_data[calculateSegmentIndex(x, y, m_width)] & calculatePixelMask(x);
+  }
+  return enabled;
 }
 
-void Bitmap::setPixelEnabled(int x, int y, bool enabled)
-{
-    if ((x >= 0) && (x < m_width) && (y >= 0) && (y < m_height))
-    {
-        uint8_t & dataSegment = m_data[calculateSegmentIndex(x, y, m_width)];
-        uint8_t dataMask = calculatePixelMask(x);
-        if (enabled)
-        {
-            dataSegment |= dataMask;
-        }
-        else
-        {
-            dataSegment &= ~dataMask;
-        }
+void Bitmap::setPixelEnabled(int x, int y, bool enabled) {
+  if ((x >= 0) && (x < m_width) && (y >= 0) && (y < m_height)) {
+    uint8_t & dataSegment = m_data[calculateSegmentIndex(x, y, m_width)];
+    uint8_t dataMask = calculatePixelMask(x);
+    if (enabled) {
+      dataSegment |= dataMask;
+    } else {
+      dataSegment &= ~dataMask;
     }
+  }
 }
 
-void Bitmap::overlay(int x, int y, const uint8_t * data, size_t size, int width)
-{
-    if (width < minWidthHeight)
-    {
-        return;
-    }
+void Bitmap::overlay(int x, int y, const uint8_t * data, size_t size,
+                     int width) {
+  if (width < minWidthHeight) {
+    return;
+  }
 
-    const int segmentsPerLine = calculateSegmentsPerLine(width);
-    for (size_t segment = 0; segment < size; segment++)
-    {
-        const int curY = segment / segmentsPerLine;
-        if (!((y + curY) < m_height))
-        {
-            break;
-        }
-        for (int pixel = 0; pixel < pixelsPerSegment; pixel++)
-        {
-            const int curX = (segment % segmentsPerLine) * pixelsPerSegment + pixel;
-            if (!(((x + curX) < m_width) && (curX < width)))
-            {
-                break;
-            }
-            setPixelEnabled(x + curX, y + curY, data[segment] & (1 << (pixelsPerSegment - 1 - pixel)));
-        }
+  const int segmentsPerLine = calculateSegmentsPerLine(width);
+  for (size_t segment = 0; segment < size; segment++) {
+    const int curY = segment / segmentsPerLine;
+    if (!((y + curY) < m_height)) {
+      break;
     }
+    for (int pixel = 0; pixel < pixelsPerSegment; pixel++) {
+      const int curX = (segment % segmentsPerLine) * pixelsPerSegment + pixel;
+      if (!(((x + curX) < m_width) && (curX < width))) {
+        break;
+      }
+      setPixelEnabled(x + curX, y + curY,
+                      data[segment] & (1 << (pixelsPerSegment - 1 - pixel)));
+    }
+  }
 }
 
-void Bitmap::overlay(int x, int y, const Bitmap & src)
-{
-    overlay(x, y, &src.m_data[0], src.m_data.size(), src.m_width);
-}
-
-void Bitmap::clear()
-{
-    std::fill(m_data.begin(), m_data.end(), 0);
+void Bitmap::overlay(int x, int y, const Bitmap & src) {
+  overlay(x, y, &src.m_data[0], src.m_data.size(), src.m_width);
 }
 
-void Bitmap::clear(int x, int y, int width, int height)
-{
-    if (!((x >= 0) && (x < m_width) && (y >= 0) && (y < m_height)))
-    {
-        return;
-    }
-    if ((x + width) > m_width)
-    {
-        width = m_width - x;
-    }
-    if ((y + height) > m_height)
-    {
-        height = m_height - y;
+void Bitmap::clear() { std::fill(m_data.begin(), m_data.end(), 0); }
+
+void Bitmap::clear(int x, int y, int width, int height) {
+  if (!((x >= 0) && (x < m_width) && (y >= 0) && (y < m_height))) {
+    return;
+  }
+  if ((x + width) > m_width) {
+    width = m_width - x;
+  }
+  if ((y + height) > m_height) {
+    height = m_height - y;
+  }
+
+  const int startX = x;
+  const int startY = y;
+  while (y < (startY + height)) {
+    x = startX;
+    while (x < (startX + width)) {
+      if (((x % pixelsPerSegment) == 0) &&
+          ((x + pixelsPerSegment) < (startX + width))) {
+        m_data[calculateSegmentIndex(x, y, m_width)] = 0;
+        x += pixelsPerSegment;
+      } else {
+        setPixelEnabled(x, y, false);
+        x++;
+      }
     }
-    
-    const int startX = x;
-    const int startY = y;
-    while (y < (startY + height))
-    {
-        x = startX;
-        while (x < (startX + width))
-        {
-            if (((x % pixelsPerSegment) == 0) && ((x + pixelsPerSegment) < (startX + width)))
-            {
-                m_data[calculateSegmentIndex(x, y, m_width)] = 0;
-                x += pixelsPerSegment;
-            }
-            else
-            {
-                setPixelEnabled(x, y, false);
-                x++;
-            }
-        }
-        y++;
-    }
+    y++;
+  }
 }