[mac] remove "packed" requirement for Mac::KeyMaterial (#7021)

This commit removes the `OT_TOOL_PACKED` requirement from types
`otMacKeyMaterial` and `Mac::KeyMaterial`. Generally, we define a
type as "packed"  if it may be embedded in a message/buffer (e.g. a
TLV) and/or may be cast from a buffer pointer. Neither case applies
to `KeyMaterial`.
This commit is contained in:
Abtin Keshavarzian
2021-09-23 09:48:48 -07:00
committed by GitHub
parent 8d268663ef
commit 6ef5534a51
3 changed files with 4 additions and 12 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (167)
#define OPENTHREAD_API_VERSION (168)
/**
* @addtogroup api-instance
+2 -9
View File
@@ -212,21 +212,14 @@ typedef otCryptoKeyRef otMacKeyRef;
* This structure represents a MAC Key.
*
*/
OT_TOOL_PACKED_BEGIN
struct otMacKeyMaterial
typedef struct otMacKeyMaterial
{
union
{
otMacKeyRef mKeyRef; ///< Reference to the key stored.
otMacKey mKey; ///< Key stored as literal.
} mKeyMaterial;
} OT_TOOL_PACKED_END;
/**
* This structure represents a MAC Key reference.
*
*/
typedef struct otMacKeyMaterial otMacKeyMaterial;
} otMacKeyMaterial;
/**
* This enumeration defines constants about key types.
+1 -2
View File
@@ -440,7 +440,6 @@ typedef otMacKeyRef KeyRef;
* This class represents a MAC Key Material.
*
*/
OT_TOOL_PACKED_BEGIN
class KeyMaterial : public otMacKeyMaterial, public Unequatable<KeyMaterial>
{
public:
@@ -550,7 +549,7 @@ private:
#endif
Key &GetKey(void) { return static_cast<Key &>(mKeyMaterial.mKey); }
void SetKey(const Key &aKey) { mKeyMaterial.mKey = aKey; }
} OT_TOOL_PACKED_END;
};
/**
* This structure represents an IEEE 802.15.4 Extended PAN Identifier.