From: Oleksii Beketov Date: Thu, 4 Apr 2019 11:42:59 +0000 (+0300) Subject: Default OTM select CB X-Git-Tag: accepted/tizen/unified/20190429.103659~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F204733%2F1;p=platform%2Fupstream%2Fiotivity.git Default OTM select CB Default OTM select callback introduced https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/469 (cherry picked from 051a32dd63c54a309ff698d9143e9cb8a9733a3c Change-Id: I5f437da5c654d763c7c467e7ce11a39efbc67e19 Signed-off-by: Oleksii Beketov Signed-off-by: DoHyun Pyun --- 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. *