Add PSKc generation feature support (#1165)

* implement PBKDF2 using AES-CMAC-PRF-128

* generate PSKc using PBKDF2, AES-CMAC-PRF-128

* expand "dataset pskc" cli to input PSKc source (passphrase, network name, extended panid)
This commit is contained in:
Shu Chen
2017-02-15 19:57:33 -08:00
committed by Jonathan Hui
parent e8611291d6
commit bf21420cd0
22 changed files with 321 additions and 17 deletions
+5 -1
View File
@@ -245,7 +245,11 @@ typedef struct otMeshLocalPrefix
uint8_t m8[OT_MESH_LOCAL_PREFIX_SIZE];
} otMeshLocalPrefix;
#define OT_PSKC_MAX_SIZE 16 ///< Maximum size of the PSKc (bytes)
#define OT_PSKC_MAX_SIZE 16 ///< Maximum size of the PSKc (bytes)
#define OT_COMMISSIONING_PASSPHRASE_MIN_SIZE 6 ///< Minimum size of the Commissioning Passphrase
#define OT_COMMISSIONING_PASSPHRASE_MAX_SIZE 255 ///< Maximum size of the Commissioning Passphrase
#define OT_COMMISSIONING_PASSPHRASE_DEFAULT "OpenThreadPassphrase" ///< The default commissioning passphrase
/**
* This structure represents PSKc.
+18
View File
@@ -639,6 +639,24 @@ OTAPI const uint8_t *OTCALL otGetMasterKey(otInstance *aInstance, uint8_t *aKeyL
*/
OTAPI ThreadError OTCALL otSetMasterKey(otInstance *aInstance, const uint8_t *aKey, uint8_t aKeyLength);
/**
* This method generates PSKc.
*
* PSKc is used to establish the Commissioner Session.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aPassPhrase The commissioning passphrase.
* @param[in] aNetworkName The network name for PSKc computation.
* @param[in] aExtPanId The extended pan id for PSKc computation.
* @param[out] aPSKc A pointer to where the generated PSKc will be placed.
*
* @retval kThreadErrorNone Successfully generate PSKc.
* @retval kThreadError_InvalidArgs If any of the input arguments is invalid.
*
*/
OTAPI ThreadError OTCALL otGeneratePSKc(otInstance *aInstance, const char *aPassPhrase, const char *aNetworkName,
const uint8_t *aExtPanId, uint8_t *aPSKc);
/**
* This function returns the maximum transmit power setting in dBm.
*