From: Vitalii Irkha Date: Tue, 16 Jul 2019 10:00:53 +0000 (+0300) Subject: Fixed build issue with SECURED=0 option X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0aab55d2acf81a0ccd22dfeba8f25ee93e8e55a;p=platform%2Fupstream%2Fiotivity.git Fixed build issue with SECURED=0 option Moved common APIs from secure definition section https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/543/commits/4612b9818aa6b21a8dc1e07b1b1522d69b1206e0 (cherry-picked from 4612b9818aa6b21a8dc1e07b1b1522d69b1206e0) Change-Id: I47418a8488c774bb343a845d828f6a56999a20d7 Signed-off-by: Vitalii Irkha Signed-off-by: Sudipto Bal --- diff --git a/resource/csdk/security/src/srmutility.c b/resource/csdk/security/src/srmutility.c index 80b836f..1b8cd21 100644 --- a/resource/csdk/security/src/srmutility.c +++ b/resource/csdk/security/src/srmutility.c @@ -234,6 +234,48 @@ OCStackResult ConvertStrToUuid(const char* strUuid, OicUuid_t* uuid) return OC_STACK_OK; } +const OicUuid_t THE_NIL_UUID = {.id={0000000000000000}}; + +/** + * Compares two OicUuid_t structs. + * + * @return true if the two OicUuid_t structs are equal, else false. + */ +bool UuidCmp(const OicUuid_t *firstId, const OicUuid_t *secondId) +{ + bool ret = false; + VERIFY_NON_NULL(TAG, firstId, ERROR); + VERIFY_NON_NULL(TAG, secondId, ERROR); + + if (0 == memcmp(firstId, secondId, sizeof(OicUuid_t))) + { + ret = true; + } + +exit: + OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false"); + return ret; +} + +/** + * Compares OicUuid_t to Nil UUID {.id={0000000000000000}} + * + * @return true if the OicUuid_t is the Nil UUID. + */ +bool IsNilUuid(const OicUuid_t *uuid) +{ +#if !defined(NDEBUG) + char *strUuid = NULL; + ConvertUuidToStr(uuid, &strUuid); + if (strUuid) + { + OIC_LOG_V(DEBUG, TAG, "%s: uuid: %s.", __func__, strUuid); + OICFree(strUuid); + } +#endif + return UuidCmp(uuid, &THE_NIL_UUID); +} + #if defined(__WITH_DTLS__) || defined (__WITH_TLS__) OCStackResult SetDeviceIdSeed(const uint8_t* seed, size_t seedSize) { @@ -379,46 +421,4 @@ exit: OIC_LOG_V(DEBUG, TAG, "Out %s", __func__); } -const OicUuid_t THE_NIL_UUID = {.id={0000000000000000}}; - -/** - * Compares two OicUuid_t structs. - * - * @return true if the two OicUuid_t structs are equal, else false. - */ -bool UuidCmp(const OicUuid_t *firstId, const OicUuid_t *secondId) -{ - bool ret = false; - VERIFY_NON_NULL(TAG, firstId, ERROR); - VERIFY_NON_NULL(TAG, secondId, ERROR); - - if (0 == memcmp(firstId, secondId, sizeof(OicUuid_t))) - { - ret = true; - } - -exit: - OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false"); - return ret; -} - -/** - * Compares OicUuid_t to Nil UUID {.id={0000000000000000}} - * - * @return true if the OicUuid_t is the Nil UUID. - */ -bool IsNilUuid(const OicUuid_t *uuid) -{ -#if !defined(NDEBUG) - char *strUuid = NULL; - ConvertUuidToStr(uuid, &strUuid); - if (strUuid) - { - OIC_LOG_V(DEBUG, TAG, "%s: uuid: %s.", __func__, strUuid); - OICFree(strUuid); - } -#endif - return UuidCmp(uuid, &THE_NIL_UUID); -} - #endif