[IOT-3125] OTM error with IoTivity Lite 39/26739/3
authorVitalii Irkha <v.irkha@samsung.com>
Wed, 8 Aug 2018 15:40:51 +0000 (18:40 +0300)
committerVitalii Irkha <v.irkha@samsung.com>
Thu, 9 Aug 2018 07:27:28 +0000 (10:27 +0300)
Provisioning Client send rowneruuid property during only RFOTM state
accordingly to OCF spec.
Also fixed some insignificant issues.

Change-Id: Ib82e652b8b2d7a159eec8d41c859fa88eed117d5
Signed-off-by: Vitalii Irkha <v.irkha@samsung.com>
resource/csdk/security/provisioning/src/multipleownershiptransfermanager.c
resource/csdk/security/provisioning/src/ownershiptransfermanager.c
resource/csdk/security/provisioning/src/secureresourceprovider.c

index 6e8e9e2..32ef4c1 100644 (file)
@@ -485,11 +485,11 @@ static OCStackApplicationResult MOTProvisionPreconfigPINCB(void *ctx, OCDoHandle
     VERIFY_NOT_NULL(TAG, data->ctx, ERROR);
     motCtx = (OTMContext_t *) (data->ctx);
 
-    //Generate the security payload using updated doxm
+    //Generate the security payload using updated cred
     secPayload = (OCSecurityPayload *)OICCalloc(1, sizeof(OCSecurityPayload));
     VERIFY_NOT_NULL(TAG, secPayload, ERROR);
     secPayload->base.type = PAYLOAD_TYPE_SECURITY;
-    bool propertiesToInclude[DOXM_PROPERTY_COUNT];
+    bool propertiesToInclude[CRED_PROPERTY_COUNT];
     memset(propertiesToInclude, 0, sizeof(propertiesToInclude));
     propertiesToInclude[CRED_CREDS] = true;
     postCredRes = CredToCBORPayloadPartial(motCtx->cred, NULL, &secPayload->securityData, &secPayload->payloadSize,
index 13a3a69..4f5bbdf 100644 (file)
@@ -2615,8 +2615,16 @@ OCStackResult PostProvisioningStatus(OTMContext_t* otmCtx)
     memset(propertiesToInclude, 0, sizeof(propertiesToInclude));
     propertiesToInclude[PSTAT_DOS] = true;
     propertiesToInclude[PSTAT_TM] = true;
-    propertiesToInclude[PSTAT_ROWNERUUID] = true;
-    ///pstat.rowneruuid set to the provisioningclient's /doxm.deviceuuid.
+
+    if (DOS_RFOTM != otmCtx->selectedDeviceInfo->pstat->dos.state)
+    {
+        propertiesToInclude[PSTAT_ROWNERUUID] = false;
+    }
+    else
+    {
+        propertiesToInclude[PSTAT_ROWNERUUID] = true;
+    }
+    //pstat.rowneruuid set to the provisioningclient's /doxm.deviceuuid.
     GetDoxmDeviceID(&otmCtx->selectedDeviceInfo->pstat->rownerID);
 
     if (IS_OIC(deviceInfo->specVer))
@@ -2923,8 +2931,16 @@ OCStackResult PostRownerUuid(OTMContext_t* otmCtx)
 
     bool propertiesToInclude[PSTAT_PROPERTY_COUNT];
     memset(propertiesToInclude, 0, sizeof(propertiesToInclude));
-    propertiesToInclude[PSTAT_ROWNERUUID] = true;
-    ///pstat.rowneruuid set to the provisioningclient's /doxm.deviceuuid.
+
+    if (DOS_RFOTM != otmCtx->selectedDeviceInfo->pstat->dos.state)
+    {
+        propertiesToInclude[PSTAT_ROWNERUUID] = false;
+    }
+    else
+    {
+        propertiesToInclude[PSTAT_ROWNERUUID] = true;
+    }
+    //pstat.rowneruuid set to the provisioningclient's /doxm.deviceuuid.
     GetDoxmDeviceID(&deviceInfo->pstat->rownerID);
 
     if (OC_STACK_OK != PstatToCBORPayloadPartial(deviceInfo->pstat,
index 6da75e6..f4af64c 100644 (file)
@@ -612,7 +612,7 @@ static OCStackResult provisionCredentials(OicSecCred_t *cred,
         }
         secPayload->base.type = PAYLOAD_TYPE_SECURITY;
         int secureFlag = 0;
-        bool propertiesToInclude[DOXM_PROPERTY_COUNT];
+        bool propertiesToInclude[CRED_PROPERTY_COUNT];
         memset(propertiesToInclude, 0, sizeof(propertiesToInclude));
         propertiesToInclude[CRED_CREDS] = true;
         res = CredToCBORPayloadPartial(cred, NULL, &secPayload->securityData, &secPayload->payloadSize, secureFlag, propertiesToInclude);
@@ -691,7 +691,7 @@ static OCStackResult ProvisionCredentialsDos(void *ctx, OicSecCred_t *cred,
         }
         secPayload->base.type = PAYLOAD_TYPE_SECURITY;
         int secureFlag = 0;
-        bool propertiesToInclude[DOXM_PROPERTY_COUNT];
+        bool propertiesToInclude[CRED_PROPERTY_COUNT];
         memset(propertiesToInclude, 0, sizeof(propertiesToInclude));
         propertiesToInclude[CRED_CREDS] = true;
         res = CredToCBORPayloadPartial(cred, NULL, &secPayload->securityData, &secPayload->payloadSize, secureFlag, propertiesToInclude);
@@ -1201,7 +1201,7 @@ static OCStackApplicationResult ProvisionTrustChainCB(void *ctx, OCDoHandle UNUS
         }
         secPayload->base.type = PAYLOAD_TYPE_SECURITY;
         int secureFlag = 1; /* Don't send the private key to the device, if it happens to be present */
-        bool propertiesToInclude[DOXM_PROPERTY_COUNT];
+        bool propertiesToInclude[CRED_PROPERTY_COUNT];
         memset(propertiesToInclude, 0, sizeof(propertiesToInclude));
         propertiesToInclude[CRED_CREDS] = true;
         if (OC_STACK_OK != CredToCBORPayloadPartial(trustCertChainCred, NULL, &secPayload->securityData,
@@ -1627,7 +1627,7 @@ static OCStackApplicationResult ProvisionCertificateCB(void *ctx, OCDoHandle han
     secPayload->base.type = PAYLOAD_TYPE_SECURITY;
 
     int secureFlag = 0;//don't send private data(key)
-    bool propertiesToInclude[DOXM_PROPERTY_COUNT];
+    bool propertiesToInclude[CRED_PROPERTY_COUNT];
     memset(propertiesToInclude, 0, sizeof(propertiesToInclude));
     propertiesToInclude[CRED_CREDS] = true;
     VERIFY_SUCCESS(TAG, OC_STACK_OK == CredToCBORPayloadPartial(cred, NULL, &secPayload->securityData,