Commit d10c4a88 authored by Dan Mihai's avatar Dan Mihai Committed by Kevin Kane

[IOT-1873] Implement OCF Security CR50

1. Removed entire resource:

/oic/sec/svc

2. Removed resource properties:
    a. From /oic/sec/amacl:
        rowneruuid
        ams
        amsuuid
    b. From /oic/sec/pstat:
        deviceuuid

Change-Id: I7bbe344feb0a99ca2f8d5e77eef64f840164bc20
Signed-off-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17607Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarKevin Kane <kkane@microsoft.com>
parent 6b997d7d
......@@ -113,7 +113,6 @@ libocsrm_src = [
OCSRM_SRC + 'pstatresource.c',
OCSRM_SRC + 'doxmresource.c',
OCSRM_SRC + 'credresource.c',
OCSRM_SRC + 'svcresource.c',
OCSRM_SRC + 'pconfresource.c',
OCSRM_SRC + 'dpairingresource.c',
OCSRM_SRC + 'policyengine.c',
......
......@@ -45,19 +45,6 @@ OCStackResult InitAmaclResource();
*/
void DeInitAmaclResource();
/**
* This method is used by PolicyEngine to retrieve amsId for the resource.
* If the Amacl is found for the given resource then populate the parameter
* amsId with Amacl resource amss id.
*
* @param resource for which AMS service is required.
* @param amsId of the ams service for the given resource.
*
* @return ::OC_STACK_OK, if Amacl is found for the resource, else ::OC_STACK_ERROR,
* if no Amacl found for the resource.
*/
OCStackResult AmaclGetAmsDeviceId(const char *resource, OicUuid_t *amsId);
/**
* This function converts Amacl data into CBOR format.
* Caller needs to invoke 'free' when done using returned string.
......@@ -73,23 +60,6 @@ OCStackResult AmaclGetAmsDeviceId(const char *resource, OicUuid_t *amsId);
OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amacl, uint8_t **cborPayload,
size_t *cborSize);
/**
* Internal function to update resource owner
*
* @param newROwner new owner
*
* @retval ::OC_STACK_OK for Success, otherwise some error value
*/
OCStackResult SetAmaclRownerId(const OicUuid_t* newROwner);
/**
* Gets the OicUuid_t value for the rownerid of the amacl resource.
*
* @param rowneruuid a pointer to be assigned to the rowneruuid property
* @return ::OC_STACK_OK if rowneruuid is assigned correctly, else ::OC_STACK_ERROR.
*/
OCStackResult GetAmaclRownerId(OicUuid_t *rowneruuid);
#ifdef __cplusplus
}
#endif
......
......@@ -92,7 +92,6 @@ extern const char * OIC_JSON_VER_NAME;
//reset profile
extern const char * OIC_JSON_RESET_PF_NAME;
extern const char * OIC_JSON_SUBJECT_NAME;
extern const char * OIC_JSON_SUBJECTID_NAME;
extern const char * OIC_JSON_RESOURCES_NAME;
extern const char * OIC_JSON_AMSS_NAME;
......@@ -143,7 +142,6 @@ extern const char * OIC_JSON_EDP_NAME;
extern const char * OIC_JSON_PIN_NAME;
extern const char * OIC_JSON_PDACL_NAME;
extern const char * OIC_JSON_PDDEV_LIST_NAME;
extern const char * OIC_JSON_ROWNER_NAME;
extern const char * OIC_JSON_PRM_NAME;
extern const char * OIC_JSON_SPM_NAME;
extern const char * OIC_JSON_PDEVICE_ID_NAME;
......
//******************************************************************
//
// Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#ifndef IOTVT_SRM_SVCR_H
#define IOTVT_SRM_SVCR_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* Initialize SVC resource by loading data from persistent storage.
*
* @return ::OC_STACK_OK for Success, otherwise some error value.
*/
OCStackResult InitSVCResource();
/**
* Perform cleanup for SVC resources.
*/
void DeInitSVCResource();
/**
* This function converts SVC data into CBOR format.
* Caller needs to invoke 'free' when done using returned string.
*
* @param svc is the instance of @ref OicSecSvc_t structure. In case of NULL it
* will return ::OC_STACK_INVALID_PARAM.
* @param cborPayload is the converted cbor value of SVC structure.
* @param cborSize is the size of the cbor payload. This value is the size of the
* cborPayload. It should not be NON-NULL value.
*
* @return ::OC_STACK_OK for Success. ::OC_STACK_INVALID_PARAM in case of invalid parameters.
* ::OC_STACK_ERROR in case of error in converting to cbor.
*/
OCStackResult SVCToCBORPayload(const OicSecSvc_t *svc, uint8_t **cborPayload,
size_t *cborSize);
#ifdef __cplusplus
}
#endif
#endif //IOTVT_SRM_SVCR_H
......@@ -434,9 +434,6 @@ struct OicSecAmacl
// <Attribute ID>:<Read/Write>:<Multiple/Single>:<Mandatory?>:<Type>
size_t resourcesLen; // the number of elts in Resources
char **resources; // 0:R:M:Y:String
size_t amssLen; // the number of elts in Amss
OicUuid_t *amss; // 1:R:M:Y:acl
OicUuid_t rownerID; // 2:R:S:Y:oic.uuid
OicSecAmacl_t *next;
};
......@@ -515,7 +512,6 @@ struct OicSecPstat
bool isOp; // 0:R:S:Y:Boolean
OicSecDpm_t cm; // 1:R:S:Y:oic.sec.dpm
OicSecDpm_t tm; // 2:RW:S:Y:oic.sec.dpm
OicUuid_t deviceID; // 3:R:S:Y:oic.uuid
OicSecDpom_t om; // 4:RW:M:Y:oic.sec.dpom
size_t smLen; // the number of elts in Sm
OicSecDpom_t *sm; // 5:R:M:Y:oic.sec.dpom
......@@ -547,20 +543,6 @@ struct OicSecSacl
#endif
};
/**
* /oic/sec/svc (Service requiring a secure connection) data type.
* Derived from OIC Security Spec; see Spec for details.
*/
struct OicSecSvc
{
// <Attribute ID>:<Read/Write>:<Multiple/Single>:<Mandatory?>:<Type>
OicUuid_t svcdid; //0:R:S:Y:oic.uuid
OicSecSvcType_t svct; //1:R:M:Y:OIC Service Type
size_t ownersLen; //2:the number of elts in Owners
OicUuid_t *owners; //3:R:M:Y:oic.uuid
OicSecSvc_t *next;
};
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
struct OicSecCrl
{
......
......@@ -2345,7 +2345,6 @@ OCStackResult SRPResetDevice(const OCProvisionDev_t* pTargetDev,
pstat->cm = RESET;
pstat->isOp = false;
memcpy(pstat->deviceID.id, pTargetDev->doxm->deviceID.id, sizeof(OicUuid_t));
pstat->tm = TAKE_OWNER;
pstat->om = (OicSecDpom_t)(SINGLE_SERVICE_CLIENT_DRIVEN); // the only mode IoTivity supports currently
pstat->smLen = 1;
......
......@@ -64,9 +64,6 @@ void DeleteAmaclList(OicSecAmacl_t* amacl)
}
OICFree(amaclTmp1->resources);
// Clean Amss
OICFree(amaclTmp1->amss);
// Clean Amacl node itself
OICFree(amaclTmp1);
}
......@@ -95,8 +92,6 @@ OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayl
int64_t cborEncoderResult = CborNoError;
CborEncoder rsrcMap;
CborEncoder rlistArray;
CborEncoder amss;
char *stRowner = NULL;
const OicSecAmacl_t *amacl = amaclS;
uint8_t *outPayload = (uint8_t *)OICCalloc(1, cborLen);
......@@ -169,35 +164,6 @@ OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayl
cborEncoderResult = cbor_encoder_close_container(&amaclMap, &rsrcMap);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Resource Map.");
// TODO : Need to modify type of OicSecAmacl_t->amss based on RAML spec.
// ams -- Mandatory
cborEncoderResult = cbor_encode_text_string(&amaclMap, OIC_JSON_AMS_NAME,
strlen(OIC_JSON_AMS_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding AMSS Name Tag.");
cborEncoderResult = cbor_encoder_create_array(&amaclMap, &amss, amacl->amssLen);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding AMS Name Array.");
for (size_t i = 0; i < amacl->amssLen; i++)
{
cborEncoderResult = cbor_encode_text_string(&amss, (const char *)amacl->amss[i].id,
sizeof(amacl->amss[i].id));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding AMS Name Value.");
}
cborEncoderResult = cbor_encoder_close_container(&amaclMap, &amss);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing AMSS Array.");
// TODO : Need to check owner property in the RAML spec.
// rowner -- Mandatory
cborEncoderResult = cbor_encode_text_string(&amaclMap, OIC_JSON_ROWNERID_NAME,
strlen(OIC_JSON_ROWNERID_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding ROwnerID Name Tag.");
ret = ConvertUuidToStr(&amacl->rownerID, &stRowner);
VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
cborEncoderResult = cbor_encode_text_string(&amaclMap, stRowner, strlen(stRowner));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding ROwner Value.");
OICFree(stRowner);
cborEncoderResult = cbor_encoder_close_container(&encoder, &amaclMap);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Amacl Map.");
......@@ -374,51 +340,8 @@ OCStackResult CBORPayloadToAmacl(const uint8_t *cborPayload, size_t size,
}
OICFree(rsrcName);
}
}
// TODO : Need to modify type of OicSecAmacl_t->amss based on RAML spec.
// Ams -- Mandatory
if (0 == strcmp(OIC_JSON_AMS_NAME, name))
{
int i = 0;
CborValue amsArray = { .parser = NULL };
cborFindResult = cbor_value_get_array_length(&amaclMap, &headAmacl->amssLen);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding AMS Array Len.");
cborFindResult = cbor_value_enter_container(&amaclMap, &amsArray);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering AMS Array Container.");
headAmacl->amss = (OicUuid_t *)OICCalloc(headAmacl->amssLen, sizeof(*headAmacl->amss));
VERIFY_NOT_NULL(TAG, headAmacl->amss, ERROR);
while (cbor_value_is_valid(&amsArray) && cbor_value_is_text_string(&amsArray))
{
char *amssId = NULL;
cborFindResult = cbor_value_dup_text_string(&amsArray, &amssId, &len, NULL);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding AMS Id.");
cborFindResult = cbor_value_advance(&amsArray);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing AMS.");
memcpy(headAmacl->amss[i++].id, (OicUuid_t *)amssId, len);
OICFree(amssId);
}
}
// Rowner -- Mandatory
if (0 == strcmp(OIC_JSON_ROWNERID_NAME, name) && cbor_value_is_text_string(&amaclMap))
{
char *stRowner = NULL;
cborFindResult = cbor_value_dup_text_string(&amaclMap, &stRowner, &len, NULL);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding ROwner Value.");
ret = ConvertStrToUuid(stRowner, &headAmacl->rownerID);
VERIFY_SUCCESS(TAG, ret == OC_STACK_OK, ERROR);
OICFree(stRowner);
}
//if (CborMapType != type && cbor_value_is_valid(&amaclMap))
if (cbor_value_is_valid(&amaclMap))
{
cborFindResult = cbor_value_advance(&amaclMap);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Advancing Amacl Map.");
}
OICFree(name);
}
......@@ -596,76 +519,3 @@ void DeInitAmaclResource()
DeleteAmaclList(gAmacl);
gAmacl = NULL;
}
OCStackResult AmaclGetAmsDeviceId(const char *resource, OicUuid_t *amsDeviceId)
{
OicSecAmacl_t *amacl = NULL;
VERIFY_NOT_NULL(TAG, resource, ERROR);
VERIFY_NOT_NULL(TAG, amsDeviceId, ERROR);
LL_FOREACH(gAmacl, amacl)
{
for(size_t i = 0; i < amacl->resourcesLen; i++)
{
if (0 == strncmp((amacl->resources[i]), resource, strlen(amacl->resources[i])))
{
//Returning the ID of the first AMS service for the resource
memcpy(amsDeviceId, &amacl->amss[0], sizeof(*amsDeviceId));
return OC_STACK_OK;
}
}
}
exit:
return OC_STACK_ERROR;
}
OCStackResult SetAmaclRownerId(const OicUuid_t* newROwner)
{
OCStackResult ret = OC_STACK_ERROR;
uint8_t *cborPayload = NULL;
size_t size = 0;
OicUuid_t prevId = {.id={0}};
if(NULL == newROwner)
{
ret = OC_STACK_INVALID_PARAM;
}
if(NULL == gAmacl)
{
ret = OC_STACK_NO_RESOURCE;
}
if(newROwner && gAmacl)
{
memcpy(prevId.id, gAmacl->rownerID.id, sizeof(prevId.id));
memcpy(gAmacl->rownerID.id, newROwner->id, sizeof(newROwner->id));
ret = AmaclToCBORPayload(gAmacl, &cborPayload, &size);
VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
ret = UpdateSecureResourceInPS(OIC_JSON_AMACL_NAME, cborPayload, size);
VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
OICFree(cborPayload);
}
return ret;
exit:
OICFree(cborPayload);
memcpy(gAmacl->rownerID.id, prevId.id, sizeof(prevId.id));
return ret;
}
OCStackResult GetAmaclRownerId(OicUuid_t *rowneruuid)
{
OCStackResult retVal = OC_STACK_ERROR;
if (gAmacl)
{
*rowneruuid = gAmacl->rownerID;
retVal = OC_STACK_OK;
}
return retVal;
}
......@@ -1411,12 +1411,6 @@ static OCEntityHandlerResult HandleDoxmPostRequest(OCEntityHandlerRequest * ehRe
ehRet = OC_EH_ERROR;
goto exit;
}
ownerRes = SetAmaclRownerId(&gDoxm->owner);
if(OC_STACK_OK != ownerRes && OC_STACK_NO_RESOURCE != ownerRes)
{
ehRet = OC_EH_ERROR;
goto exit;
}
ownerRes = SetCredRownerId(&gDoxm->owner);
if(OC_STACK_OK != ownerRes && OC_STACK_NO_RESOURCE != ownerRes)
{
......
......@@ -217,47 +217,18 @@ static bool IsValidRequestFromSubOwner(SRMRequestContext_t *context)
}
#endif //MULTIPLE_OWNER
// TODO - remove these function placeholders as they are implemented
// in the resource entity handler code.
// Note that because many SVRs do not have a rowner, in those cases we
// just return "OC_STACK_ERROR" which results in a "false" return by
// IsRequestFromResourceOwner().
// As these SVRs are revised to have a rowner, these functions should be
// replaced (see pstatresource.c for example of GetPstatRownerId).
OCStackResult GetCrlRownerId(OicUuid_t *rowner)
{
OC_UNUSED(rowner);
rowner = NULL;
return OC_STACK_ERROR;
}
OCStackResult GetSaclRownerId(OicUuid_t *rowner)
{
OC_UNUSED(rowner);
rowner = NULL;
return OC_STACK_ERROR;
}
OCStackResult GetSvcRownerId(OicUuid_t *rowner)
{
OC_UNUSED(rowner);
rowner = NULL;
return OC_STACK_ERROR;
}
static GetSvrRownerId_t GetSvrRownerId[OIC_SEC_SVR_TYPE_COUNT + 1] = {
NULL,
GetAclRownerId,
GetAmaclRownerId,
NULL, // amacl's rowneruuid has been removed from the OCF 1.0 Security spec.
GetCredRownerId,
GetCrlRownerId,
NULL, // crl doesn't have rowneruuid.
GetDoxmRownerId,
GetDpairingRownerId,
GetPconfRownerId,
GetPstatRownerId,
GetSaclRownerId,
GetSvcRownerId
NULL, // sacl is not implemented yet.
NULL // svc has been removed from the OCF 1.0 Security spec.
};
/**
......@@ -278,7 +249,9 @@ bool IsRequestFromResourceOwner(SRMRequestContext_t *context)
if((OIC_R_ACL_TYPE <= context->resourceType) && \
(OIC_SEC_SVR_TYPE_COUNT > context->resourceType))
{
if(OC_STACK_OK == GetSvrRownerId[(int)context->resourceType](&resourceOwner))
GetSvrRownerId_t getRownerId = GetSvrRownerId[(int)context->resourceType];
if((NULL != getRownerId) && (OC_STACK_OK == getRownerId(&resourceOwner)))
{
retVal = UuidCmp(&context->subjectUuid, &resourceOwner);
}
......
......@@ -232,12 +232,6 @@ OCStackResult UpdateSecureResourceInPS(const char *rsrcName, const uint8_t *psPa
cborFindResult = cbor_value_dup_byte_string(&curVal, &amaclCbor, &amaclCborLen, NULL);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding AMACL Name Value.");
}
cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_SVC_NAME, &curVal);
if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
{
cborFindResult = cbor_value_dup_byte_string(&curVal, &svcCbor, &svcCborLen, NULL);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding SVC Name Value.");
}
cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_CRED_NAME, &curVal);
if (CborNoError == cborFindResult && cbor_value_is_byte_string(&curVal))
{
......@@ -322,13 +316,6 @@ OCStackResult UpdateSecureResourceInPS(const char *rsrcName, const uint8_t *psPa
cborEncoderResult |= cbor_encode_byte_string(&secRsrc, amaclCbor, amaclCborLen);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Amacl Value.");
}
if (strcmp(OIC_JSON_SVC_NAME, rsrcName) && svcCborLen)
{
cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_SVC_NAME, strlen(OIC_JSON_SVC_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SVC Name.");
cborEncoderResult |= cbor_encode_byte_string(&secRsrc, svcCbor, svcCborLen);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SVC Value.");
}
if (strcmp(OIC_JSON_CRED_NAME, rsrcName) && credCborLen)
{
cborEncoderResult |= cbor_encode_text_string(&secRsrc, OIC_JSON_CRED_NAME, strlen(OIC_JSON_CRED_NAME));
......
......@@ -54,7 +54,6 @@ static OicSecPstat_t gDefaultPstat =
false, // bool isop
TAKE_OWNER, // OicSecDpm_t cm
NORMAL, // OicSecDpm_t tm
{.id = {0}}, // OicUuid_t deviceID
SINGLE_SERVICE_CLIENT_DRIVEN, // OicSecDpom_t om */
1, // the number of elts in Sms
&gSm, // OicSecDpom_t *sm
......@@ -156,16 +155,6 @@ OCStackResult PstatToCBORPayload(const OicSecPstat_t *pstat, uint8_t **payload,
cborEncoderResult = cbor_encode_int(&pstatMap, pstat->sm[0]);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SM Name Value.");
cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_DEVICE_ID_NAME,
strlen(OIC_JSON_DEVICE_ID_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Device Id Tag.");
ret = ConvertUuidToStr(&pstat->deviceID, &strUuid);
VERIFY_SUCCESS(TAG, OC_STACK_OK == ret , ERROR);
cborEncoderResult = cbor_encode_text_string(&pstatMap, strUuid, strlen(strUuid));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Device Id Value.");
OICFree(strUuid);
strUuid = NULL;
cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_ROWNERID_NAME,
strlen(OIC_JSON_ROWNERID_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ROwner Id Tag.");
......@@ -291,23 +280,6 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz
cborFindResult = CborNoError;
}
cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_DEVICE_ID_NAME, &pstatMap);
if (CborNoError == cborFindResult && cbor_value_is_text_string(&pstatMap))
{
cborFindResult = cbor_value_dup_text_string(&pstatMap, &strUuid , &len, NULL);
VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding Device Id Value.");
ret = ConvertStrToUuid(strUuid , &pstat->deviceID);
VERIFY_SUCCESS(TAG, OC_STACK_OK == ret, ERROR);
OICFree(strUuid );
strUuid = NULL;
}
else
{
memcpy(&pstat->deviceID, &gPstat->deviceID, sizeof(OicUuid_t));
cborFindResult = CborNoError;
}
cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_CM_NAME, &pstatMap);
if (CborNoError == cborFindResult && cbor_value_is_integer(&pstatMap))
{
......@@ -611,7 +583,6 @@ static OCEntityHandlerResult HandlePstatPostRequest(OCEntityHandlerRequest *ehRe
gPstat->om = pstat->om;
gPstat->tm = pstat->tm;
gPstat->cm = pstat->cm;
memcpy(&(gPstat->deviceID), &(pstat->deviceID), sizeof(OicUuid_t));
memcpy(&(gPstat->rownerID), &(pstat->rownerID), sizeof(OicUuid_t));
// Convert pstat data into CBOR for update to persistent storage
......@@ -751,7 +722,6 @@ OCStackResult InitPstatResource()
// Read Pstat resource from PS
uint8_t *data = NULL;
size_t size = 0;
OicUuid_t emptyUuid = {.id={0}};
ret = GetSecureVirtualDatabaseFromPS(OIC_JSON_PSTAT_NAME, &data, &size);
// If database read failed
if (OC_STACK_OK != ret)
......@@ -775,16 +745,6 @@ OCStackResult InitPstatResource()
}
VERIFY_NOT_NULL(TAG, gPstat, FATAL);
//In case of Pstat's device id is empty, fill the device id as doxm's device id.
if(0 == memcmp(&gPstat->deviceID, &emptyUuid, sizeof(OicUuid_t)))
{
OicUuid_t doxmUuid = {.id={0}};
if(OC_STACK_OK == GetDoxmDeviceID(&doxmUuid))
{
memcpy(&gPstat->deviceID, &doxmUuid, sizeof(OicUuid_t));
}
}
// Instantiate 'oic.sec.pstat'
ret = CreatePstatResource();
......@@ -907,7 +867,6 @@ OCStackResult SetPstatSelfOwnership(const OicUuid_t* newROwner)
gPstat->cm = (OicSecDpm_t)(gPstat->cm & (~TAKE_OWNER));
gPstat->isOp = true;
memcpy(gPstat->deviceID.id, newROwner->id, sizeof(newROwner->id));
memcpy(gPstat->rownerID.id, newROwner->id, sizeof(newROwner->id));
ret = PstatToCBORPayload(gPstat, &cborPayload, &size, false);
......
......@@ -25,7 +25,6 @@
#include "pstatresource.h"
#include "doxmresource.h"
#include "credresource.h"
#include "svcresource.h"
#include "amaclresource.h"
#include "oic_malloc.h"
#include "oic_string.h"
......@@ -98,10 +97,6 @@ OCStackResult InitSecureResources( )
ret = InitCRLResource();
}
#endif // __WITH_DTLS__ || __WITH_TLS__
if(OC_STACK_OK == ret)
{
ret = InitSVCResource();
}
if(OC_STACK_OK == ret)
{
ret = InitAmaclResource();
......@@ -137,7 +132,6 @@ OCStackResult DestroySecureResources( )
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
DeInitCRLResource();
#endif // __WITH_DTLS__ || __WITH_TLS__
DeInitSVCResource();
DeInitAmaclResource();
//#ifdef DIRECT_PAIRING
DeInitPconfResource();
......
......@@ -58,12 +58,12 @@ const char * OIC_RSRC_TYPE_SEC_CRL = "oic.r.crl";
const char * OIC_RSRC_CRL_URI = "/oic/sec/crl";
const char * OIC_JSON_CRL_NAME = "crl";
//SACL
//SACL - not implemented yet
const char * OIC_RSRC_TYPE_SEC_SACL = "oic.r.sacl";
const char * OIC_RSRC_SACL_URI = "/oic/sec/sacl";
const char * OIC_JSON_SACL_NAME = "sacl";
//svc
//svc - removed from the OCF 1.0 Security spec and from IoTivity
const char * OIC_RSRC_TYPE_SEC_SVC = "oic.r.svc";
const char * OIC_RSRC_SVC_URI = "/oic/sec/svc";
const char * OIC_JSON_SVC_NAME = "svc";
......@@ -86,7 +86,6 @@ const char * OIC_JSON_VER_NAME = "ver";
//reset profile
const char * OIC_JSON_RESET_PF_NAME = "resetpf";
const char * OIC_JSON_SUBJECT_NAME = "subject";
const char * OIC_JSON_RESOURCES_NAME = "resources";
const char * OIC_JSON_AMSS_NAME = "amss";
const char * OIC_JSON_AMS_NAME = "ams";
......@@ -137,7 +136,6 @@ const char * OIC_JSON_EDP_NAME = "edp";
const char * OIC_JSON_PIN_NAME = "pin";
const char * OIC_JSON_PDACL_NAME = "pdacl";
const char * OIC_JSON_PDDEV_LIST_NAME = "pddev";
const char * OIC_JSON_ROWNER_NAME = "rowner";
const char * OIC_JSON_PRM_NAME = "prm";
const char * OIC_JSON_SPM_NAME = "spm";
const char * OIC_JSON_PDEVICE_ID_NAME = "pdeviceuuid";
......
//******************************************************************
//
// Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0