Resolved JIRA [IOT-1009]
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / src / ocprovisioningmanager.c
index 4a463ca..d50fc36 100644 (file)
@@ -28,6 +28,9 @@
 #include "secureresourceprovider.h"
 #include "provisioningdatabasemanager.h"
 #include "credresource.h"
+#include "utlist.h"
+#include "aclresource.h" //Note: SRM internal header
+#include "pconfresource.h"
 
 #define TAG "OCPMAPI"
 
@@ -73,7 +76,7 @@ OCStackResult OCInitPM(const char* dbPath)
  */
 OCStackResult OCDiscoverUnownedDevices(unsigned short timeout, OCProvisionDev_t **ppList)
 {
-    if( ppList == NULL || *ppList != NULL)
+    if( ppList == NULL || *ppList != NULL || 0 == timeout)
     {
         return OC_STACK_INVALID_PARAM;
     }
@@ -92,7 +95,7 @@ OCStackResult OCDiscoverUnownedDevices(unsigned short timeout, OCProvisionDev_t
  */
 OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList)
 {
-    if( ppList == NULL || *ppList != NULL)
+    if( ppList == NULL || *ppList != NULL || 0 == timeout)
     {
         return OC_STACK_INVALID_PARAM;
     }
@@ -111,7 +114,7 @@ OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t*
 {
     if(NULL == callbackData)
     {
-        return OC_STACK_INVALID_PARAM;
+        return OC_STACK_INVALID_CALLBACK ;
     }
 
     return OTMSetOwnershipTransferCallbackData(oxm, callbackData);
@@ -125,7 +128,11 @@ OCStackResult OCDoOwnershipTransfer(void* ctx,
     {
         return OC_STACK_INVALID_PARAM;
     }
-
+    if (!resultCallback)
+    {
+        OIC_LOG(INFO, TAG, "OCDoOwnershipTransfer : NULL Callback");
+        return OC_STACK_INVALID_CALLBACK;
+    }
     return OTMDoOwnershipTransfer(ctx, targetDevices, resultCallback);
 }
 
@@ -176,6 +183,22 @@ OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t ke
 
 }
 
+/**
+ * this function sends Direct-Pairing Configuration to a device.
+ *
+ * @param[in] ctx Application context would be returned in result callback.
+ * @param[in] selectedDeviceInfo Selected target device.
+ * @param[in] pconf PCONF pointer.
+ * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
+              request recieves a response from resource server.
+ * @return  OC_STACK_OK in case of success and other value otherwise.
+ */
+OCStackResult OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecPconf_t *pconf,
+                             OCProvisionResultCB resultCallback)
+{
+    return SRPProvisionDirectPairing(ctx, selectedDeviceInfo, pconf, resultCallback);
+}
+
 /*
 * Function to unlink devices.
 * This function will remove the credential & relationship between the two devices.
@@ -192,13 +215,23 @@ OCStackResult OCUnlinkDevices(void* ctx,
                               const OCProvisionDev_t* pTargetDev2,
                               OCProvisionResultCB resultCallback)
 {
-    OC_LOG(INFO, TAG, "IN OCUnlinkDevices");
+    OIC_LOG(INFO, TAG, "IN OCUnlinkDevices");
     OCUuidList_t* idList = NULL;
     size_t numOfDev = 0;
 
-    if (!pTargetDev1 || !pTargetDev2 || !resultCallback)
+    if (!pTargetDev1 || !pTargetDev2 || !pTargetDev1->doxm || !pTargetDev2->doxm)
+    {
+        OIC_LOG(ERROR, TAG, "OCUnlinkDevices : NULL parameters");
+        return OC_STACK_INVALID_PARAM;
+    }
+    if (!resultCallback)
+    {
+        OIC_LOG(INFO, TAG, "OCUnlinkDevices : NULL Callback");
+        return OC_STACK_INVALID_CALLBACK;
+    }
+    if (0 == memcmp(&pTargetDev1->doxm->deviceID, &pTargetDev2->doxm->deviceID, sizeof(OicUuid_t)))
     {
-        OC_LOG(ERROR, TAG, "OCUnlinkDevices : NULL parameters");
+        OIC_LOG(INFO, TAG, "OCUnlinkDevices : Same device ID");
         return OC_STACK_INVALID_PARAM;
     }
 
@@ -206,12 +239,12 @@ OCStackResult OCUnlinkDevices(void* ctx,
     OCStackResult res = PDMGetLinkedDevices(&(pTargetDev1->doxm->deviceID), &idList, &numOfDev);
     if (OC_STACK_OK != res)
     {
-        OC_LOG(ERROR, TAG, "OCUnlinkDevices : PDMgetOwnedDevices failed");
+        OIC_LOG(ERROR, TAG, "OCUnlinkDevices : PDMgetOwnedDevices failed");
         goto error;
     }
     if (1 > numOfDev)
     {
-        OC_LOG(DEBUG, TAG, "OCUnlinkDevices : Can not find linked devices");
+        OIC_LOG(DEBUG, TAG, "OCUnlinkDevices : Can not find linked devices");
         res = OC_STACK_INVALID_PARAM; // Input devices are not linked, No request is made
         goto error;
     }
@@ -225,17 +258,17 @@ OCStackResult OCUnlinkDevices(void* ctx,
             res = SRPUnlinkDevices(ctx, pTargetDev1, pTargetDev2, resultCallback);
             if (OC_STACK_OK != res)
             {
-                OC_LOG(ERROR, TAG, "OCUnlinkDevices : Failed to unlink devices.");
+                OIC_LOG(ERROR, TAG, "OCUnlinkDevices : Failed to unlink devices.");
             }
             goto error;
         }
         curDev = curDev->next;
     }
-    OC_LOG(DEBUG, TAG, "No matched pair found from provisioning database");
+    OIC_LOG(DEBUG, TAG, "No matched pair found from provisioning database");
     res = OC_STACK_INVALID_PARAM; // Input devices are not linked, No request is made
 
 error:
-    OC_LOG(INFO, TAG, "OUT OCUnlinkDevices");
+    OIC_LOG(INFO, TAG, "OUT OCUnlinkDevices");
 
     PDMDestoryOicUuidLinkList(idList);
     return res;
@@ -256,13 +289,18 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis
                             const OCProvisionDev_t* pTargetDev,
                             OCProvisionResultCB resultCallback)
 {
-    OC_LOG(INFO, TAG, "IN OCRemoveDevice");
+    OIC_LOG(INFO, TAG, "IN OCRemoveDevice");
     OCStackResult res = OC_STACK_ERROR;
-    if (!pTargetDev || !resultCallback || 0 == waitTimeForOwnedDeviceDiscovery)
+    if (!pTargetDev || 0 == waitTimeForOwnedDeviceDiscovery)
     {
-        OC_LOG(INFO, TAG, "OCRemoveDevice : Invalied parameters");
+        OIC_LOG(INFO, TAG, "OCRemoveDevice : Invalied parameters");
         return OC_STACK_INVALID_PARAM;
     }
+    if (!resultCallback)
+    {
+        OIC_LOG(INFO, TAG, "OCRemoveDevice : NULL Callback");
+        return OC_STACK_INVALID_CALLBACK;
+    }
 
     // Send DELETE requests to linked devices
     OCStackResult resReq = OC_STACK_ERROR; // Check that we have to wait callback or not.
@@ -271,11 +309,11 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis
     {
         if (OC_STACK_CONTINUE == resReq)
         {
-            OC_LOG(DEBUG, TAG, "OCRemoveDevice : Revoked device has no linked device except PT.");
+            OIC_LOG(DEBUG, TAG, "OCRemoveDevice : Revoked device has no linked device except PT.");
         }
         else
         {
-            OC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to invoke SRPRemoveDevice");
+            OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to invoke SRPRemoveDevice");
             res = resReq;
             goto error;
         }
@@ -286,30 +324,56 @@ OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDis
     cred = GetCredResourceData(&pTargetDev->doxm->deviceID);
     if (cred == NULL)
     {
-        OC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to get credential of remove device.");
+        OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to get credential of remove device.");
         goto error;
     }
 
     res = RemoveCredential(&cred->subject);
     if (res != OC_STACK_RESOURCE_DELETED)
     {
-        OC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to remove credential.");
+        OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to remove credential.");
         goto error;
     }
 
-    // Remove device info from prvisioning database.
-    res = PDMDeleteDevice(&pTargetDev->doxm->deviceID);
+    /**
+     * Change the device status as stale status.
+     * If all request are successed, this device information will be deleted.
+     */
+    res = PDMSetDeviceStale(&pTargetDev->doxm->deviceID);
     if (res != OC_STACK_OK)
     {
-        OC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to delete device in PDM.");
+        OIC_LOG(ERROR, TAG, "OCRemoveDevice : Failed to set device status as stale");
         goto error;
     }
 
-    // Check that we have to wait callback for DELETE request or not
+    // TODO: We need to add new mechanism to clean up the stale state of the device.
+
     res = resReq;
 
+    //Close the DTLS session of the removed device.
+    CAEndpoint_t* endpoint = (CAEndpoint_t *)&pTargetDev->endpoint;
+    endpoint->port = pTargetDev->securePort;
+    CAResult_t caResult = CACloseDtlsSession(endpoint);
+    if(CA_STATUS_OK != caResult)
+    {
+        OIC_LOG_V(WARNING, TAG, "OCRemoveDevice : Failed to close DTLS session : %d", caResult);
+    }
+
+    /**
+     * If there is no linked device, PM does not send any request.
+     * So we should directly invoke the result callback to inform the result of OCRemoveDevice.
+     */
+    if(OC_STACK_CONTINUE == res)
+    {
+        if(resultCallback)
+        {
+            resultCallback(ctx, 0, NULL, false);
+        }
+        res = OC_STACK_OK;
+    }
+
 error:
-    OC_LOG(INFO, TAG, "OUT OCRemoveDevice");
+    OIC_LOG(INFO, TAG, "OUT OCRemoveDevice");
     return res;
 }
 
