QB_linux_SECURED build failed 99/218799/1
authorVitalii Irkha <v.irkha@samsung.com>
Fri, 22 Nov 2019 09:46:14 +0000 (11:46 +0200)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 28 Nov 2019 07:27:53 +0000 (16:27 +0900)
Fixed issues for SVR DB Validity APIs

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/commit/49420e214b01e2656b123c0bae3fad245bec14f9
(cherry-picked from 49420e214b01e2656b123c0bae3fad245bec14f9)

Change-Id: I6c1826f501230414a8c04596ede23ff01a1651d9
Signed-off-by: Vitalii Irkha <v.irkha@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
resource/csdk/security/include/internal/psinterface.h
resource/csdk/security/include/srmutility.h
resource/csdk/security/src/psinterface.c

index 6848bfe..0d7b179 100644 (file)
@@ -171,7 +171,7 @@ OCStackResult setSecurePSI(const unsigned char *key, const OCPersistentStorage *
  *
  * @return pointer on resetSVRDB structure for manipulating with callback
  */
-resetSVRDBCB_t* const GetResetSVRDBCB(void);
+resetSVRDBCB_t*  GetResetSVRDBCB(void);
 
 /**
  * API to validate data in SVR DB.
index 22936b7..a48d322 100644 (file)
@@ -199,4 +199,31 @@ bool IsNilUuid(const OicUuid_t *uuid);
 }
 #endif // __cplusplus
 
+/**
+ * cbor default init
+ */
+#ifndef OC_DEFAULT_CBOR_VALUE
+#   if (__STDC_VERSION__ >= 199901L)
+#       define OC_DEFAULT_CBOR_VALUE {.parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0}
+#   else
+#       define OC_DEFAULT_CBOR_VALUE {NULL, NULL, 0, 0, 0, 0}
+#   endif
+#endif
+
+#ifndef OC_DEFAULT_CBOR_PARSER
+#   if (__STDC_VERSION__ >= 199901L)
+#       define OC_DEFAULT_CBOR_PARSER {.end = NULL, .flags = 0}
+#   else
+#       define OC_DEFAULT_CBOR_PARSER {NULL, 0}
+#   endif
+#endif
+
+#ifndef OC_DEFAULT_OICUUID
+#   if (__STDC_VERSION__ >= 199901L)
+#   define OC_DEFAULT_OICUUID {.id= { 0 } }
+#   else
+#   define OC_DEFAULT_OICUUID {{ 0 }}
+#   endif
+#endif
+
 #endif //IOTVT_SRM_UTILITY_H
index 3514920..0964232 100644 (file)
@@ -66,7 +66,7 @@ static SVRDBValidStatus_t g_svrdbValidStatus = SVRDB_NOT_CHECKED;
 
 static resetSVRDBCB_t g_resetSVRDBCB = {0};
 
-resetSVRDBCB_t* const GetResetSVRDBCB(void)
+resetSVRDBCB_t*  GetResetSVRDBCB(void)
 {
     return &g_resetSVRDBCB;
 }
@@ -1260,7 +1260,16 @@ OCStackResult CheckSVRDBValidity(void)
     OIC_LOG_V(DEBUG, TAG, "In %s", __func__);
 
     OCStackResult res = OC_STACK_ERROR;
-    OicUuid_t emptyUuid = {.id={0}};
+    OicUuid_t emptyUuid = OC_DEFAULT_OICUUID;
+    OicUuid_t devOwnerUuid = OC_DEFAULT_OICUUID;
+    OicUuid_t devRownerUuid = OC_DEFAULT_OICUUID;
+    OicUuid_t resRowneruuid = OC_DEFAULT_OICUUID;
+    bool isDevOwnerUuidEmpty = false;
+    bool isDevRownerUuidEmpty = false;
+    bool isPstatRownerUuidEmpty = false;
+    bool isAclRownerUuidEmpty = false;
+    bool isCredRownerUuidEmpty = false;
+    OicSecDpm_t cm = NORMAL;
 
     bool isOwned = false;
     res = GetDoxmIsOwned(&isOwned);
@@ -1271,16 +1280,7 @@ OCStackResult CheckSVRDBValidity(void)
         goto exit;
     }
 
-    OicUuid_t devOwnerUuid = {.id={0}};
-    OicUuid_t devRownerUuid = {.id={0}};
-    OicUuid_t resRowneruuid = {.id={0}};
-    bool isDevOwnerUuidEmpty = false;
-    bool isDevRownerUuidEmpty = false;
-    bool isPstatRownerUuidEmpty = false;
-    bool isAclRownerUuidEmpty = false;
-    bool isCredRownerUuidEmpty = false;
-
-    if(OC_STACK_OK != GetDoxmDevOwnerId(&devOwnerUuid) |
+    if(OC_STACK_OK != GetDoxmDevOwnerId(&devOwnerUuid) ||
         OC_STACK_OK != GetDoxmRownerId(&devRownerUuid))
     {
         res = OC_STACK_ERROR;
@@ -1320,7 +1320,6 @@ OCStackResult CheckSVRDBValidity(void)
         isPstatRownerUuidEmpty = false;
     }
 
-    OicSecDpm_t cm = NORMAL;
     VERIFY_SUCCESS(TAG, OC_STACK_OK == GetPstatCm(&cm), ERROR);
 
     if (OC_STACK_OK != GetAclRownerId(&resRowneruuid))
@@ -1490,10 +1489,10 @@ bool isResetPFExist(void)
     {
         ocRes = OC_STACK_ERROR;
         {
-            CborParser parser;
-            CborValue cbor;
+            CborParser parser = OC_DEFAULT_CBOR_PARSER;
+            CborValue cbor = OC_DEFAULT_CBOR_VALUE;
             cbor_parser_init(dbData, dbSize, 0, &parser, &cbor);
-            CborValue curVal = {0};
+            CborValue curVal = OC_DEFAULT_CBOR_VALUE;
             CborError cborFindResult = CborNoError;
 
             cborFindResult = cbor_value_map_find_value(&cbor, OIC_JSON_RESET_PF_NAME, &curVal);