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.
xternal/rapidjson/internal/meta.h@18:c2631e985780, 2019-12-03 (annotated)
- Committer:
- IanBenzMaxim
- Date:
- Tue Dec 03 12:56:25 2019 -0600
- Revision:
- 18:c2631e985780
- Parent:
- 16:a004191a79ab
Updated MaximInterface to version 2.1.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IanBenzMaxim | 0:33d4e66780c0 | 1 | // Tencent is pleased to support the open source community by making RapidJSON available. |
IanBenzMaxim | 0:33d4e66780c0 | 2 | // |
IanBenzMaxim | 0:33d4e66780c0 | 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. |
IanBenzMaxim | 0:33d4e66780c0 | 4 | // |
IanBenzMaxim | 0:33d4e66780c0 | 5 | // Licensed under the MIT License (the "License"); you may not use this file except |
IanBenzMaxim | 0:33d4e66780c0 | 6 | // in compliance with the License. You may obtain a copy of the License at |
IanBenzMaxim | 0:33d4e66780c0 | 7 | // |
IanBenzMaxim | 0:33d4e66780c0 | 8 | // http://opensource.org/licenses/MIT |
IanBenzMaxim | 0:33d4e66780c0 | 9 | // |
IanBenzMaxim | 0:33d4e66780c0 | 10 | // Unless required by applicable law or agreed to in writing, software distributed |
IanBenzMaxim | 0:33d4e66780c0 | 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
IanBenzMaxim | 0:33d4e66780c0 | 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
IanBenzMaxim | 0:33d4e66780c0 | 13 | // specific language governing permissions and limitations under the License. |
IanBenzMaxim | 0:33d4e66780c0 | 14 | |
IanBenzMaxim | 0:33d4e66780c0 | 15 | #ifndef RAPIDJSON_INTERNAL_META_H_ |
IanBenzMaxim | 0:33d4e66780c0 | 16 | #define RAPIDJSON_INTERNAL_META_H_ |
IanBenzMaxim | 0:33d4e66780c0 | 17 | |
IanBenzMaxim | 0:33d4e66780c0 | 18 | #include "../rapidjson.h" |
IanBenzMaxim | 0:33d4e66780c0 | 19 | |
IanBenzMaxim | 0:33d4e66780c0 | 20 | #ifdef __GNUC__ |
IanBenzMaxim | 0:33d4e66780c0 | 21 | RAPIDJSON_DIAG_PUSH |
IanBenzMaxim | 0:33d4e66780c0 | 22 | RAPIDJSON_DIAG_OFF(effc++) |
IanBenzMaxim | 0:33d4e66780c0 | 23 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 24 | #if defined(_MSC_VER) |
IanBenzMaxim | 0:33d4e66780c0 | 25 | RAPIDJSON_DIAG_PUSH |
IanBenzMaxim | 0:33d4e66780c0 | 26 | RAPIDJSON_DIAG_OFF(6334) |
IanBenzMaxim | 0:33d4e66780c0 | 27 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 28 | |
IanBenzMaxim | 0:33d4e66780c0 | 29 | #if RAPIDJSON_HAS_CXX11_TYPETRAITS |
IanBenzMaxim | 0:33d4e66780c0 | 30 | #include <type_traits> |
IanBenzMaxim | 0:33d4e66780c0 | 31 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 32 | |
IanBenzMaxim | 0:33d4e66780c0 | 33 | //@cond RAPIDJSON_INTERNAL |
IanBenzMaxim | 0:33d4e66780c0 | 34 | RAPIDJSON_NAMESPACE_BEGIN |
IanBenzMaxim | 0:33d4e66780c0 | 35 | namespace internal { |
IanBenzMaxim | 0:33d4e66780c0 | 36 | |
IanBenzMaxim | 0:33d4e66780c0 | 37 | // Helper to wrap/convert arbitrary types to void, useful for arbitrary type matching |
IanBenzMaxim | 0:33d4e66780c0 | 38 | template <typename T> struct Void { typedef void Type; }; |
IanBenzMaxim | 0:33d4e66780c0 | 39 | |
IanBenzMaxim | 0:33d4e66780c0 | 40 | /////////////////////////////////////////////////////////////////////////////// |
IanBenzMaxim | 0:33d4e66780c0 | 41 | // BoolType, TrueType, FalseType |
IanBenzMaxim | 0:33d4e66780c0 | 42 | // |
IanBenzMaxim | 0:33d4e66780c0 | 43 | template <bool Cond> struct BoolType { |
IanBenzMaxim | 0:33d4e66780c0 | 44 | static const bool Value = Cond; |
IanBenzMaxim | 0:33d4e66780c0 | 45 | typedef BoolType Type; |
IanBenzMaxim | 0:33d4e66780c0 | 46 | }; |
IanBenzMaxim | 0:33d4e66780c0 | 47 | typedef BoolType<true> TrueType; |
IanBenzMaxim | 0:33d4e66780c0 | 48 | typedef BoolType<false> FalseType; |
IanBenzMaxim | 0:33d4e66780c0 | 49 | |
IanBenzMaxim | 0:33d4e66780c0 | 50 | |
IanBenzMaxim | 0:33d4e66780c0 | 51 | /////////////////////////////////////////////////////////////////////////////// |
IanBenzMaxim | 0:33d4e66780c0 | 52 | // SelectIf, BoolExpr, NotExpr, AndExpr, OrExpr |
IanBenzMaxim | 0:33d4e66780c0 | 53 | // |
IanBenzMaxim | 0:33d4e66780c0 | 54 | |
IanBenzMaxim | 0:33d4e66780c0 | 55 | template <bool C> struct SelectIfImpl { template <typename T1, typename T2> struct Apply { typedef T1 Type; }; }; |
IanBenzMaxim | 0:33d4e66780c0 | 56 | template <> struct SelectIfImpl<false> { template <typename T1, typename T2> struct Apply { typedef T2 Type; }; }; |
IanBenzMaxim | 0:33d4e66780c0 | 57 | template <bool C, typename T1, typename T2> struct SelectIfCond : SelectIfImpl<C>::template Apply<T1,T2> {}; |
IanBenzMaxim | 0:33d4e66780c0 | 58 | template <typename C, typename T1, typename T2> struct SelectIf : SelectIfCond<C::Value, T1, T2> {}; |
IanBenzMaxim | 0:33d4e66780c0 | 59 | |
IanBenzMaxim | 0:33d4e66780c0 | 60 | template <bool Cond1, bool Cond2> struct AndExprCond : FalseType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 61 | template <> struct AndExprCond<true, true> : TrueType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 62 | template <bool Cond1, bool Cond2> struct OrExprCond : TrueType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 63 | template <> struct OrExprCond<false, false> : FalseType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 64 | |
IanBenzMaxim | 0:33d4e66780c0 | 65 | template <typename C> struct BoolExpr : SelectIf<C,TrueType,FalseType>::Type {}; |
IanBenzMaxim | 0:33d4e66780c0 | 66 | template <typename C> struct NotExpr : SelectIf<C,FalseType,TrueType>::Type {}; |
IanBenzMaxim | 0:33d4e66780c0 | 67 | template <typename C1, typename C2> struct AndExpr : AndExprCond<C1::Value, C2::Value>::Type {}; |
IanBenzMaxim | 0:33d4e66780c0 | 68 | template <typename C1, typename C2> struct OrExpr : OrExprCond<C1::Value, C2::Value>::Type {}; |
IanBenzMaxim | 0:33d4e66780c0 | 69 | |
IanBenzMaxim | 0:33d4e66780c0 | 70 | |
IanBenzMaxim | 0:33d4e66780c0 | 71 | /////////////////////////////////////////////////////////////////////////////// |
IanBenzMaxim | 0:33d4e66780c0 | 72 | // AddConst, MaybeAddConst, RemoveConst |
IanBenzMaxim | 0:33d4e66780c0 | 73 | template <typename T> struct AddConst { typedef const T Type; }; |
IanBenzMaxim | 0:33d4e66780c0 | 74 | template <bool Constify, typename T> struct MaybeAddConst : SelectIfCond<Constify, const T, T> {}; |
IanBenzMaxim | 0:33d4e66780c0 | 75 | template <typename T> struct RemoveConst { typedef T Type; }; |
IanBenzMaxim | 0:33d4e66780c0 | 76 | template <typename T> struct RemoveConst<const T> { typedef T Type; }; |
IanBenzMaxim | 0:33d4e66780c0 | 77 | |
IanBenzMaxim | 0:33d4e66780c0 | 78 | |
IanBenzMaxim | 0:33d4e66780c0 | 79 | /////////////////////////////////////////////////////////////////////////////// |
IanBenzMaxim | 0:33d4e66780c0 | 80 | // IsSame, IsConst, IsMoreConst, IsPointer |
IanBenzMaxim | 0:33d4e66780c0 | 81 | // |
IanBenzMaxim | 0:33d4e66780c0 | 82 | template <typename T, typename U> struct IsSame : FalseType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 83 | template <typename T> struct IsSame<T, T> : TrueType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 84 | |
IanBenzMaxim | 0:33d4e66780c0 | 85 | template <typename T> struct IsConst : FalseType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 86 | template <typename T> struct IsConst<const T> : TrueType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 87 | |
IanBenzMaxim | 0:33d4e66780c0 | 88 | template <typename CT, typename T> |
IanBenzMaxim | 0:33d4e66780c0 | 89 | struct IsMoreConst |
IanBenzMaxim | 0:33d4e66780c0 | 90 | : AndExpr<IsSame<typename RemoveConst<CT>::Type, typename RemoveConst<T>::Type>, |
IanBenzMaxim | 0:33d4e66780c0 | 91 | BoolType<IsConst<CT>::Value >= IsConst<T>::Value> >::Type {}; |
IanBenzMaxim | 0:33d4e66780c0 | 92 | |
IanBenzMaxim | 0:33d4e66780c0 | 93 | template <typename T> struct IsPointer : FalseType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 94 | template <typename T> struct IsPointer<T*> : TrueType {}; |
IanBenzMaxim | 0:33d4e66780c0 | 95 | |
IanBenzMaxim | 0:33d4e66780c0 | 96 | /////////////////////////////////////////////////////////////////////////////// |
IanBenzMaxim | 0:33d4e66780c0 | 97 | // IsBaseOf |
IanBenzMaxim | 0:33d4e66780c0 | 98 | // |
IanBenzMaxim | 0:33d4e66780c0 | 99 | #if RAPIDJSON_HAS_CXX11_TYPETRAITS |
IanBenzMaxim | 0:33d4e66780c0 | 100 | |
IanBenzMaxim | 0:33d4e66780c0 | 101 | template <typename B, typename D> struct IsBaseOf |
IanBenzMaxim | 0:33d4e66780c0 | 102 | : BoolType< ::std::is_base_of<B,D>::value> {}; |
IanBenzMaxim | 0:33d4e66780c0 | 103 | |
IanBenzMaxim | 0:33d4e66780c0 | 104 | #else // simplified version adopted from Boost |
IanBenzMaxim | 0:33d4e66780c0 | 105 | |
IanBenzMaxim | 0:33d4e66780c0 | 106 | template<typename B, typename D> struct IsBaseOfImpl { |
IanBenzMaxim | 0:33d4e66780c0 | 107 | RAPIDJSON_STATIC_ASSERT(sizeof(B) != 0); |
IanBenzMaxim | 0:33d4e66780c0 | 108 | RAPIDJSON_STATIC_ASSERT(sizeof(D) != 0); |
IanBenzMaxim | 0:33d4e66780c0 | 109 | |
IanBenzMaxim | 0:33d4e66780c0 | 110 | typedef char (&Yes)[1]; |
IanBenzMaxim | 0:33d4e66780c0 | 111 | typedef char (&No) [2]; |
IanBenzMaxim | 0:33d4e66780c0 | 112 | |
IanBenzMaxim | 0:33d4e66780c0 | 113 | template <typename T> |
IanBenzMaxim | 0:33d4e66780c0 | 114 | static Yes Check(const D*, T); |
IanBenzMaxim | 0:33d4e66780c0 | 115 | static No Check(const B*, int); |
IanBenzMaxim | 0:33d4e66780c0 | 116 | |
IanBenzMaxim | 0:33d4e66780c0 | 117 | struct Host { |
IanBenzMaxim | 0:33d4e66780c0 | 118 | operator const B*() const; |
IanBenzMaxim | 0:33d4e66780c0 | 119 | operator const D*(); |
IanBenzMaxim | 0:33d4e66780c0 | 120 | }; |
IanBenzMaxim | 0:33d4e66780c0 | 121 | |
IanBenzMaxim | 0:33d4e66780c0 | 122 | enum { Value = (sizeof(Check(Host(), 0)) == sizeof(Yes)) }; |
IanBenzMaxim | 0:33d4e66780c0 | 123 | }; |
IanBenzMaxim | 0:33d4e66780c0 | 124 | |
IanBenzMaxim | 0:33d4e66780c0 | 125 | template <typename B, typename D> struct IsBaseOf |
IanBenzMaxim | 0:33d4e66780c0 | 126 | : OrExpr<IsSame<B, D>, BoolExpr<IsBaseOfImpl<B, D> > >::Type {}; |
IanBenzMaxim | 0:33d4e66780c0 | 127 | |
IanBenzMaxim | 0:33d4e66780c0 | 128 | #endif // RAPIDJSON_HAS_CXX11_TYPETRAITS |
IanBenzMaxim | 0:33d4e66780c0 | 129 | |
IanBenzMaxim | 0:33d4e66780c0 | 130 | |
IanBenzMaxim | 0:33d4e66780c0 | 131 | ////////////////////////////////////////////////////////////////////////// |
IanBenzMaxim | 0:33d4e66780c0 | 132 | // EnableIf / DisableIf |
IanBenzMaxim | 0:33d4e66780c0 | 133 | // |
IanBenzMaxim | 0:33d4e66780c0 | 134 | template <bool Condition, typename T = void> struct EnableIfCond { typedef T Type; }; |
IanBenzMaxim | 0:33d4e66780c0 | 135 | template <typename T> struct EnableIfCond<false, T> { /* empty */ }; |
IanBenzMaxim | 0:33d4e66780c0 | 136 | |
IanBenzMaxim | 0:33d4e66780c0 | 137 | template <bool Condition, typename T = void> struct DisableIfCond { typedef T Type; }; |
IanBenzMaxim | 0:33d4e66780c0 | 138 | template <typename T> struct DisableIfCond<true, T> { /* empty */ }; |
IanBenzMaxim | 0:33d4e66780c0 | 139 | |
IanBenzMaxim | 0:33d4e66780c0 | 140 | template <typename Condition, typename T = void> |
IanBenzMaxim | 0:33d4e66780c0 | 141 | struct EnableIf : EnableIfCond<Condition::Value, T> {}; |
IanBenzMaxim | 0:33d4e66780c0 | 142 | |
IanBenzMaxim | 0:33d4e66780c0 | 143 | template <typename Condition, typename T = void> |
IanBenzMaxim | 0:33d4e66780c0 | 144 | struct DisableIf : DisableIfCond<Condition::Value, T> {}; |
IanBenzMaxim | 0:33d4e66780c0 | 145 | |
IanBenzMaxim | 0:33d4e66780c0 | 146 | // SFINAE helpers |
IanBenzMaxim | 0:33d4e66780c0 | 147 | struct SfinaeTag {}; |
IanBenzMaxim | 0:33d4e66780c0 | 148 | template <typename T> struct RemoveSfinaeTag; |
IanBenzMaxim | 0:33d4e66780c0 | 149 | template <typename T> struct RemoveSfinaeTag<SfinaeTag&(*)(T)> { typedef T Type; }; |
IanBenzMaxim | 0:33d4e66780c0 | 150 | |
IanBenzMaxim | 0:33d4e66780c0 | 151 | #define RAPIDJSON_REMOVEFPTR_(type) \ |
IanBenzMaxim | 0:33d4e66780c0 | 152 | typename ::RAPIDJSON_NAMESPACE::internal::RemoveSfinaeTag \ |
IanBenzMaxim | 0:33d4e66780c0 | 153 | < ::RAPIDJSON_NAMESPACE::internal::SfinaeTag&(*) type>::Type |
IanBenzMaxim | 0:33d4e66780c0 | 154 | |
IanBenzMaxim | 0:33d4e66780c0 | 155 | #define RAPIDJSON_ENABLEIF(cond) \ |
IanBenzMaxim | 0:33d4e66780c0 | 156 | typename ::RAPIDJSON_NAMESPACE::internal::EnableIf \ |
IanBenzMaxim | 0:33d4e66780c0 | 157 | <RAPIDJSON_REMOVEFPTR_(cond)>::Type * = NULL |
IanBenzMaxim | 0:33d4e66780c0 | 158 | |
IanBenzMaxim | 0:33d4e66780c0 | 159 | #define RAPIDJSON_DISABLEIF(cond) \ |
IanBenzMaxim | 0:33d4e66780c0 | 160 | typename ::RAPIDJSON_NAMESPACE::internal::DisableIf \ |
IanBenzMaxim | 0:33d4e66780c0 | 161 | <RAPIDJSON_REMOVEFPTR_(cond)>::Type * = NULL |
IanBenzMaxim | 0:33d4e66780c0 | 162 | |
IanBenzMaxim | 0:33d4e66780c0 | 163 | #define RAPIDJSON_ENABLEIF_RETURN(cond,returntype) \ |
IanBenzMaxim | 0:33d4e66780c0 | 164 | typename ::RAPIDJSON_NAMESPACE::internal::EnableIf \ |
IanBenzMaxim | 0:33d4e66780c0 | 165 | <RAPIDJSON_REMOVEFPTR_(cond), \ |
IanBenzMaxim | 0:33d4e66780c0 | 166 | RAPIDJSON_REMOVEFPTR_(returntype)>::Type |
IanBenzMaxim | 0:33d4e66780c0 | 167 | |
IanBenzMaxim | 0:33d4e66780c0 | 168 | #define RAPIDJSON_DISABLEIF_RETURN(cond,returntype) \ |
IanBenzMaxim | 0:33d4e66780c0 | 169 | typename ::RAPIDJSON_NAMESPACE::internal::DisableIf \ |
IanBenzMaxim | 0:33d4e66780c0 | 170 | <RAPIDJSON_REMOVEFPTR_(cond), \ |
IanBenzMaxim | 0:33d4e66780c0 | 171 | RAPIDJSON_REMOVEFPTR_(returntype)>::Type |
IanBenzMaxim | 0:33d4e66780c0 | 172 | |
IanBenzMaxim | 0:33d4e66780c0 | 173 | } // namespace internal |
IanBenzMaxim | 0:33d4e66780c0 | 174 | RAPIDJSON_NAMESPACE_END |
IanBenzMaxim | 0:33d4e66780c0 | 175 | //@endcond |
IanBenzMaxim | 0:33d4e66780c0 | 176 | |
IanBenzMaxim | 0:33d4e66780c0 | 177 | #if defined(__GNUC__) || defined(_MSC_VER) |
IanBenzMaxim | 0:33d4e66780c0 | 178 | RAPIDJSON_DIAG_POP |
IanBenzMaxim | 0:33d4e66780c0 | 179 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 180 | |
IanBenzMaxim | 0:33d4e66780c0 | 181 | #endif // RAPIDJSON_INTERNAL_META_H_ |