@@ -320,7 +384,7 @@ error:
 static void UpdateLinkResults(Linkdata_t *link, int device, OCStackResult stackresult)
 {
 
-    OC_LOG_V(INFO,TAG,"value of link->currentCountResults is %d",link->currentCountResults);
+    OIC_LOG_V(INFO,TAG,"value of link->currentCountResults is %d",link->currentCountResults);
     if (1 == device)
     {
         memcpy(link->resArr[(link->currentCountResults)].deviceId.id, link->pDev1->doxm->deviceID.id,UUID_LENGTH);
@@ -342,7 +406,7 @@ static void AclProv2CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool has
 
     if (NULL == ctx)
     {
-        OC_LOG(ERROR,TAG,"Context is Null in ACLProv 2");
+        OIC_LOG(ERROR,TAG,"Context is Null in ACLProv 2");
         return;
     }
     (void)nOfRes;
@@ -353,7 +417,7 @@ static void AclProv2CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool has
     if (hasError)
     {
         UpdateLinkResults(link, 2,arr[0].res);
-        OC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1");
+        OIC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1");
         ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
                                                 link->resArr,
                                                 true);
@@ -378,7 +442,7 @@ static void AclProv1CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool has
 
     if (NULL == ctx)
     {
-        OC_LOG(ERROR,TAG,"Context is Null in ACLProv1");
+        OIC_LOG(ERROR,TAG,"Context is Null in ACLProv1");
         return;
     }
     (void)nOfRes;
@@ -387,7 +451,7 @@ static void AclProv1CB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bool has
 
     if (hasError)
     {
-        OC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1");
+        OIC_LOG(ERROR,TAG,"Error occured while ACL provisioning device 1");
         UpdateLinkResults(link, 1, arr[0].res);
         ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
                                                 link->resArr,
@@ -428,17 +492,17 @@ static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bo
 {
     if (NULL == ctx)
     {
-        OC_LOG(ERROR,TAG,"Error occured while credential provisioning");
+        OIC_LOG(ERROR,TAG,"Error occured while credential provisioning");
         return;
     }
     Linkdata_t *link = (Linkdata_t*)ctx;
     OCProvisionResultCB resultCallback = link->resultCallback;
-    OC_LOG_V(INFO, TAG, "has error returned %d",hasError);
+    OIC_LOG_V(INFO, TAG, "has error returned %d",hasError);
     UpdateLinkResults(link, 1, arr[0].res);
     UpdateLinkResults(link, 2, arr[1].res);
     if (hasError)
     {
-        OC_LOG(ERROR,TAG,"Error occured while credential provisioning");
+        OIC_LOG(ERROR,TAG,"Error occured while credential provisioning");
         ((OCProvisionResultCB)(resultCallback))(link->ctx, nOfRes,
                                                 link->resArr,
                                                 true);
@@ -452,7 +516,7 @@ static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bo
         OCStackResult res =  SRPProvisionACL(ctx, link->pDev1, link->pDev1Acl, &AclProv1CB);
         if (OC_STACK_OK!=res)
         {
-             OC_LOG(ERROR, TAG, "Error while provisioning ACL for device 1");
+             OIC_LOG(ERROR, TAG, "Error while provisioning ACL for device 1");
              UpdateLinkResults(link, 1, res);
              ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
                                                      link->resArr,
@@ -463,11 +527,11 @@ static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bo
     }
     else if (NULL!=link->pDev2Acl)
     {
-        OC_LOG(ERROR, TAG, "ACL for device 1 is NULL");
+        OIC_LOG(ERROR, TAG, "ACL for device 1 is NULL");
         OCStackResult res =  SRPProvisionACL(ctx, link->pDev2, link->pDev2Acl, &AclProv2CB);
         if (OC_STACK_OK!=res)
         {
-             OC_LOG(ERROR, TAG, "Error while provisioning ACL for device 2");
+             OIC_LOG(ERROR, TAG, "Error while provisioning ACL for device 2");
               UpdateLinkResults(link, 2, res);
              ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
                                                      link->resArr,
@@ -478,7 +542,7 @@ static void ProvisionCredsCB(void* ctx, int nOfRes, OCProvisionResult_t *arr, bo
     }
     else
     {
-        OC_LOG(INFO, TAG, "ACLs of both devices are NULL");
+        OIC_LOG(INFO, TAG, "ACLs of both devices are NULL");
         ((OCProvisionResultCB)(resultCallback))(link->ctx, link->currentCountResults,
                                                 link->resArr,
                                                 false);
@@ -506,32 +570,57 @@ OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_
                                          OCProvisionResultCB resultCallback)
 {
 
-    if (!pDev1 || !pDev2 || !resultCallback)
+    if (!pDev1 || !pDev2 || !pDev1->doxm || !pDev2->doxm)
     {
-        OC_LOG(ERROR, TAG, "OCProvisionPairwiseDevices : Invalid parameters");
+        OIC_LOG(ERROR, TAG, "OCProvisionPairwiseDevices : Invalid parameters");
         return OC_STACK_INVALID_PARAM;
     }
+    if (!resultCallback)
+    {
+        OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : NULL Callback");
+        return OC_STACK_INVALID_CALLBACK;
+    }
     if (!(keySize == OWNER_PSK_LENGTH_128 || keySize == OWNER_PSK_LENGTH_256))
     {
-        OC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Invalid key size");
+        OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Invalid key size");
+        return OC_STACK_INVALID_PARAM;
+    }
+    if (0 == memcmp(&pDev1->doxm->deviceID, &pDev2->doxm->deviceID, sizeof(OicUuid_t)))
+    {
+        OIC_LOG(INFO, TAG, "OCProvisionPairwiseDevices : Same device ID");
+        return OC_STACK_INVALID_PARAM;
+    }
+
+    OIC_LOG(DEBUG, TAG, "Checking link in DB");
+    bool linkExists = true;
+    OCStackResult res = PDMIsLinkExists(&pDev1->doxm->deviceID, &pDev2->doxm->deviceID, &linkExists);
+    if(res != OC_STACK_OK)
+    {
+        OIC_LOG(ERROR, TAG, "Internal Error Occured");
+        return res;
+    }
+    if (linkExists)
+    {
+        OIC_LOG(ERROR, TAG, "Link already exists");
         return OC_STACK_INVALID_PARAM;
     }
+
     int noOfResults = 2; // Initial Value
-    if (NULL!=pDev1Acl)
+    if (NULL != pDev1Acl)
     {
         ++noOfResults;
     }
-    if (NULL!=pDev2Acl)
+    if (NULL != pDev2Acl)
     {
        ++noOfResults;
     }
     Linkdata_t *link = (Linkdata_t*) OICMalloc(sizeof(Linkdata_t));
     if (!link)
     {
-        OC_LOG(ERROR, TAG, "Failed to memory allocation");
+        OIC_LOG(ERROR, TAG, "Failed to memory allocation");
         return OC_STACK_NO_MEMORY;
     }
-    OC_LOG_V(INFO,TAG, "Maximum no od results %d",noOfResults);
+    OIC_LOG_V(INFO,TAG, "Maximum no od results %d",noOfResults);
 
     link->pDev1 = pDev1;
     link->pDev1Acl = pDev1Acl;
@@ -544,7 +633,7 @@ OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_
     link->resultCallback = resultCallback;
     link->currentCountResults = 0;
     link->resArr = (OCProvisionResult_t*) OICMalloc(sizeof(OCProvisionResult_t)*noOfResults);
-    OCStackResult res = SRPProvisionCredentials(link, type, keySize,
+    res = SRPProvisionCredentials(link, type, keySize,
                                      pDev1, pDev2, &ProvisionCredsCB);
     if (res != OC_STACK_OK)
     {
@@ -554,3 +643,150 @@ OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_
     return res;
 
 }
+
+OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime,
+                                       OCProvisionDev_t** pOwnedDevList,
+                                       OCProvisionDev_t** pUnownedDevList)
+{
+    //TODO will be replaced by more efficient logic
+    if (pOwnedDevList == NULL || *pOwnedDevList != NULL || pUnownedDevList == NULL
+         || *pUnownedDevList != NULL || 0 == waittime)
+    {
+        return OC_STACK_INVALID_PARAM;
+    }
+
+    // Code for unowned discovery
+    OCProvisionDev_t *unownedDevice = NULL;
+    OCStackResult res =  OCDiscoverUnownedDevices(waittime/2, &unownedDevice);
+    if (OC_STACK_OK != res)
+    {
+        OIC_LOG(ERROR,TAG, "Error in unowned discovery");
+        return res;
+    }
+
+    // Code for owned discovery
+    OCProvisionDev_t *ownedDevice = NULL;
+    res =  OCDiscoverOwnedDevices(waittime/2, &ownedDevice);
+    if (OC_STACK_OK != res)
+    {
+        OIC_LOG(ERROR,TAG, "Error in owned discovery");
+        PMDeleteDeviceList(unownedDevice);
+        return res;
+    }
+
+    // Code to get list of all the owned devices.
+    OCUuidList_t *uuidList = NULL;
+    size_t numOfDevices = 0;
+    res =  PDMGetOwnedDevices(&uuidList, &numOfDevices);
+    if (OC_STACK_OK != res)
+    {
+        OIC_LOG(ERROR, TAG, "Error while getting info from DB");
+        PMDeleteDeviceList(unownedDevice);
+        PMDeleteDeviceList(ownedDevice);
+        return res;
+    }
+
+    // Code to compare devices in owned list and deviceid from DB.
+    OCProvisionDev_t* pCurDev = ownedDevice;
+    size_t deleteCnt = 0;
+    while (pCurDev)
+    {
+        if(true == PMDeleteFromUUIDList(uuidList, &pCurDev->doxm->deviceID))
+        {
+            deleteCnt++;
+        }
+        pCurDev = pCurDev->next;
+    }
+    // If there is no remaind device in uuidList, we have to assign NULL to prevent free.
+    if (deleteCnt == numOfDevices)
+    {
+        uuidList = NULL;
+    }
+    // Code to add information of the devices which are currently off in owned list.
+    OCUuidList_t *powerOffDeviceList = uuidList;
+    while (powerOffDeviceList)
+    {
+        OCProvisionDev_t *ptr = (OCProvisionDev_t *)OICCalloc(1, sizeof (OCProvisionDev_t));
+        if (NULL == ptr)
+        {
+            OIC_LOG(ERROR,TAG,"Fail to allocate memory");
+            PMDeleteDeviceList(unownedDevice);
+            PMDeleteDeviceList(ownedDevice);
+            OCDeleteUuidList(uuidList);
+            return OC_STACK_NO_MEMORY;
+        }
+
+        ptr->doxm = (OicSecDoxm_t*)OICCalloc(1, sizeof(OicSecDoxm_t));
+        if (NULL == ptr->doxm)
+        {
+            OIC_LOG(ERROR,TAG,"Fail to allocate memory");
+            PMDeleteDeviceList(unownedDevice);
+            PMDeleteDeviceList(ownedDevice);
+            OCDeleteUuidList(uuidList);
+            OICFree(ptr);
+            return OC_STACK_NO_MEMORY;
+        }
+
+        memcpy(ptr->doxm->deviceID.id, powerOffDeviceList->dev.id, sizeof(ptr->doxm->deviceID.id));
+
+        ptr->devStatus = DEV_STATUS_OFF;
+        LL_PREPEND(ownedDevice, ptr);
+        powerOffDeviceList = powerOffDeviceList->next;
+
+    }
+    OCDeleteUuidList(uuidList);
+    *pOwnedDevList = ownedDevice;
+    *pUnownedDevList = unownedDevice;
+    return OC_STACK_OK;
+}
+
+OCStackResult OCGetLinkedStatus(const OicUuid_t* uuidOfDevice, OCUuidList_t** uuidList,
+                                 size_t* numOfDevices)
+{
+    return PDMGetLinkedDevices(uuidOfDevice, uuidList, numOfDevices);
+}
+
+void OCDeleteUuidList(OCUuidList_t* pList)
+{
+    PDMDestoryOicUuidLinkList(pList);
+}
+
+/**
+ * This function deletes ACL data.
+ *
+ * @param pAcl Pointer to OicSecAcl_t structure.
+ */
+void OCDeleteACLList(OicSecAcl_t* pAcl)
+{
+    DeleteACLList(pAcl);
+}
+
+/**
+ * This function deletes PDACL data.
+ *
+ * @param pPdAcl Pointer to OicSecPdAcl_t structure.
+ */
+void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl)
+{
+    FreePdAclList(pPdAcl);
+}
+
+
+#ifdef __WITH_X509__
+/**
+ * this function sends CRL information to resource.
+ *
+ * @param[in] ctx Application context would be returned in result callback.
+ * @param[in] selectedDeviceInfo Selected target device.
+ * @param[in] crl CRL to provision.
+ * @param[in] resultCallback callback provided by API user, callback will be called when provisioning
+              request recieves a response from resource server.
+ * @return  OC_STACK_OK in case of success and other value otherwise.
+ */
+OCStackResult OCProvisionCRL(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecCrl_t *crl,
+                             OCProvisionResultCB resultCallback)
+{
+    return SRPProvisionCRL(ctx, selectedDeviceInfo, crl, resultCallback);
+}
+#endif // __WITH_X509__
+