[IOT-2806] RESET clears all bits 93/22793/2
authorNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Thu, 12 Oct 2017 05:32:14 +0000 (22:32 -0700)
committerNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Thu, 12 Oct 2017 18:51:03 +0000 (18:51 +0000)
The RESET state should clear all the cm and tm bits before
setting the two lsbs (RESET and TAKE_OWNER bits) to 0b01 for
cm and 0b10 for tm.

Change-Id: I2b602153ea806d51bb1367514463ac590d4353db
Signed-off-by: Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
resource/csdk/security/src/deviceonboardingstate.c

index 0f73481..ccf36fc 100644 (file)
@@ -409,6 +409,11 @@ static bool EnterRESET()
     VERIFY_SUCCESS(TAG, OC_STACK_OK == SetDoxmRownerId(&THE_NIL_UUID), ERROR);
     VERIFY_SUCCESS(TAG, OC_STACK_OK == SetPstatRownerId(&THE_NIL_UUID), ERROR);
 
+    // clear all bits in cm and tm before setting the 2 lsbs
+    OicSecDpm_t dpmZero = 0;
+    VERIFY_SUCCESS(TAG, OC_STACK_OK == SetPstatCm(dpmZero), ERROR);
+    VERIFY_SUCCESS(TAG, OC_STACK_OK == SetPstatTm(dpmZero), ERROR);
+
     // Set pstat.isop = FALSE
     // Set pstat.cm RESET, and unset TAKE_OWNER
     // Unset pstat.tm RESET, and set TAKE_OWNER