[CONPRO-1473] Fix for build error [-Werror=implicit-function-declaration]
[platform/upstream/iotivity.git] / resource / csdk / security / provisioning / src / oxmpreconfpin.c
index 7083834..4e05209 100644 (file)
 #include "cainterface.h"
 #include "ocrandom.h"
 #include "oic_malloc.h"
+#include "oic_string.h"
 #include "logger.h"
 #include "pbkdf2.h"
-#include "global.h"
 #include "base64.h"
 #include "oxmpreconfpin.h"
 #include "ownershiptransfermanager.h"
 #include "pinoxmcommon.h"
 #include "srmresourcestrings.h"
 
-#define TAG "OXM_PreconfigPIN"
+#define TAG "OIC_OXM_PreconfigPIN"
 
-OCStackResult CreatePreconfPinBasedSelectOxmPayload(OTMContext_t* otmCtx, uint8_t **payload, size_t *size)
+OCStackResult CreatePreconfigPinBasedSelectOxmPayload(OTMContext_t *otmCtx, uint8_t **payload, size_t *size)
 {
     if(!otmCtx || !otmCtx->selectedDeviceInfo || !payload || *payload || !size)
     {
@@ -51,7 +51,7 @@ OCStackResult CreatePreconfPinBasedSelectOxmPayload(OTMContext_t* otmCtx, uint8_
     return DoxmToCBORPayload(otmCtx->selectedDeviceInfo->doxm, payload, size, true);
 }
 
-OCStackResult CreatePreconfPinBasedOwnerTransferPayload(OTMContext_t* otmCtx, uint8_t **payload, size_t *size)
+OCStackResult CreatePreconfigPinBasedOwnerTransferPayload(OTMContext_t *otmCtx, uint8_t **payload, size_t *size)
 {
     if(!otmCtx || !otmCtx->selectedDeviceInfo || !payload || *payload || !size)
     {
@@ -72,9 +72,9 @@ OCStackResult CreatePreconfPinBasedOwnerTransferPayload(OTMContext_t* otmCtx, ui
     return DoxmToCBORPayload(otmCtx->selectedDeviceInfo->doxm, payload, size, true);
 }
 
-OCStackResult LoadPreconfPinCodeCallback(OTMContext_t *otmCtx)
+OCStackResult LoadPreconfigPinCodeCallback(OTMContext_t *otmCtx)
 {
-    OIC_LOG(INFO, TAG, "IN LoadPreconfPinCodeCallback");
+    OIC_LOG(INFO, TAG, "IN LoadPreconfigPinCodeCallback");
     OCStackResult res = OC_STACK_ERROR;
     OicSecCred_t* cred = GetCredResourceData(&otmCtx->selectedDeviceInfo->doxm->deviceID);
     if(NULL == cred)
@@ -146,7 +146,7 @@ OCStackResult LoadPreconfPinCodeCallback(OTMContext_t *otmCtx)
             res = OC_STACK_ERROR;
         }
     }
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
     //in case of MOT
     else if(true == otmCtx->selectedDeviceInfo->doxm->owned &&
             otmCtx->selectedDeviceInfo->doxm->mom &&
@@ -158,19 +158,19 @@ OCStackResult LoadPreconfPinCodeCallback(OTMContext_t *otmCtx)
             res = OC_STACK_ERROR;
         }
     }
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
 
     //Set the device id to derive temporal PSK
     SetUuidForPinBasedOxm(&(otmCtx->selectedDeviceInfo->doxm->deviceID));
 
-    OIC_LOG(INFO, TAG, "OUT LoadPreconfPinCodeCallback");
+    OIC_LOG(INFO, TAG, "OUT LoadPreconfigPinCodeCallback");
 
     return res;
 }
 
-OCStackResult CreateSecureSessionPreconfPinCallback(OTMContext_t* otmCtx)
+OCStackResult CreateSecureSessionPreconfigPinCallback(OTMContext_t* otmCtx)
 {
-    OIC_LOG(INFO, TAG, "IN CreateSecureSessionPreconfPinCallback");
+    OIC_LOG(INFO, TAG, "IN CreateSecureSessionPreconfigPinCallback");
 
     if (!otmCtx || !otmCtx->selectedDeviceInfo)
     {
@@ -185,13 +185,13 @@ OCStackResult CreateSecureSessionPreconfPinCallback(OTMContext_t* otmCtx)
     }
     OIC_LOG(INFO, TAG, "Anonymous cipher suite disabled.");
 
-    caresult  = CASelectCipherSuite(TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256, otmCtx->selectedDeviceInfo->endpoint.adapter);
+    caresult  = CASelectCipherSuite(MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256, otmCtx->selectedDeviceInfo->endpoint.adapter);
     if (CA_STATUS_OK != caresult)
     {
-        OIC_LOG_V(ERROR, TAG, "Failed to select TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256");
+        OIC_LOG_V(ERROR, TAG, "Failed to select TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256");
         return OC_STACK_ERROR;
     }
-    OIC_LOG(INFO, TAG, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256 cipher suite selected.");
+    OIC_LOG(INFO, TAG, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 cipher suite selected.");
 
     OCProvisionDev_t* selDevInfo = otmCtx->selectedDeviceInfo;
     CAEndpoint_t *endpoint = (CAEndpoint_t *)OICCalloc(1, sizeof (CAEndpoint_t));
@@ -209,7 +209,7 @@ OCStackResult CreateSecureSessionPreconfPinCallback(OTMContext_t* otmCtx)
         return OC_STACK_ERROR;
     }
 
-    OIC_LOG(INFO, TAG, "OUT CreateSecureSessionPreconfPinCallback");
+    OIC_LOG(INFO, TAG, "OUT CreateSecureSessionPreconfigPinCallback");
 
     return OC_STACK_OK;
 }