X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fsecurity%2Fprovisioning%2Fsrc%2Fownershiptransfermanager.c;h=781567bae7e9f4d429592da5cd95a36118bc8294;hb=dee64b10be2b0c9345e8974df26a39d6d5904e75;hp=a483e7a739599c5cbf2288808e4c448c649fef65;hpb=f7927683f240e25d586c6ef7d7f19b934fef640f;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/security/provisioning/src/ownershiptransfermanager.c b/resource/csdk/security/provisioning/src/ownershiptransfermanager.c index a483e7a..781567b 100644 --- a/resource/csdk/security/provisioning/src/ownershiptransfermanager.c +++ b/resource/csdk/security/provisioning/src/ownershiptransfermanager.c @@ -104,7 +104,8 @@ static uint8_t g_OxmAllowStatus[OXM_IDX_COUNT] = {ALLOWED_OXM, ALLOWED_OXM, ALLO NOT_ALLOWED_OXM}; #endif -static OTMSelectMethodCallback g_selectOTMCB = NULL; +static OicSecOxm_t selectOTMcb_default(const OicSecOxm_t* otmList, const uint32_t len); +static OTMSelectMethodCallback g_selectOTMCB = selectOTMcb_default; OCStackResult OTMSetOTCallback(OicSecOxm_t oxm, OTMCallbackData_t* callbacks) { @@ -224,6 +225,29 @@ static OxmAllowTableIdx_t GetOxmAllowTableIdx(OicSecOxm_t oxm) } } +OicSecOxm_t selectOTMcb_default(const OicSecOxm_t* otmList, const uint32_t len) +{ + OIC_LOG(INFO, TAG, "IN selectOTMcb_default"); + OicSecOxm_t ret = -1; + VERIFY_NON_NULL(TAG, otmList, ERROR); + VERIFY_SUCCESS(TAG, (len > 0), ERROR); + + ret = otmList[len-1]; + + for (size_t i = 0; i < len; i++) + { + if (OIC_RANDOM_DEVICE_PIN == otmList[i]) + { + ret = OIC_RANDOM_DEVICE_PIN; + break; + } + } + +exit: + OIC_LOG(INFO, TAG, "OUT selectOTMcb_default"); + return ret; +} + /** * Function to select appropriate provisioning method. *