external/wakaama : minor patch to support TLS connection to artikcloud
authorJin-Seong Kim <jseong82.kim@samsung.com>
Tue, 2 May 2017 07:14:34 +0000 (16:14 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Sat, 6 May 2017 14:00:44 +0000 (23:00 +0900)
This commit is minor patch to support TLS connection to artikcloud
 - set cipher suite to all and auth_mode 0 (not verify)

Change-Id: I3f52693884d95ab831d9d2ae8a66e61eaf740d30
Signed-off-by: Jin-Seong Kim <jseong82.kim@samsung.com>
external/wakaama/examples/client/lwm2mclient.c
external/wakaama/examples/client/object_access_control.c

index e6fcd32..0f8f1f4 100644 (file)
@@ -966,8 +966,15 @@ int lwm2m_client_main(int argc, char *argv[])
     unsigned char psk[MBEDTLS_PSK_MAX_LEN];
 
     /* set default tls option */
-    tls_opt option = {MBEDTLS_SSL_IS_CLIENT, MBEDTLS_SSL_TRANSPORT_DATAGRAM, 2, 5, NULL, };
-    option.force_ciphersuites[0] = mbedtls_ssl_get_ciphersuite_id(LWM2M_CIPHERSUIT);
+
+    /*
+     * Note that, currently auth_mode is set to 0 (for connecting artikcloud)
+     * if you want to change auth_mode, please change 3rd parameter of tls_opt structure
+     * - auth_mode can be configured  among (2: always verify, 1: optional, 0: not verify)
+     */
+    tls_opt option = {MBEDTLS_SSL_IS_CLIENT, MBEDTLS_SSL_TRANSPORT_DATAGRAM, 0, 5, NULL, };
+    /* set cipher suite to all*/
+    option.force_ciphersuites[0] = 0;
     option.force_ciphersuites[1] = 0;
 #endif
 
@@ -1146,8 +1153,9 @@ int lwm2m_client_main(int argc, char *argv[])
             /* move pointer to address field */
             server += strlen(coap_uri_prefix[proto]);
         }
-        serverPort = coap_get_port_from_proto(proto);
-       }
+        if (!serverPortChanged)
+            serverPort = coap_get_port_from_proto(proto);
+    }
 
     /*
      * This call an internal function that create an IPV6 socket on the port 5683.
index 7edda7b..6781def 100644 (file)
@@ -189,7 +189,7 @@ static uint8_t prv_write_resources(uint16_t instanceId, int numData,
                lwm2m_data_t* tlvArray, lwm2m_object_t* objectP, bool doCreate)
 {
     int i;
-    uint8_t result;
+    uint8_t result = COAP_404_NOT_FOUND;
     int64_t value;
 
     acc_ctrl_oi_t* accCtrlOiP = (acc_ctrl_oi_t *)