Add ifdef the code which utilizes TLS-supported APIs
authorHeewon Park <h_w.park@samsung.com>
Fri, 2 Sep 2016 05:33:37 +0000 (14:33 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 5 Sep 2016 09:45:57 +0000 (09:45 +0000)
provisionTrustCertChain API of Provisioning Manager is ONLY defined where TLS is supported. In easy setup, that API is used for transferring a certificate to Enrollee. So if TLS is not supported, this procedure SHOULD be skiped and not defined, even.

Change-Id: I2006d2025c794aab616cea8fb3e6144cace86b49
Signed-off-by: Heewon Park <h_w.park@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/11263
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.cpp
service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.h
service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp

index da65cb1..1c9703b 100755 (executable)
@@ -329,6 +329,13 @@ namespace OIC
             return false;
         }
 
+
+        std::string EnrolleeSecurity::getUUID() const
+        {
+            return m_ocResource->sid();
+        };
+
+#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
         void EnrolleeSecurity::provisionSecurityForCloudServer(
             std::string cloudUuid, int credId)
         {
@@ -461,11 +468,6 @@ namespace OIC
             return res;
         }
 
-        std::string EnrolleeSecurity::getUUID() const
-        {
-            return m_ocResource->sid();
-        };
-
         OicSecAcl_t* EnrolleeSecurity::createAcl(const OicUuid_t cloudUuid)
         {
             // allocate memory for |acl| struct
@@ -565,5 +567,6 @@ namespace OIC
             }
             m_cond.notify_all();
         }
+#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
     }
 }
index 8ab91ed..26b50f8 100644 (file)
@@ -57,8 +57,6 @@ namespace OIC
                 const SecurityPinCb securityPinCb,
                 const SecProvisioningDbPathCb secProvisioningDbPathCb);
             void provisionOwnership();
-            void provisionSecurityForCloudServer(
-                std::string cloudUuid, int credId);
             std::string getUUID() const;
 
         private:
@@ -73,13 +71,6 @@ namespace OIC
             std::atomic<bool>  aclResult;
             std::atomic<bool>  certResult;
 
-            ESResult performCertProvisioningForCloudServer(
-                std::shared_ptr< OC::OCSecureResource > ownedDevice,
-                int credId);
-            ESResult performACLProvisioningForCloudServer(
-                std::shared_ptr< OC::OCSecureResource > ownedDevice,
-                std::string& cloudUuid);
-
             std::shared_ptr< OC::OCSecureResource > m_securedResource;
             std::shared_ptr< OC::OCSecureResource > findEnrolleeSecurityResource(
                 OC::DeviceList_t &list);
@@ -90,10 +81,22 @@ namespace OIC
             void convertUUIDToString(const uint8_t uuid[UUID_SIZE],
                                                 std::string& uuidString);
             void convertStringToUUID(OicUuid_t& uuid, const std::string uuidString);
-            OicSecAcl_t* createAcl(const OicUuid_t cloudUuid);
 
+#if defined(__WITH_DTLS__) && defined(__WITH_TLS__)
+        public:
+            void provisionSecurityForCloudServer(
+                std::string cloudUuid, int credId);
+        private:
+            ESResult performCertProvisioningForCloudServer(
+                std::shared_ptr< OC::OCSecureResource > ownedDevice,
+                int credId);
+            ESResult performACLProvisioningForCloudServer(
+                std::shared_ptr< OC::OCSecureResource > ownedDevice,
+                std::string& cloudUuid);
+            OicSecAcl_t* createAcl(const OicUuid_t cloudUuid);
             void ACLProvisioningCb(PMResultList_t *result, int hasError);
             void CertProvisioningCb(PMResultList_t *result, int hasError);
+#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
         };
     }
 }
index 2bb1792..06ba6d7 100755 (executable)
@@ -437,7 +437,7 @@ namespace OIC
                 m_cloudPropProvStatusCb(provStatus);
                 return;
             }
-#endif
+#endif //defined(__WITH_DTLS__) && defined(__WITH_TLS__)
 
             if (m_cloudResource == nullptr)
             {