[IOT-2478] pstat.cm default in SRESET is incorrect
authorNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Thu, 13 Jul 2017 00:40:15 +0000 (17:40 -0700)
committerNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Fri, 14 Jul 2017 16:26:12 +0000 (16:26 +0000)
Per spec, the /pstat.cm value should be 0x0000 0001 and .tm should
be 0x0000 0000.

Also fixed a similar error in RESET state values.

Change-Id: I9fae4d2e5fb8845bd51c26555dcb8c774885d6f3
Signed-off-by: Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21413
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/csdk/security/src/deviceonboardingstate.c

index 625d1b3..d896aa0 100644 (file)
@@ -412,7 +412,7 @@ static bool EnterRESET()
     // Unset pstat.tm and set TAKE_OWNER
     // Set pstat.dos.s to RESET
     VERIFY_SUCCESS(TAG,
-        EnterStateGeneric(false, true, false, false, false, DOS_RESET),
+        EnterStateGeneric(false, true, false, false, true, DOS_RESET),
         ERROR);
 
 exit:
@@ -428,10 +428,12 @@ static bool EnterSRESET()
     bool ret = false;
 
     // Set pstat.isop = FALSE
-    VERIFY_SUCCESS(TAG, OC_STACK_OK == SetPstatIsop(false), ERROR);
-
-    // Set pstat.dos to SRESET
-    VERIFY_SUCCESS(TAG, OC_STACK_OK == SetPstatDosS(DOS_SRESET), ERROR);
+    // Set pstat.cm RESET and unset TAKE_OWNER
+    // Unset pstat.tm and unset TAKE_OWNER
+    // Set pstat.dos.s to RESET
+    VERIFY_SUCCESS(TAG,
+        EnterStateGeneric(false, true, false, false, false, DOS_SRESET),
+        ERROR);
 
     ret = true;