From 6248f9a0299968484337fb3c66da28857fa3984e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 29 Jun 2016 23:30:15 +0200 Subject: [PATCH] iotivity: update to version 1.1.0 This brings IoTivoity to version 1.1.0 The old @lantiq.com address does not work any more, update to the @intel.com address. The removed patches were merged upstream, but there are still some new ones needed. Signed-off-by: Hauke Mehrtens --- net/iotivity/Makefile | 11 +- net/iotivity/patches/001-no_unit_test.patch | 117 ++++++++++++- .../patches/002-do-not-chck-for-boost.patch | 2 +- net/iotivity/patches/004-use-env.patch | 2 +- net/iotivity/patches/010-big-endian.patch | 26 --- .../patches/011-musl-use-inttypes.patch | 31 ---- ...y-fix-getnameinfo-call-for-musl-libc.patch | 161 ------------------ ...-not-set-architecture-specific-flags.patch | 6 +- .../patches/030-remove-check-for-curl.patch | 4 +- .../patches/040-remove-provisioning.patch | 24 +++ ...capsulation-deactivate-test-covergae.patch | 38 +++++ ...ding-of-permission-attribute-from-co.patch | 39 +++++ ...endianness-dependency-for-credential.patch | 87 ++++++++++ ...ption-when-reading-inetgers-from-cbo.patch | 93 ++++++++++ ...ainer-Backported-init-fix-to-1.1-rel.patch | 36 ++++ net/iotivity/patches/140-remove-glib2.patch | 16 +- 16 files changed, 454 insertions(+), 239 deletions(-) delete mode 100644 net/iotivity/patches/010-big-endian.patch delete mode 100644 net/iotivity/patches/011-musl-use-inttypes.patch delete mode 100644 net/iotivity/patches/012-connectivity-fix-getnameinfo-call-for-musl-libc.patch create mode 100644 net/iotivity/patches/040-remove-provisioning.patch create mode 100644 net/iotivity/patches/054-resource-encapsulation-deactivate-test-covergae.patch create mode 100644 net/iotivity/patches/060-security-fix-reading-of-permission-attribute-from-co.patch create mode 100644 net/iotivity/patches/061-Remove-the-endianness-dependency-for-credential.patch create mode 100644 net/iotivity/patches/062-Fix-memory-corruption-when-reading-inetgers-from-cbo.patch create mode 100644 net/iotivity/patches/070-Resource-container-Backported-init-fix-to-1.1-rel.patch diff --git a/net/iotivity/Makefile b/net/iotivity/Makefile index dffd596b0..4af197d79 100644 --- a/net/iotivity/Makefile +++ b/net/iotivity/Makefile @@ -8,16 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iotivity -PKG_VERSION:=1.0.0 +PKG_VERSION:=1.1.0 PKG_RELEASE=1 PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz -PKG_SOURCE_URL:=https://downloads.iotivity.org/${PKG_VERSION}/ \ - http://mirrors.kernel.org/${PKG_NAME}/${PKG_VERSION}/ -PKG_MD5SUM:=4bcbabffc1734c664bbdf8fedfa60543 +PKG_SOURCE_URL:=http://mirrors.kernel.org/${PKG_NAME}/${PKG_VERSION}/ +PKG_MD5SUM:=98f8d5b0304c357520c4343d983491e2 PKG_USE_MIPS16:=0 -PKG_MAINTAINER:=Hauke Mehrtens +PKG_MAINTAINER:=Hauke Mehrtens PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE.md @@ -174,7 +173,7 @@ SCONS_OPTIONS += \ $(if $(CONFIG_PACKAGE_iotivity),liboctbstack) \ $(if $(CONFIG_PACKAGE_iotivity-cpp),liboc) \ $(if $(CONFIG_PACKAGE_iotivity-things-manager-lib),libTGMSDK) \ - $(if $(CONFIG_PACKAGE_iotivity-oic-middle),samples) \ + $(if $(CONFIG_PACKAGE_iotivity-oic-middle),examples) \ $(if $(CONFIG_PACKAGE_iotivity-things-manager),ConServerApp ConClientApp BootstrapServerApp) \ $(if $(CONFIG_PACKAGE_iotivity-resource-container-lib),libResContainer) \ $(if $(CONFIG_PACKAGE_iotivity-resource-container-sample),containersample) \ diff --git a/net/iotivity/patches/001-no_unit_test.patch b/net/iotivity/patches/001-no_unit_test.patch index 981abf6fd..7e9a39543 100644 --- a/net/iotivity/patches/001-no_unit_test.patch +++ b/net/iotivity/patches/001-no_unit_test.patch @@ -1,6 +1,6 @@ --- a/resource/SConscript +++ b/resource/SConscript -@@ -71,7 +71,7 @@ if target_os == 'linux': +@@ -75,7 +75,7 @@ if target_os == 'linux': SConscript('csdk/stack/samples/linux/secure/SConscript') # Build C/C++ unit tests @@ -9,6 +9,14 @@ elif target_os == 'darwin': env.Command('../../out/darwin/iotivity-csdk.framework',None,src_dir + '/tools/darwin/mkfwk_osx.sh') +--- a/resource/csdk/security/provisioning/ck_manager/SConscript ++++ b/resource/csdk/security/provisioning/ck_manager/SConscript +@@ -47,4 +47,4 @@ x509_env.AppendUnique(LIBS = ['Base64']) + x509_env.AppendUnique(LIBS = ['Json']) + + SConscript('sample/SConscript') +-SConscript('unittest/SConscript') ++# SConscript('unittest/SConscript') --- a/service/resource-encapsulation/SConscript +++ b/service/resource-encapsulation/SConscript @@ -113,10 +113,10 @@ SConscript('examples/SConscript') @@ -29,7 +37,7 @@ \ No newline at end of file --- a/service/things-manager/SConscript +++ b/service/things-manager/SConscript -@@ -71,6 +71,6 @@ SConscript('sampleapp/SConscript') +@@ -75,6 +75,6 @@ SConscript('sampleapp/SConscript') ###################################################################### # Build UnitTests Things Manager ################################################ ###################### @@ -38,3 +46,108 @@ +# if target_os == 'linux': +# SConscript('unittests/SConscript') +--- a/service/resource-hosting/SConscript ++++ b/service/resource-hosting/SConscript +@@ -94,8 +94,8 @@ resourcehosting_env.UserInstallTargetHea + 'service/resource-hosting', 'Hosting.h') + + # Go to build Unit test +-if target_os == 'linux': +- SConscript('unittest/SConscript') ++# if target_os == 'linux': ++# SConscript('unittest/SConscript') + + # Go to build sample apps + SConscript('SampleApp/SConscript') +--- a/service/easy-setup/mediator/csdk/SConscript ++++ b/service/easy-setup/mediator/csdk/SConscript +@@ -124,8 +124,8 @@ if target_os == 'linux': + ###################################################################### + #Build UnitTestcases for Mediator[CSDK] + ################################################ ###################### +-if target_os == 'linux': +- SConscript('unittests/SConscript') ++# if target_os == 'linux': ++# SConscript('unittests/SConscript') + + + +--- a/service/easy-setup/mediator/richsdk/SConscript ++++ b/service/easy-setup/mediator/richsdk/SConscript +@@ -138,6 +138,6 @@ if target_os == 'linux': + ###################################################################### + #Build UnitTestcases for Mediator[RichSDK] + ################################################ ###################### +-if target_os == 'linux': +- SConscript('unittests/SConscript') ++# if target_os == 'linux': ++# SConscript('unittests/SConscript') + +--- a/service/resource-container/SConscript ++++ b/service/resource-container/SConscript +@@ -209,8 +209,8 @@ lib_env = conf2.Finish() + ###################################################################### + # build resource container unit tests + ###################################################################### +-if target_os == 'linux': +- SConscript('unittests/SConscript') ++# if target_os == 'linux': ++# SConscript('unittests/SConscript') + + ###################################################################### + # Build Container Sample +--- a/plugins/SConscript ++++ b/plugins/SConscript +@@ -35,7 +35,7 @@ if target_os not in ['android', 'arduino + + SConscript(os.path.join('src', 'SConscript')) + +- SConscript(os.path.join('unittests', 'SConscript')) ++# SConscript(os.path.join('unittests', 'SConscript')) + + if build_sample == 'ON': + if target_os in ['linux']: +--- a/service/scene-manager/SConscript ++++ b/service/scene-manager/SConscript +@@ -101,8 +101,8 @@ scenemanager_env.UserInstallTargetHeader + scenemanager_env.UserInstallTargetHeader('include/RemoteSceneAction.h', 'service/scene-manager', 'RemoteSceneAction.h') + + # Go to build Unit test +-if target_os == 'linux': +- SConscript('unittests/SConscript') ++# if target_os == 'linux': ++# SConscript('unittests/SConscript') + + # Go to build sample apps +-SConscript('sampleapp/SConscript') ++# SConscript('sampleapp/SConscript') +--- a/service/resource-encapsulation/src/common/SConscript ++++ b/service/resource-encapsulation/src/common/SConscript +@@ -122,9 +122,9 @@ if target_os == 'linux': + 'expiryTimer/unittests/ExpiryTimerTest.cpp' + ] + +- rcs_common_test = rcs_common_test_env.Program('rcs_common_test', rcs_common_test_src) +- Alias("rcs_common_test", rcs_common_test) +- env.AppendTarget('rcs_common_test') ++# rcs_common_test = rcs_common_test_env.Program('rcs_common_test', rcs_common_test_src) ++# Alias("rcs_common_test", rcs_common_test) ++# env.AppendTarget('rcs_common_test') + + if env.get('TEST') == '1': + from tools.scons.RunTest import * +--- a/service/resource-encapsulation/src/serverBuilder/SConscript ++++ b/service/resource-encapsulation/src/serverBuilder/SConscript +@@ -110,9 +110,9 @@ if target_os == 'linux': + + server_builder_test_src = env.Glob('unittests/*.cpp') + +- server_builder_test = server_builder_test_env.Program('rcs_server_test', server_builder_test_src) +- Alias("rcs_server_test", server_builder_test) +- env.AppendTarget('rcs_server_test') ++# server_builder_test = server_builder_test_env.Program('rcs_server_test', server_builder_test_src) ++# Alias("rcs_server_test", server_builder_test) ++# env.AppendTarget('rcs_server_test') + + if env.get('TEST') == '1': + from tools.scons.RunTest import * diff --git a/net/iotivity/patches/002-do-not-chck-for-boost.patch b/net/iotivity/patches/002-do-not-chck-for-boost.patch index 21109fd43..6be8f8401 100644 --- a/net/iotivity/patches/002-do-not-chck-for-boost.patch +++ b/net/iotivity/patches/002-do-not-chck-for-boost.patch @@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens --- a/service/third_party_libs.scons +++ b/service/third_party_libs.scons -@@ -49,14 +49,6 @@ if target_os in ['linux', 'tizen']: +@@ -49,14 +49,6 @@ if target_os in ['linux']: conf = Configure(lib_env) diff --git a/net/iotivity/patches/004-use-env.patch b/net/iotivity/patches/004-use-env.patch index abae06d53..7e1df81d6 100644 --- a/net/iotivity/patches/004-use-env.patch +++ b/net/iotivity/patches/004-use-env.patch @@ -9,7 +9,7 @@ Subject: [PATCH 3/4] 004-use-env.patch --- a/build_common/SConscript +++ b/build_common/SConscript -@@ -137,6 +137,26 @@ tc_set_msg = ''' +@@ -151,6 +151,26 @@ tc_set_msg = ''' * cause inexplicable errors. * ******************************************************************************* ''' diff --git a/net/iotivity/patches/010-big-endian.patch b/net/iotivity/patches/010-big-endian.patch deleted file mode 100644 index 899bb34ab..000000000 --- a/net/iotivity/patches/010-big-endian.patch +++ /dev/null @@ -1,26 +0,0 @@ -From d647872aee4871e286ddedf4931792086f5b4565 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Mon, 26 Oct 2015 14:32:39 +0100 -Subject: [PATCH] libcoap: remove fix build error on big endian systems - -In the big endian case an additional typedef is added in a wrong -position in TinyDTLS. This breaks compiling this code on big endian -systems. - -Change-Id: Iad854aba112ddb23bf490b064ec6fbf5d01ce6b6 -Signed-off-by: Hauke Mehrtens ---- - resource/csdk/connectivity/lib/libcoap-4.1.1/pdu.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/resource/csdk/connectivity/lib/libcoap-4.1.1/pdu.h -+++ b/resource/csdk/connectivity/lib/libcoap-4.1.1/pdu.h -@@ -194,7 +194,7 @@ typedef enum - #ifdef WORDS_BIGENDIAN - typedef union - { -- typedef struct -+ struct - { - unsigned int version:2; /* protocol version */ - unsigned int type:2; /* type flag */ diff --git a/net/iotivity/patches/011-musl-use-inttypes.patch b/net/iotivity/patches/011-musl-use-inttypes.patch deleted file mode 100644 index bd74f37aa..000000000 --- a/net/iotivity/patches/011-musl-use-inttypes.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 9510445c5002b0e3502d2ac09723e1b2ddd03704 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Mon, 26 Oct 2015 14:39:55 +0100 -Subject: [PATCH] tinydtls: use types from inittype.h, fix musl libc - -The SHA2 code currently uses u_int32_t and similar types without -defining them. This type is not defined by the POSIX standard, but many -libc implementations have it as a non standard extension. In the musl -libc it is not implemented and I am getting a compile error when using -u_int32_t, I should use uint32_t, which is done when -SHA2_USE_INTTYPES_H is set. - -This fixes build with musl libs used in OpenWrt. - -Change-Id: I485435ddb8b1a2359caedd335ab54f91ca5e3f3e -Signed-off-by: Hauke Mehrtens ---- - extlibs/tinydtls/SConscript | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/extlibs/tinydtls/SConscript -+++ b/extlibs/tinydtls/SConscript -@@ -68,7 +68,7 @@ if not env.get('RELEASE'): - else: - env.AppendUnique(CPPDEFINES = ['NDEBUG']) - --env.AppendUnique(CPPDEFINES = ['DTLSV12', 'WITH_SHA256', 'DTLS_CHECK_CONTENTTYPE']) -+env.AppendUnique(CPPDEFINES = ['DTLSV12', 'WITH_SHA256', 'DTLS_CHECK_CONTENTTYPE', 'SHA2_USE_INTTYPES_H']) - - - libtinydtls = env.StaticLibrary('libtinydtls', env.get('TINYDTLS_SRC'), OBJPREFIX='libtinydtls_') diff --git a/net/iotivity/patches/012-connectivity-fix-getnameinfo-call-for-musl-libc.patch b/net/iotivity/patches/012-connectivity-fix-getnameinfo-call-for-musl-libc.patch deleted file mode 100644 index 99f9b786e..000000000 --- a/net/iotivity/patches/012-connectivity-fix-getnameinfo-call-for-musl-libc.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 75a19e9059e671442abe40908ba80c2da614118d Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Mon, 26 Oct 2015 22:42:40 +0100 -Subject: [PATCH] connectivity: fix getnameinfo() call for musl libc - -The musl libc and also the libc from net/freebsd are currently checking -if the size of the sockaddr given to getnameinfo() matches the size for -this family and it fails when giving sizeof(struct sockaddr_storage). -This patch fixes this problem by making the caller also provide the -size of the struct sockaddr_storage. - -I am currently trying to get a fix for this problem into musl libc, but -IoTivity should still fix this. - -This also fixes a wrong error message. - -Change-Id: Ie9b89523b5ba20e536c03e3ad85c65bd5ff2ba53 -Signed-off-by: Hauke Mehrtens ---- - resource/csdk/connectivity/inc/caadapterutils.h | 12 ++++++++---- - .../csdk/connectivity/src/adapter_util/caadapternetdtls.c | 10 +++++----- - resource/csdk/connectivity/src/adapter_util/caadapterutils.c | 9 +++++---- - resource/csdk/connectivity/src/ip_adapter/caipserver.c | 2 +- - resource/csdk/connectivity/src/tcp_adapter/catcpserver.c | 2 +- - 5 files changed, 20 insertions(+), 15 deletions(-) - ---- a/resource/csdk/connectivity/inc/caadapterutils.h -+++ b/resource/csdk/connectivity/inc/caadapterutils.h -@@ -212,13 +212,16 @@ void CAClearNetInterfaceInfoList(u_array - */ - void CAClearServerInfoList(u_arraylist_t *serverInfoList); - -+#ifndef WITH_ARDUINO - /** - * Convert address from binary to string. -- * @param[in] ipaddr IP address info. -- * @param[out] host address string (must be CA_IPADDR_SIZE). -- * @param[out] port host order port number. -+ * @param[in] sockAddr IP address info. -+ * @param[in] sockAddrLen size of sockAddr. -+ * @param[out] host address string (must be CA_IPADDR_SIZE). -+ * @param[out] port host order port number. - */ --void CAConvertAddrToName(const struct sockaddr_storage *sockaddr, char *host, uint16_t *port); -+void CAConvertAddrToName(const struct sockaddr_storage *sockAddr, socklen_t sockAddrLen, -+ char *host, uint16_t *port); - - /** - * Convert address from string to binary. -@@ -227,6 +230,7 @@ void CAConvertAddrToName(const struct so - * @param[out] ipaddr IP address info. - */ - void CAConvertNameToAddr(const char *host, uint16_t port, struct sockaddr_storage *sockaddr); -+#endif /* WITH_ARDUINO */ - - #ifdef __ANDROID__ - /** ---- a/resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c -+++ b/resource/csdk/connectivity/src/adapter_util/caadapternetdtls.c -@@ -417,7 +417,7 @@ static int32_t CAReadDecryptedPayload(dt - ((addrInfo->addr.st.ss_family == AF_INET) ? CA_IPV4 : CA_IPV6) | CA_SECURE, .port = 0 }, - .identity = - { 0 } }; -- CAConvertAddrToName(&(addrInfo->addr.st), sep.endpoint.addr, &sep.endpoint.port); -+ CAConvertAddrToName(&(addrInfo->addr.st), addrInfo->size, sep.endpoint.addr, &sep.endpoint.port); - - if (NULL == g_caDtlsContext) - { -@@ -468,7 +468,7 @@ static int32_t CASendSecureData(dtls_con - - CAEndpoint_t endpoint = {.adapter = CA_DEFAULT_ADAPTER}; - -- CAConvertAddrToName(&(addrInfo->addr.st), endpoint.addr, &endpoint.port); -+ CAConvertAddrToName(&(addrInfo->addr.st), addrInfo->size, endpoint.addr, &endpoint.port); - endpoint.flags = addrInfo->addr.st.ss_family == AF_INET ? CA_IPV4 : CA_IPV6; - endpoint.flags |= CA_SECURE; - endpoint.adapter = CA_ADAPTER_IP; -@@ -515,7 +515,7 @@ static int32_t CAHandleSecureEvent(dtls_ - stCADtlsAddrInfo_t *addrInfo = (stCADtlsAddrInfo_t *)session; - char peerAddr[MAX_ADDR_STR_SIZE_CA] = { 0 }; - uint16_t port = 0; -- CAConvertAddrToName(&(addrInfo->addr.st), peerAddr, &port); -+ CAConvertAddrToName(&(addrInfo->addr.st), addrInfo->size, peerAddr, &port); - CARemovePeerFromPeerInfoList(peerAddr, port); - } - -@@ -553,7 +553,7 @@ static int32_t CAGetPskCredentials(dtls_ - stCADtlsAddrInfo_t *addrInfo = (stCADtlsAddrInfo_t *)session; - char peerAddr[MAX_ADDR_STR_SIZE_CA] = { 0 }; - uint16_t port = 0; -- CAConvertAddrToName(&(addrInfo->addr.st), peerAddr, &port); -+ CAConvertAddrToName(&(addrInfo->addr.st), addrInfo->size, peerAddr, &port); - - if(CA_STATUS_OK != CAAddIdToPeerInfoList(peerAddr, port, desc, descLen) ) - { -@@ -933,7 +933,7 @@ static int CAVerifyCertificate(struct dt - stCADtlsAddrInfo_t *addrInfo = (stCADtlsAddrInfo_t *)session; - char peerAddr[MAX_ADDR_STR_SIZE_CA] = { 0 }; - uint16_t port = 0; -- CAConvertAddrToName(&(addrInfo->addr.st), peerAddr, &port); -+ CAConvertAddrToName(&(addrInfo->addr.st), addrInfo->size, peerAddr, &port); - - CAResult_t result = CAAddIdToPeerInfoList(peerAddr, port, - crtChain[0].subject.data + DER_SUBJECT_HEADER_LEN + 2, crtChain[0].subject.data[DER_SUBJECT_HEADER_LEN + 1]); ---- a/resource/csdk/connectivity/src/adapter_util/caadapterutils.c -+++ b/resource/csdk/connectivity/src/adapter_util/caadapterutils.c -@@ -122,14 +122,15 @@ CAResult_t CAParseIPv4AddressInternal(co - * These two conversion functions return void because errors can't happen - * (because of NI_NUMERIC), and there's nothing to do if they do happen. - */ --void CAConvertAddrToName(const struct sockaddr_storage *sockAddr, char *host, uint16_t *port) -+void CAConvertAddrToName(const struct sockaddr_storage *sockAddr, socklen_t sockAddrLen, -+ char *host, uint16_t *port) - { - VERIFY_NON_NULL_VOID(sockAddr, CA_ADAPTER_UTILS_TAG, "sockAddr is null"); - VERIFY_NON_NULL_VOID(host, CA_ADAPTER_UTILS_TAG, "host is null"); - VERIFY_NON_NULL_VOID(port, CA_ADAPTER_UTILS_TAG, "port is null"); - - int r = getnameinfo((struct sockaddr *)sockAddr, -- sizeof (struct sockaddr_storage), -+ sockAddrLen, - host, MAX_ADDR_STR_SIZE_CA, - NULL, 0, - NI_NUMERICHOST|NI_NUMERICSERV); -@@ -138,12 +139,12 @@ void CAConvertAddrToName(const struct so - if (EAI_SYSTEM == r) - { - OIC_LOG_V(ERROR, CA_ADAPTER_UTILS_TAG, -- "getaddrinfo failed: errno %s", strerror(errno)); -+ "getnameinfo failed: errno %s", strerror(errno)); - } - else - { - OIC_LOG_V(ERROR, CA_ADAPTER_UTILS_TAG, -- "getaddrinfo failed: %s", gai_strerror(r)); -+ "getnameinfo failed: %s", gai_strerror(r)); - } - return; - } ---- a/resource/csdk/connectivity/src/ip_adapter/caipserver.c -+++ b/resource/csdk/connectivity/src/ip_adapter/caipserver.c -@@ -299,7 +299,7 @@ static CAResult_t CAReceiveMessage(int f - } - } - -- CAConvertAddrToName(&srcAddr, sep.endpoint.addr, &sep.endpoint.port); -+ CAConvertAddrToName(&srcAddr, msg.msg_namelen, sep.endpoint.addr, &sep.endpoint.port); - - if (flags & CA_SECURE) - { ---- a/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c -+++ b/resource/csdk/connectivity/src/tcp_adapter/catcpserver.c -@@ -478,7 +478,7 @@ static void CAAcceptHandler(void *data) - } - svritem->u4tcp.fd = sockfd; - -- CAConvertAddrToName((struct sockaddr_storage *)&clientaddr, -+ CAConvertAddrToName((struct sockaddr_storage *)&clientaddr, clientlen, - (char *) &svritem->addr, &svritem->u4tcp.port); - - ca_mutex_lock(g_mutexObjectList); diff --git a/net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch b/net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch index 4c12064f3..b49cb5213 100644 --- a/net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch +++ b/net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch @@ -16,7 +16,7 @@ Signed-off-by: Hauke Mehrtens +++ b/build_common/linux/SConscript @@ -24,20 +24,3 @@ env.AppendUnique(LINKFLAGS = ['-ldl', '- - # Set arch flags + # Set arch flags that match best TARGET_ARCH variable target_arch = env.get('TARGET_ARCH') -if target_arch in ['x86']: - env.AppendUnique(CCFLAGS = ['-m32']) @@ -24,6 +24,8 @@ Signed-off-by: Hauke Mehrtens -elif target_arch in ['x86_64']: - env.AppendUnique(CCFLAGS = ['-m64']) - env.AppendUnique(LINKFLAGS = ['-m64']) +-elif target_arch in ['arm'] or target_arch.find('v5') > 0: +- env.AppendUnique(CPPFLAGS = ['-march=armv5te']) -elif target_arch.find('v7a-hard') > 0: - env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) - env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard']) @@ -33,8 +35,6 @@ Signed-off-by: Hauke Mehrtens - env.AppendUnique(CPPFLAGS = ['-march=armv7-a']) -elif target_arch.find('arm64') >= 0: - env.AppendUnique(CPPFLAGS = ['-march=armv8-a']) --else: -- env.AppendUnique(CPPFLAGS = ['-march=armv5te']) --- a/resource/csdk/connectivity/build/linux/SConscript +++ b/resource/csdk/connectivity/build/linux/SConscript @@ -22,20 +22,3 @@ env.AppendUnique(LINKFLAGS = ['-ldl', '- diff --git a/net/iotivity/patches/030-remove-check-for-curl.patch b/net/iotivity/patches/030-remove-check-for-curl.patch index a7191aa8f..fd3fe53c7 100644 --- a/net/iotivity/patches/030-remove-check-for-curl.patch +++ b/net/iotivity/patches/030-remove-check-for-curl.patch @@ -1,6 +1,6 @@ --- a/service/resource-container/SConscript +++ b/service/resource-container/SConscript -@@ -176,35 +176,21 @@ if target_os in ['linux', 'tizen', 'andr +@@ -175,36 +175,22 @@ if target_os in ['linux', 'tizen', 'andr # build hue sample bundle ###################################################################### @@ -32,6 +32,7 @@ - - HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle', hue_resource_bundle_src) - hue_resource_bundle_env.InstallTarget(HueBundle, 'libHueBundle') +- hue_resource_bundle_env.UserInstallTargetLib(HueBundle, 'libHueBundle') -lib_env = conf2.Finish() +hue_resource_bundle_env = resource_container_env.Clone() +hue_resource_bundle_env.AppendUnique(CCFLAGS = ['-fPIC']) @@ -48,6 +49,7 @@ + +HueBundle = hue_resource_bundle_env.SharedLibrary('HueBundle', hue_resource_bundle_src) +hue_resource_bundle_env.InstallTarget(HueBundle, 'libHueBundle') ++hue_resource_bundle_env.UserInstallTargetLib(HueBundle, 'libHueBundle') ###################################################################### # build resource container unit tests diff --git a/net/iotivity/patches/040-remove-provisioning.patch b/net/iotivity/patches/040-remove-provisioning.patch new file mode 100644 index 000000000..4696cab2b --- /dev/null +++ b/net/iotivity/patches/040-remove-provisioning.patch @@ -0,0 +1,24 @@ +From 4488170af944163b62051b2afee60386a9973c72 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Thu, 31 Mar 2016 10:23:48 +0200 +Subject: [PATCH] remove building of provisioning service + +The provisioning service is not used in this build and depends on boost_thread +which would add an additional unused dependency. + +Change-Id: Ic7edab3ae96d77339ea0f48fc76ab2534c49b6ba +Signed-off-by: Hauke Mehrtens +--- + resource/src/SConscript | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/resource/src/SConscript ++++ b/resource/src/SConscript +@@ -116,5 +116,5 @@ oclib_env.UserInstallTargetHeader(header + oclib_env.UserInstallTargetHeader(header_dir + 'CAManager.h', 'resource', 'CAManager.h') + + # Add Provisioning library +-if target_os in ['linux', 'android', 'tizen'] and env.get('SECURED') == '1': +- SConscript('../provisioning/SConscript') ++# if target_os in ['linux', 'android', 'tizen'] and env.get('SECURED') == '1': ++# SConscript('../provisioning/SConscript') diff --git a/net/iotivity/patches/054-resource-encapsulation-deactivate-test-covergae.patch b/net/iotivity/patches/054-resource-encapsulation-deactivate-test-covergae.patch new file mode 100644 index 000000000..d30f8f25f --- /dev/null +++ b/net/iotivity/patches/054-resource-encapsulation-deactivate-test-covergae.patch @@ -0,0 +1,38 @@ +From 8a1a5562904c1bbdb2bcb332c0a74482d7cdea15 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Wed, 11 Nov 2015 18:10:03 +0100 +Subject: [PATCH 5/5] resource-encapsulation: deactivate test covergae + +Change-Id: I9c9b5853ee1521f5963c73c3025b1c0f10393a96 +Signed-off-by: Hauke Mehrtens +--- + .../resource-encapsulation/src/common/SConscript | 4 ---- + .../src/serverBuilder/SConscript | 4 ---- + 2 files changed, 8 deletions(-) + +--- a/service/resource-encapsulation/src/common/SConscript ++++ b/service/resource-encapsulation/src/common/SConscript +@@ -66,10 +66,6 @@ if target_os == 'android': + + rcs_common_env.AppendUnique(LIBS = ['dl', 'oc']) + +-if not release: +- rcs_common_env.AppendUnique(CXXFLAGS = ['--coverage']) +- rcs_common_env.PrependUnique(LIBS = ['gcov']) +- + ###################################################################### + # Source files and Targets + ###################################################################### +--- a/service/resource-encapsulation/src/serverBuilder/SConscript ++++ b/service/resource-encapsulation/src/serverBuilder/SConscript +@@ -67,10 +67,6 @@ server_builder_env.AppendUnique(LIBS = [ + if env.get('LOGGING'): + server_builder_env.AppendUnique(LIBS = ['octbstack']) + +-if not release: +- server_builder_env.AppendUnique(CXXFLAGS = ['--coverage']) +- server_builder_env.PrependUnique(LIBS = ['gcov']) +- + ###################################################################### + # Source files and Targets + ###################################################################### diff --git a/net/iotivity/patches/060-security-fix-reading-of-permission-attribute-from-co.patch b/net/iotivity/patches/060-security-fix-reading-of-permission-attribute-from-co.patch new file mode 100644 index 000000000..a70a801d1 --- /dev/null +++ b/net/iotivity/patches/060-security-fix-reading-of-permission-attribute-from-co.patch @@ -0,0 +1,39 @@ +From b1c29c35cba3eb39af18fb8db0ec676e3d658b1d Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Fri, 17 Jun 2016 17:38:35 +0200 +Subject: [PATCH] security: fix reading of permission attribute from + configuration + +Casting the pointer to the permission attribute from uint16_t to uint64_t +causes problems on MIPS Big Endian systems and probably othrs as well. +When the calling method interprets it as uint64_t not the value is +converted but the pointer is interpreted as it would point to a 64 bit +integer, but it is only a 16 bit wide integer. On MIPS BE permission was +always 0 independent of which value between 0 and 32 the permission +attribute had, this was probably written to some padding area or into +some other member of the struct. + +This patch fixes the memory corruption and makes the code work for me with +a MIPS BE CPU. + +Change-Id: Ifa843e69980ad4309b1e3076b8e2c98c03324352 +Signed-off-by: Hauke Mehrtens +--- + resource/csdk/security/src/aclresource.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/resource/csdk/security/src/aclresource.c ++++ b/resource/csdk/security/src/aclresource.c +@@ -602,8 +602,11 @@ OicSecAcl_t* CBORPayloadToAcl(const uint + // Permissions -- Mandatory + if (strcmp(name, OIC_JSON_PERMISSION_NAME) == 0) + { +- cborFindResult = cbor_value_get_uint64(&aclMap, (uint64_t *) &acl->permission); ++ uint64_t tmp64; ++ ++ cborFindResult = cbor_value_get_uint64(&aclMap, &tmp64); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a PERM Value."); ++ acl->permission = tmp64; + } + + // Period -- Not mandatory diff --git a/net/iotivity/patches/061-Remove-the-endianness-dependency-for-credential.patch b/net/iotivity/patches/061-Remove-the-endianness-dependency-for-credential.patch new file mode 100644 index 000000000..df4cbb5ce --- /dev/null +++ b/net/iotivity/patches/061-Remove-the-endianness-dependency-for-credential.patch @@ -0,0 +1,87 @@ +From f182119e571a1b520b4e5ef4ee5e5b5cd243b931 Mon Sep 17 00:00:00 2001 +From: Chul Lee +Date: Wed, 22 Jun 2016 12:40:21 +0900 +Subject: [PATCH] Remove the endianness dependency in cbor conversion. + +A similar bug reported from https://gerrit.iotivity.org/gerrit/#/c/8755/ + +Change-Id: I631bab77f7486f1f45eaff96c67d39606e37c6b6 +Signed-off-by: Chul Lee +Reviewed-on: https://gerrit.iotivity.org/gerrit/8829 +Tested-by: jenkins-iotivity +Reviewed-by: Hauke Mehrtens +Reviewed-by: Randeep Singh +(cherry picked from commit 24474a8d2555229efb425b6cb63e19b3279ba810) +Reviewed-on: https://gerrit.iotivity.org/gerrit/9053 +--- + resource/csdk/security/src/credresource.c | 8 ++++++-- + resource/csdk/security/src/pconfresource.c | 5 +++-- + resource/csdk/stack/src/ocpayloadparse.c | 8 ++++++-- + 3 files changed, 15 insertions(+), 6 deletions(-) + +--- a/resource/csdk/security/src/credresource.c ++++ b/resource/csdk/security/src/credresource.c +@@ -435,8 +435,10 @@ OCStackResult CBORPayloadToCred(const ui + //credid + if (strcmp(name, OIC_JSON_CREDID_NAME) == 0) + { +- cborFindResult = cbor_value_get_uint64(&credMap, (uint64_t *) &cred->credId); ++ uint64_t credId = 0; ++ cborFindResult = cbor_value_get_uint64(&credMap, &credId); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CredId."); ++ cred->credId = (uint16_t)credId; + } + // subjectid + if (strcmp(name, OIC_JSON_SUBJECTID_NAME) == 0) +@@ -451,8 +453,10 @@ OCStackResult CBORPayloadToCred(const ui + // credtype + if (strcmp(name, OIC_JSON_CREDTYPE_NAME) == 0) + { +- cborFindResult = cbor_value_get_uint64(&credMap, (uint64_t *) &cred->credType); ++ uint64_t credType = 0; ++ cborFindResult = cbor_value_get_uint64(&credMap, &credType); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding CredType."); ++ cred->credType = (OicSecCredType_t)credType; + } + // privatedata + if (strcmp(name, OIC_JSON_PRIVATEDATA_NAME) == 0) +--- a/resource/csdk/security/src/pconfresource.c ++++ b/resource/csdk/security/src/pconfresource.c +@@ -642,8 +642,9 @@ OCStackResult CBORPayloadToPconf(const u + // Permissions -- Mandatory + if (strcmp(name, OIC_JSON_PERMISSION_NAME) == 0) + { +- cborFindResult = cbor_value_get_uint64(&pdAclMap, +- (uint64_t *) &pdacl->permission); ++ uint64_t permission = 0; ++ cborFindResult = cbor_value_get_uint64(&pdAclMap, &permission); ++ pdacl->permission = (uint16_t)permission; + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to get value"); + } + +--- a/resource/csdk/stack/src/ocpayloadparse.c ++++ b/resource/csdk/stack/src/ocpayloadparse.c +@@ -1169,17 +1169,21 @@ static OCStackResult OCParsePresencePayl + if (cbor_value_is_map(rootValue)) + { + CborValue curVal; ++ uint64_t temp = 0; + + // Sequence Number + CborError err = cbor_value_map_find_value(rootValue, OC_RSRVD_NONCE, &curVal); + VERIFY_CBOR_SUCCESS(TAG, err, "Failed finding nonce tag"); +- err = cbor_value_get_uint64(&curVal, (uint64_t *)&payload->sequenceNumber); ++ err = cbor_value_get_uint64(&curVal, &temp); ++ payload->sequenceNumber = (uint32_t)temp; + VERIFY_CBOR_SUCCESS(TAG, err, "Failed finding nonce value"); + + // Max Age + err = cbor_value_map_find_value(rootValue, OC_RSRVD_TTL, &curVal); + VERIFY_CBOR_SUCCESS(TAG, err, "Failed finding ttl tag"); +- err = cbor_value_get_uint64(&curVal, (uint64_t *)&payload->maxAge); ++ temp = 0; ++ err = cbor_value_get_uint64(&curVal, &temp); ++ payload->maxAge = (uint32_t)temp; + VERIFY_CBOR_SUCCESS(TAG, err, "Failed finding ttl value"); + + // Trigger diff --git a/net/iotivity/patches/062-Fix-memory-corruption-when-reading-inetgers-from-cbo.patch b/net/iotivity/patches/062-Fix-memory-corruption-when-reading-inetgers-from-cbo.patch new file mode 100644 index 000000000..5ef749278 --- /dev/null +++ b/net/iotivity/patches/062-Fix-memory-corruption-when-reading-inetgers-from-cbo.patch @@ -0,0 +1,93 @@ +From 7c99ef8bfa024f11452311c36329eeeeece4fd74 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Wed, 22 Jun 2016 11:41:43 +0200 +Subject: [PATCH] Fix memory corruption when reading inetgers from cbor + +When the cbor_value_get_*() function is called with a pointer to some int, it +should have the correct size. When we cast it to something else it is treated +as a pointer to an uint64_t in the function for example and them 64 bits gets +written to memory even with the real type is only 32 bit long. When the real +type is only 32 bit long some other memory gets overwritten. On Big endian +systems the least significant bits are cut of so in most cases 0 is read. + +With this patch a value cast is used and the value is converted to the other size. + +This is the same as in commit 0d64c7c95a5c11a9fb5201e729fd8c75da210c80 +"security: fix reading of permission attribute from configuration" + +Change-Id: If5965491241e25ebf60a22dc45d37d74a33cb02f +Signed-off-by: Hauke Mehrtens +--- + resource/csdk/security/src/pconfresource.c | 5 ++++- + resource/csdk/stack/src/ocpayloadparse.c | 19 +++++++++++++++---- + 2 files changed, 19 insertions(+), 5 deletions(-) + +--- a/resource/csdk/security/src/pconfresource.c ++++ b/resource/csdk/security/src/pconfresource.c +@@ -507,8 +507,11 @@ OCStackResult CBORPayloadToPconf(const u + + while (cbor_value_is_valid(&prm)) + { +- cborFindResult = cbor_value_get_int(&prm, (int *)&pconf->prm[i++]); ++ int prm_val; ++ ++ cborFindResult = cbor_value_get_int(&prm, &prm_val); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to get value"); ++ pconf->prm[i++] = (OicSecPrm_t)prm_val; + cborFindResult = cbor_value_advance(&prm); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed to advance value"); + } +--- a/resource/csdk/stack/src/ocpayloadparse.c ++++ b/resource/csdk/stack/src/ocpayloadparse.c +@@ -287,6 +287,8 @@ static OCStackResult OCParseDiscoveryPay + + while (cbor_value_is_map(&resourceMap)) + { ++ int bitmap; ++ + resource = (OCResourcePayload *)OICCalloc(1, sizeof(OCResourcePayload)); + VERIFY_PARAM_NON_NULL(TAG, resource, "Failed allocating resource payload"); + +@@ -319,8 +321,9 @@ static OCStackResult OCParseDiscoveryPay + // Bitmap + err = cbor_value_map_find_value(&policyMap, OC_RSRVD_BITMAP, &curVal); + VERIFY_CBOR_SUCCESS(TAG, err, "to find bitmap tag"); +- err = cbor_value_get_int(&curVal, (int *)&resource->bitmap); ++ err = cbor_value_get_int(&curVal, &bitmap); + VERIFY_CBOR_SUCCESS(TAG, err, "to find bitmap value"); ++ resource->bitmap = (uint8_t)bitmap; + + // Secure Flag + err = cbor_value_map_find_value(&policyMap, OC_RSRVD_SECURE, &curVal); +@@ -336,8 +339,11 @@ static OCStackResult OCParseDiscoveryPay + VERIFY_CBOR_SUCCESS(TAG, err, "to find port tag"); + if (cbor_value_is_valid(&curVal)) + { +- err = cbor_value_get_int(&curVal, (int *)&resource->port); ++ int port; ++ ++ err = cbor_value_get_int(&curVal, &port); + VERIFY_CBOR_SUCCESS(TAG, err, "to find port value"); ++ resource->port = (uint16_t)port; + } + + err = cbor_value_advance(&resourceMap); +@@ -1170,6 +1176,7 @@ static OCStackResult OCParsePresencePayl + { + CborValue curVal; + uint64_t temp = 0; ++ uint8_t trigger; + + // Sequence Number + CborError err = cbor_value_map_find_value(rootValue, OC_RSRVD_NONCE, &curVal); +@@ -1189,8 +1196,9 @@ static OCStackResult OCParsePresencePayl + // Trigger + err = cbor_value_map_find_value(rootValue, OC_RSRVD_TRIGGER, &curVal); + VERIFY_CBOR_SUCCESS(TAG, err, "Failed finding trigger tag"); +- err = cbor_value_get_simple_type(&curVal, (uint8_t *)&payload->trigger); ++ err = cbor_value_get_simple_type(&curVal, &trigger); + VERIFY_CBOR_SUCCESS(TAG, err, "Failed finding trigger value"); ++ payload->trigger = (OCPresenceTrigger)trigger; + + // Resource type name + err = cbor_value_map_find_value(rootValue, OC_RSRVD_RESOURCE_TYPE, &curVal); diff --git a/net/iotivity/patches/070-Resource-container-Backported-init-fix-to-1.1-rel.patch b/net/iotivity/patches/070-Resource-container-Backported-init-fix-to-1.1-rel.patch new file mode 100644 index 000000000..c0c0fac89 --- /dev/null +++ b/net/iotivity/patches/070-Resource-container-Backported-init-fix-to-1.1-rel.patch @@ -0,0 +1,36 @@ +From e093390b2839f6039a6ff94ed4942fa45c53a418 Mon Sep 17 00:00:00 2001 +From: Philippe Coval +Date: Tue, 26 Apr 2016 15:28:17 +0200 +Subject: [PATCH] [Resource-container] Backported init fix to 1.1-rel + +[Resource-container] Fix member var initialization + +Incorrect type was used causing build error. + +Origin: 6a10062f1fe64ca75ac6d34541bbd295ef052dcb +Author: Inga Stotland +Change-Id: I701096c3b6512546847cf4e120430f690e920453 +Signed-off-by: Inga Stotland +Reviewed-on: https://gerrit.iotivity.org/gerrit/7759 +Tested-by: jenkins-iotivity +Reviewed-by: George Nash +Reviewed-by: Markus Jung +Reviewed-by: Uze Choi +Signed-off-by: Philippe Coval +Reviewed-on: https://gerrit.iotivity.org/gerrit/7929 +--- + service/resource-container/src/BundleInfoInternal.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/service/resource-container/src/BundleInfoInternal.cpp ++++ b/service/resource-container/src/BundleInfoInternal.cpp +@@ -32,8 +32,8 @@ namespace OIC + m_resourceCreator = nullptr; + m_resourceDestroyer = nullptr; + m_bundleHandle = nullptr; +- m_so_bundle = nullptr; + ++ m_so_bundle = false; + m_loaded = false; + m_activated = false; + m_java_bundle = false; diff --git a/net/iotivity/patches/140-remove-glib2.patch b/net/iotivity/patches/140-remove-glib2.patch index 36bb82c8a..3a73ef72f 100644 --- a/net/iotivity/patches/140-remove-glib2.patch +++ b/net/iotivity/patches/140-remove-glib2.patch @@ -1,6 +1,6 @@ --- a/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript +++ b/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript -@@ -31,7 +31,7 @@ this_build_dir = os.path.join(root_build +@@ -73,7 +73,7 @@ env.AppendUnique( # The Linux BLE adapter implementation uses GDBus to make D-Bus based # method calls to BlueZ. Pull in the necessary dependencies. @@ -22,12 +22,14 @@ --- a/resource/csdk/security/provisioning/SConscript +++ b/resource/csdk/security/provisioning/SConscript -@@ -73,7 +73,7 @@ provisioning_env.AppendUnique(LIBS = ['t +@@ -76,8 +76,8 @@ provisioning_env.AppendUnique(LIBS = ['t if env.get('DTLS_WITH_X509') == '1': - provisioning_env.AppendUnique(LIBS = ['CKManger']) + provisioning_env.AppendUnique(LIBS = ['CKManager', 'asn1']) --provisioning_env.ParseConfig('pkg-config --libs glib-2.0'); -+# provisioning_env.ParseConfig('pkg-config --libs glib-2.0'); +-if target_os != 'android': +- provisioning_env.ParseConfig('pkg-config --libs glib-2.0') ++# if target_os != 'android': ++# provisioning_env.ParseConfig('pkg-config --libs glib-2.0') - if target_os == 'android': - provisioning_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions']) + if target_os == 'tizen': + provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')