Browse Source

Merge pull request #3800 from hauke/iotivity

iotivity: update to version 1.2.1
lilik-openwrt-22.03
Hauke Mehrtens 8 years ago
committed by GitHub
parent
commit
564b13846b
29 changed files with 1216 additions and 726 deletions
  1. +64
    -68
      net/iotivity/Makefile
  2. BIN
      net/iotivity/files/etc/iotivity/oic_svr_db.cbor
  3. +24
    -61
      net/iotivity/files/etc/iotivity/oic_svr_db.json
  4. +115
    -127
      net/iotivity/patches/001-no_unit_test.patch
  5. +0
    -38
      net/iotivity/patches/004-use-env.patch
  6. +0
    -60
      net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch
  7. +44
    -0
      net/iotivity/patches/020-linux-Add-more-architectures.patch
  8. +0
    -35
      net/iotivity/patches/021-add-some-more-architectures.patch
  9. +39
    -0
      net/iotivity/patches/021-build-do-not-set-TARGET_ARCH-to-default.patch
  10. +57
    -0
      net/iotivity/patches/022-build-restrict-compiler-options-to-supported-archite.patch
  11. +126
    -0
      net/iotivity/patches/023-build-take-compiler-options-from-environment.patch
  12. +2
    -2
      net/iotivity/patches/030-remove-check-for-curl.patch
  13. +27
    -0
      net/iotivity/patches/040-linux-Use-system-sqlite3.patch
  14. +0
    -24
      net/iotivity/patches/040-remove-provisioning.patch
  15. +54
    -0
      net/iotivity/patches/050-csdk-move-OCEntityHandlerResponse-from-stack-to-heap.patch
  16. +357
    -0
      net/iotivity/patches/051-csdk-move-OCClientResponse-from-stack-to-heap.patch
  17. +103
    -0
      net/iotivity/patches/053-src-move-OCClientResponse-from-stack-to-heap.patch
  18. +0
    -38
      net/iotivity/patches/054-resource-encapsulation-deactivate-test-covergae.patch
  19. +0
    -39
      net/iotivity/patches/060-security-fix-reading-of-permission-attribute-from-co.patch
  20. +0
    -87
      net/iotivity/patches/061-Remove-the-endianness-dependency-for-credential.patch
  21. +0
    -93
      net/iotivity/patches/062-Fix-memory-corruption-when-reading-inetgers-from-cbo.patch
  22. +0
    -36
      net/iotivity/patches/070-Resource-container-Backported-init-fix-to-1.1-rel.patch
  23. +27
    -0
      net/iotivity/patches/070-ssl-fix-compilation-against-non-debug-mbedtls.patch
  24. +35
    -0
      net/iotivity/patches/071-ssl-call-mbedtls_version_get_string-only-if-availabl.patch
  25. +30
    -0
      net/iotivity/patches/072-ssl-call-mbedtls_ssl_conf_renegotiation-only-if-avai.patch
  26. +44
    -0
      net/iotivity/patches/075-ssl-enable-usage-of-patched-mbed-functions-condition.patch
  27. +22
    -0
      net/iotivity/patches/078-use-system-mbedtls.patch
  28. +31
    -0
      net/iotivity/patches/080-zigbee_wrapper-do-not-check-for-floating-point.patch
  29. +15
    -18
      net/iotivity/patches/140-remove-glib2.patch

+ 64
- 68
net/iotivity/Makefile View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=iotivity
PKG_VERSION:=1.1.0
PKG_VERSION:=1.2.1
PKG_RELEASE=1
PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz
PKG_SOURCE_URL:=http://mirrors.kernel.org/${PKG_NAME}/${PKG_VERSION}/
PKG_MD5SUM:=98f8d5b0304c357520c4343d983491e2
PKG_MD5SUM:=7dcd9f0f48263c6b27a2c3d085dd7278b5c0feed1dfec8872a04899707fa23d8
PKG_USE_MIPS16:=0
PKG_BUILD_DEPENDS:=boost
@ -26,13 +26,13 @@ PKG_LICENSE_FILES:=LICENSE.md
PKG_CONFIG_DEPENDS := \
CONFIG_PACKAGE_iotivity \
CONFIG_PACKAGE_iotivity-cpp \
CONFIG_PACKAGE_iotivity-things-manager-lib \
CONFIG_PACKAGE_iotivity-resource-directory-lib \
CONFIG_PACKAGE_iotivity-oic-middle \
CONFIG_PACKAGE_iotivity-things-manager \
CONFIG_PACKAGE_iotivity-resource-container-lib \
CONFIG_PACKAGE_iotivity-resource-container-sample \
CONFIG_PACKAGE_iotivity-resource-container-hue \
CONFIG_PACKAGE_iotivity-example-garage \
CONFIG_PACKAGE_iotivity-example-simple \
CONFIG_PACKAGE_iotivity_DEBUG \
CONFIG_PACKAGE_iotivity_SECURE
@ -43,7 +43,7 @@ include $(INCLUDE_DIR)/scons.mk
define Package/iotivity
SECTION:=net
CATEGORY:=Network
DEPENDS:=@!USE_UCLIBC +libpthread +librt +libuuid
DEPENDS:=@!USE_UCLIBC +libpthread +librt +libuuid +libsqlite3 +PACKAGE_iotivity_SECURE:libmbedtls
TITLE:=IoTivity C Library
URL:=https://www.iotivity.org
MENU:=1
@ -63,10 +63,15 @@ define Package/iotivity/config
config PACKAGE_iotivity_SECURE
bool "IoTivity with security support"
default y
help
Activate security support.
config PACKAGE_iotivity_LOGGING
bool "IoTivity with logging support"
default y
help
Activate logging support.
This will make IoTivity write a lot of log messages to stdout.
endif
endef
@ -84,24 +89,19 @@ define Package/iotivity-cpp/description
Open Interconnect Consortium Specification.
endef
define Package/iotivity-things-manager-lib
define Package/iotivity-resource-directory-lib
SECTION:=net
CATEGORY:=Network
DEPENDS:=+iotivity +iotivity-cpp +libstdcpp
TITLE:=IoTivity things manager lib
DEPENDS:=+iotivity +iotivity-cpp
TITLE:=IoTivity Resource Directory library
URL:=https://www.iotivity.org
endef
define Package/iotivity-things-manager-lib/description
IoTivity things-manager lib
endef
define Package/iotivity-oic-middle
SECTION:=net
CATEGORY:=Network
DEPENDS:=+iotivity +iotivity-cpp
DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
TITLE:=IoTivity OIC Middle
URL:=https://www.iotivity.org
endef
@ -110,19 +110,6 @@ define Package/iotivity-oic-middle/description
IoTivity OIC Middle
endef
define Package/iotivity-things-manager
SECTION:=net
CATEGORY:=Network
DEPENDS:=+iotivity +iotivity-cpp +iotivity-things-manager-lib
TITLE:=IoTivity things manager
URL:=https://www.iotivity.org
endef
define Package/iotivity-things-manager/description
IoTivity things manager
endef
define Package/iotivity-resource-container-lib
SECTION:=net
CATEGORY:=Network
@ -150,7 +137,7 @@ endef
define Package/iotivity-example-garage
SECTION:=net
CATEGORY:=Network
DEPENDS:=+iotivity +iotivity-cpp
DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
TITLE:=IoTivity Garage example
URL:=https://www.iotivity.org
endef
@ -159,57 +146,53 @@ define Package/iotivity-example-garage/description
An IoTivity example application
endef
define Package/iotivity-example-simple
SECTION:=net
CATEGORY:=Network
DEPENDS:=+iotivity +iotivity-cpp +iotivity-resource-directory-lib
TITLE:=IoTivity simple client + server
URL:=https://www.iotivity.org
endef
define Package/iotivity-example-simple/description
The IoTivity simple client and simple server exmaple
endef
PKG_TINYCBOR_NAME:=tinycbor
PKG_TINYCBOR_VERSION:=43e3ac9490cf19459ec7b7bd13df3b66810fb62a
PKG_TINYCBOR_SOURCE:=$(PKG_TINYCBOR_NAME)-$(PKG_TINYCBOR_VERSION).tar.bz2
PKG_TINYCBOR_PROTO:=git
PKG_TINYCBOR_VERSION:=0.4
PKG_TINYCBOR_SOURCE_VERSION:=a088996aa5f59b4f27f20fadad053d88bee357d4
PKG_TINYCBOR_SOURCE:=$(PKG_TINYCBOR_NAME)-$(PKG_TINYCBOR_VERSION).tar.bz2
PKG_TINYCBOR_SOURCE_URL:=https://github.com/01org/tinycbor.git
PKG_TINYCBOR_SUBDIR:=$(PKG_TINYCBOR_NAME)
#PKG_TINYCBOR_MIRROR_MD5SUM:=?
define Download/iotivity-tinycbor
FILE:=$(PKG_TINYCBOR_SOURCE)
URL:=$(PKG_TINYCBOR_SOURCE_URL)
PROTO:=$(PKG_TINYCBOR_PROTO)
VERSION:=$(PKG_TINYCBOR_VERSION)
VERSION:=$(PKG_TINYCBOR_SOURCE_VERSION)
SUBDIR:=$(PKG_TINYCBOR_SUBDIR)
#MIRROR_MD5SUM:=$(PKG_TINYCBOR_MIRROR_MD5SUM)
endef
$(eval $(call Download,iotivity-tinycbor))
PKG_SQLITE_NAME:=sqlite
PKG_SQLITE_VERSION:=3081101
PKG_SQLITE_SOURCE:=$(PKG_SQLITE_NAME)-amalgamation-$(PKG_SQLITE_VERSION).zip
PKG_SQLITE_SOURCE_URL:=http://www.sqlite.org/2015/
PKG_SQLITE_SUBDIR:=$(PKG_SQLITE_NAME)
PKG_SQLITE_MD5SUM:=94907e831502e2080b76e281cfa24dde
define Download/iotivity-sqlite
FILE:=$(PKG_SQLITE_SOURCE)
URL:=$(PKG_SQLITE_SOURCE_URL)
VERSION:=$(PKG_SQLITE_VERSION)
SUBDIR:=$(PKG_SQLITE_SUBDIR)
MD5SUM:=$(PKG_SQLITE_MD5SUM)
endef
$(eval $(call Download,iotivity-sqlite))
EXTRA_CXXFLAGS += -std=gnu++11
SCONS_OPTIONS += \
TARGET_OS=linux \
TARGET_TRANSPORT=IP \
TARGET_ARCH=$(ARCH) \
STAGING_DIR=$(STAGING_DIR) \
LOGGING=true \
$(if $(CONFIG_PACKAGE_iotivity),liboctbstack) \
$(if $(CONFIG_PACKAGE_iotivity-cpp),liboc) \
$(if $(CONFIG_PACKAGE_iotivity-things-manager-lib),libTGMSDK) \
WITH_ENV=true \
octbstack oc \
$(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) \
$(if $(CONFIG_PACKAGE_iotivity-resource-container-hue),libHueBundle) \
$(if $(CONFIG_PACKAGE_iotivity-example-garage),examples) \
$(if $(CONFIG_PACKAGE_iotivity-example-simple),examples) \
install
ifeq ($(CONFIG_PACKAGE_iotivity_DEBUG),y)
SCONS_OPTIONS += RELEASE=false
@ -225,6 +208,10 @@ else
SCONS_OPTIONS += SECURED=0
endif
ifeq ($(CONFIG_PACKAGE_iotivity_LOGGING),y)
SCONS_OPTIONS += LOGGING=true
endif
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
SCONS_OPTIONS += VERBOSE=true
endif
@ -232,9 +219,6 @@ endif
define Build/Prepare
$(call Build/Prepare/Default)
$(TAR) -C $(PKG_BUILD_DIR)/extlibs/tinycbor/ -xjf $(DL_DIR)/$(PKG_TINYCBOR_SOURCE)
unzip -d $(PKG_BUILD_DIR)/extlibs/sqlite3/ $(DL_DIR)/$(PKG_SQLITE_SOURCE)
mv $(PKG_BUILD_DIR)/extlibs/sqlite3/$(PKG_SQLITE_NAME)-amalgamation-$(PKG_SQLITE_VERSION)/sqlite3.h $(PKG_BUILD_DIR)/extlibs/sqlite3/
mv $(PKG_BUILD_DIR)/extlibs/sqlite3/$(PKG_SQLITE_NAME)-amalgamation-$(PKG_SQLITE_VERSION)/sqlite3.c $(PKG_BUILD_DIR)/extlibs/sqlite3/
endef
@ -249,6 +233,7 @@ endef
define Package/iotivity/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
ifeq ($(CONFIG_PACKAGE_iotivity_SECURE),y)
$(INSTALL_DIR) $(1)/etc/iotivity/
@ -262,9 +247,9 @@ define Package/iotivity-cpp/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
endef
define Package/iotivity-things-manager-lib/install
define Package/iotivity-resource-directory-lib/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libTGMSDKLibrary.so $(1)/usr/lib/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
endef
define Package/iotivity-oic-middle/install
@ -272,13 +257,6 @@ define Package/iotivity-oic-middle/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/examples/OICMiddle/OICMiddle $(1)/usr/bin/
endef
define Package/iotivity-things-manager/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/things-manager/sampleapp/linux/configuration/bootstrapserver $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/things-manager/sampleapp/linux/configuration/con-server $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/service/things-manager/sampleapp/linux/configuration/con-client $(1)/usr/bin/
endef
define Package/iotivity-resource-container-lib/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/librcs_common.so $(1)/usr/lib/
@ -303,13 +281,31 @@ define Package/iotivity-example-garage/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/garageserver $(1)/usr/bin/
endef
define Package/iotivity-example-simple/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleclient $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/resource/examples/simpleserver $(1)/usr/bin/
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/include $(1)/usr/include/iotivity
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libconnectivity_abstraction.so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboctbstack.so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc.so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/liboc_logger.so $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/$(APP_OPTIM)/libresource_directory.so $(1)/usr/lib/
endef
$(eval $(call BuildPackage,iotivity))
$(eval $(call BuildPackage,iotivity-cpp))
$(eval $(call BuildPackage,iotivity-things-manager-lib))
$(eval $(call BuildPackage,iotivity-resource-directory-lib))
$(eval $(call BuildPackage,iotivity-oic-middle))
$(eval $(call BuildPackage,iotivity-things-manager))
$(eval $(call BuildPackage,iotivity-resource-container-lib))
$(eval $(call BuildPackage,iotivity-resource-container-sample))
$(eval $(call BuildPackage,iotivity-resource-container-hue))
$(eval $(call BuildPackage,iotivity-example-garage))
$(eval $(call BuildPackage,iotivity-example-simple))

BIN
net/iotivity/files/etc/iotivity/oic_svr_db.cbor View File


+ 24
- 61
net/iotivity/files/etc/iotivity/oic_svr_db.json View File

@ -8,83 +8,47 @@
{
"href": "/oic/res",
"rel": "",
"rt": "",
"if": ""
"rt": ["oic.wk.res"],
"if": ["oic.if.ll"]
},
{
"href": "/oic/d",
"rel": "",
"rt": "",
"if": ""
"rt": ["oic.wk.d"],
"if": ["oic.if.baseline", "oic.if.r"]
},
{
"href": "/oic/p",
"rel": "",
"rt": "",
"if": ""
},
{
"href": "/oic/res/d",
"rel": "",
"rt": "",
"if": ""
},
{
"href": "/oic/res/types/d",
"rel": "",
"rt": "",
"if": ""
},
{
"href": "/oic/ad",
"rel": "",
"rt": "",
"if": ""
"rt": ["oic.wk.p"],
"if": ["oic.if.baseline", "oic.if.r"]
},
{
"href": "/oic/sec/acl",
"rel": "",
"rt": "",
"if": ""
},
{
"href": "/oic/sec/amacl",
"rel": "",
"rt": "",
"if": ""
},
{
"href": "/oic/sec/doxm",
"rel": "",
"rt": "",
"if": ""
},
{
"href": "/oic/sec/pstat",
"rel": "",
"rt": "",
"if": ""
"rt": ["oic.r.acl"],
"if": ["oic.if.baseline"]
}
],
"permission": 2
},
{
"subjectuuid": "32323232-3232-3232-3232-323232323232",
"subjectuuid": "*",
"resources": [
{
"href": "/oic/sec/acl",
"href": "/oic/sec/doxm",
"rel": "",
"rt": "",
"if": ""
} ,
"rt": ["oic.r.doxm"],
"if": ["oic.if.baseline"]
},
{
"href": "/oic/sec/cred",
"href": "/oic/sec/pstat",
"rel": "",
"rt": "",
"if": ""
"rt": ["oic.r.pstat"],
"if": ["oic.if.baseline"]
}
],
"permission": 31
"permission": 2
},
{
"subjectuuid": "*",
@ -92,11 +56,11 @@
{
"href": "*",
"rel": "",
"rt": "",
"if": ""
"rt": ["oic.core"],
"if": ["oic.if.baseline"]
}
],
"permission": 6
"permission": 7
}
]
},
@ -108,8 +72,8 @@
"rowneruuid": "31313131-3131-3131-3131-313131313131",
"cm": 0,
"tm": 0,
"om": 3,
"sm": 3
"om": 4,
"sm": 4
},
"doxm": {
"oxms": [0],
@ -118,8 +82,7 @@
"owned": true,
"deviceuuid": "31313131-3131-3131-3131-313131313131",
"devowneruuid": "32323232-3232-3232-3232-323232323232",
"rowneruuid": "31313131-3131-3131-3131-313131313131",
"dpc": false
"rowneruuid": "31313131-3131-3131-3131-313131313131"
},
"cred": {
"creds": [
@ -133,6 +96,6 @@
}
}
],
"rowneruuid": "32323232-3232-3232-3232-323232323232"
"rowneruuid": "31313131-3131-3131-3131-313131313131"
}
}

+ 115
- 127
net/iotivity/patches/001-no_unit_test.patch View File

@ -1,7 +1,18 @@
--- 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/resource/SConscript
+++ b/resource/SConscript
@@ -75,7 +75,7 @@ if target_os == 'linux':
SConscript('csdk/stack/samples/linux/secure/SConscript')
@@ -78,7 +78,7 @@ if target_os in ['linux', 'windows']:
SConscript('csdk/stack/samples/linux/secure/SConscript')
# Build C/C++ unit tests
- SConscript('unit_tests.scons')
@ -9,145 +20,122 @@
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')
# Build UnitTests Resource Client , resourceCache and resourceBroker and
# DiscoveryManager
################################################ ######################
-if target_os == 'linux':
- SConscript('unittests/SConscript')
- SConscript('src/resourceCache/unittests/SConscript')
- SConscript('src/resourceBroker/unittest/SConscript')
+# if target_os == 'linux':
+# SConscript('unittests/SConscript')
+# SConscript('src/resourceCache/unittests/SConscript')
+# SConscript('src/resourceBroker/unittest/SConscript')
if target_os == 'android':
SConscript('android/SConscript')
\ No newline at end of file
--- a/service/things-manager/SConscript
+++ b/service/things-manager/SConscript
@@ -75,6 +75,6 @@ SConscript('sampleapp/SConscript')
######################################################################
# Build UnitTests Things Manager
################################################ ######################
-if target_os == 'linux':
--- a/resource/csdk/resource-directory/SConscript
+++ b/resource/csdk/resource-directory/SConscript
@@ -114,8 +114,3 @@ if 'SERVER' in rd_mode:
if target_os in ['linux']:
SConscript('samples/SConscript')
-######################################################################
-# Build UnitTests of the Resource Directory
-################################################ ######################
-if target_os in ['linux']:
- SConscript('unittests/SConscript')
+# 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':
--- a/service/coap-http-proxy/SConscript
+++ b/service/coap-http-proxy/SConscript
@@ -84,6 +84,3 @@ local_env.UserInstallTargetHeader('inclu
######################################################################
#Build UnitTestcases for Mediator[CSDK]
################################################ ######################
-if target_os == 'linux':
if target_os in ['linux', 'tizen']:
SConscript('samples/SConscript')
-
-if target_os in ['linux']:
- SConscript('unittests/SConscript')
+# if target_os == 'linux':
+# SConscript('unittests/SConscript')
--- a/service/easy-setup/enrollee/SConscript
+++ b/service/easy-setup/enrollee/SConscript
@@ -123,7 +123,3 @@ if target_os == 'arduino':
if target_os in ['linux']:
SConscript('../sampleapp/enrollee/linux/SConscript')
- #Build UnitTestcases for Enrollee
- if enrollee_env.get('SECURED') == '0':
- SConscript('../enrollee/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')
@@ -163,11 +163,3 @@ if target_os in ['linux']:
if target_os in ['android']:
SConscript('../../sampleapp/mediator/android/SConscript')
-
-######################################################################
-#Build UnitTestcases for Mediator[RichSDK]
-################################################ ######################
-if env.get('SECURED') == '0':
- 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')
@@ -223,12 +223,6 @@ else:
lib_env = conf2.Finish()
######################################################################
-# build resource container unit tests
-######################################################################
-if target_os in ['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')
######################################################################
if target_os not in ['ios']:
--- a/service/resource-encapsulation/SConscript
+++ b/service/resource-encapsulation/SConscript
@@ -121,14 +121,5 @@ resourceClient_env.UserInstallTargetHead
######################################################################
SConscript('examples/SConscript')
# Go to build Unit test
-if target_os == 'linux':
-######################################################################
-# Build UnitTests Resource Client , resourceCache and resourceBroker and
-# DiscoveryManager
-################################################ ######################
-if target_os in ['linux']:
- SConscript('unittests/SConscript')
+# if target_os == 'linux':
+# SConscript('unittests/SConscript')
# Go to build sample apps
-SConscript('sampleapp/SConscript')
+# SConscript('sampleapp/SConscript')
- SConscript('src/resourceCache/unittests/SConscript')
- SConscript('src/resourceBroker/unittest/SConscript')
-
if target_os == 'android':
SConscript('android/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 *
@@ -22,10 +22,10 @@
# rcs_common (primitiveResource and expiryTimer) build script
##
import os
+Import('env')
# SConscript file for Local PKI google tests
-gtest_env = SConscript('#extlibs/gtest/SConscript')
-lib_env = gtest_env.Clone()
+lib_env = env.Clone()
# Add third party libraries
SConscript('#service/third_party_libs.scons', exports = 'lib_env')
--- 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')
@@ -21,9 +21,11 @@
##
# rcs_server (Server Builder) project build script
##
+import os
+Import('env')
+
# SConscript file for Local PKI google tests
-gtest_env = SConscript('#extlibs/gtest/SConscript')
-lib_env = gtest_env.Clone()
+lib_env = env.Clone()
# Add third party libraries
SConscript('#service/third_party_libs.scons', exports = 'lib_env')
--- a/service/scene-manager/SConscript
+++ b/service/scene-manager/SConscript
@@ -100,9 +100,5 @@ scenemanager_env.UserInstallTargetHeader
scenemanager_env.UserInstallTargetHeader('include/RemoteScene.h', 'service/scene-manager', 'RemoteScene.h')
scenemanager_env.UserInstallTargetHeader('include/RemoteSceneAction.h', 'service/scene-manager', 'RemoteSceneAction.h')
if env.get('TEST') == '1':
from tools.scons.RunTest import *
-# Go to build Unit test
-if target_os in ['linux']:
- SConscript('unittests/SConscript')
-
# Go to build sample apps
SConscript('sampleapp/SConscript')

+ 0
- 38
net/iotivity/patches/004-use-env.patch View File

@ -1,38 +0,0 @@
From 884e831ed07607097614276f6bbf192993228100 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Date: Tue, 2 Jun 2015 11:08:17 +0200
Subject: [PATCH 3/4] 004-use-env.patch
---
build_common/SConscript | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
--- a/build_common/SConscript
+++ b/build_common/SConscript
@@ -151,6 +151,26 @@ tc_set_msg = '''
* cause inexplicable errors. *
*******************************************************************************
'''
+env['ENV'] = os.environ
+if 'CC' in os.environ:
+ env['CC'] = Split(os.environ['CC'])
+ print "using CC from environment: %s" % env['CC']
+if 'CXX' in os.environ:
+ env['CXX'] = Split(os.environ['CXX'])
+ print "using CXX from environment: %s" % env['CXX']
+if 'CFLAGS' in os.environ:
+ env['CFLAGS'] = Split(os.environ['CFLAGS'])
+ print "using CFLAGS from environment: %s" % env['CFLAGS']
+if 'CXXFLAGS' in os.environ:
+ env['CXXFLAGS'] = Split(os.environ['CXXFLAGS'])
+ print "using CXXFLAGS from environment: %s" % env['CXXFLAGS']
+if 'CPPFLAGS' in os.environ:
+ env['CPPFLAGS'] = Split(os.environ['CPPFLAGS'])
+ print "using CPPFLAGS from environment: %s" % env['CPPFLAGS']
+if 'LDFLAGS' in os.environ:
+ env['LINKFLAGS'] = Split(os.environ['LDFLAGS'])
+ print "using LDFLAGS/LINKFLAGS from environment: %s" % env['LINKFLAGS']
+
if env.get('VERBOSE') == False:
env['CCCOMSTR'] = "Compiling $TARGET"
env['SHCCCOMSTR'] = "Compiling $TARGET"

+ 0
- 60
net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch View File

@ -1,60 +0,0 @@
From 980ef34a085f654e74c9896e8143e6f970049b6c Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 22 Jun 2015 19:39:58 +0200
Subject: [PATCH 3/5] Do not set architecture specific flags
Setting architecture specific flags causes problems when you want to
build something which is not covered by these.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
build_common/linux/SConscript | 20 --------------------
resource/csdk/connectivity/build/linux/SConscript | 20 --------------------
2 files changed, 40 deletions(-)
--- a/build_common/linux/SConscript
+++ b/build_common/linux/SConscript
@@ -24,20 +24,3 @@ env.AppendUnique(LINKFLAGS = ['-ldl', '-
# Set arch flags that match best TARGET_ARCH variable
target_arch = env.get('TARGET_ARCH')
-if target_arch in ['x86']:
- env.AppendUnique(CCFLAGS = ['-m32'])
- env.AppendUnique(LINKFLAGS = ['-m32'])
-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'])
- env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard'])
- env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard'])
-elif target_arch.find('v7a') > 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
-elif target_arch.find('arm64') >= 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
--- a/resource/csdk/connectivity/build/linux/SConscript
+++ b/resource/csdk/connectivity/build/linux/SConscript
@@ -22,20 +22,3 @@ env.AppendUnique(LINKFLAGS = ['-ldl', '-
# Set arch flags
target_arch = env.get('TARGET_ARCH')
-if target_arch in ['x86']:
- env.AppendUnique(CCFLAGS = ['-m32'])
- env.AppendUnique(LINKFLAGS = ['-m32'])
-elif target_arch in ['x86_64']:
- env.AppendUnique(CCFLAGS = ['-m64'])
- env.AppendUnique(LINKFLAGS = ['-m64'])
-elif target_arch.find('v7a-hard') > 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
- env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard'])
- env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard'])
- env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard'])
-elif target_arch.find('v7a') > 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
-elif target_arch.find('arm64') > 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
-else:
- env.AppendUnique(CPPFLAGS = ['-march=armv5te'])

+ 44
- 0
net/iotivity/patches/020-linux-Add-more-architectures.patch View File

@ -0,0 +1,44 @@
From dabd6597013e1df72b08621b466d136b8d25d110 Mon Sep 17 00:00:00 2001
From: Philippe Coval <philippe.coval@osg.samsung.com>
Date: Thu, 29 Sep 2016 10:57:59 +0200
Subject: [PATCH 20/23] linux: Add more architectures
This does not scale and this check should be removed.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Author: Hauke Mehrtens <hauke@hauke-m.de>
Change-Id: Ibb271701904745ee4f5dd689c197228239c37262
Origin: https://github.com/openwrt/packages/blob/master/net/iotivity/patches/021-add-some-more-architectures.patch
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14575
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Nivedita Singhvi <niveditasinghvi@gmail.com>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Hauke Mehrtens <hauke.mehrtens@intel.com>
---
build_common/SConscript | 2 +-
resource/csdk/connectivity/build/SConscript | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/build_common/SConscript
+++ b/build_common/SConscript
@@ -18,7 +18,7 @@ host_target_map = {
# Map of os and allowed archs (os: allowed archs)
os_arch_map = {
- 'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'],
+ 'linux': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'],
'tizen': ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'],
'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
'windows': ['x86', 'amd64', 'arm'],
--- a/resource/csdk/connectivity/build/SConscript
+++ b/resource/csdk/connectivity/build/SConscript
@@ -14,7 +14,7 @@ host_target_map = {
# Map of os and allowed archs (os: allowed archs)
os_arch_map = {
- 'linux': ['x86', 'x86_64', 'arm', 'arm64'],
+ 'linux': ['x86', 'x86_64', 'arm', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'],
'tizen': ['x86', 'x86_64', 'arm', 'arm64'],
'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
'windows': ['x86', 'amd64', 'arm'],

+ 0
- 35
net/iotivity/patches/021-add-some-more-architectures.patch View File

@ -1,35 +0,0 @@
From f78ba209b14908bf2b6197293e1f9e3458ddba8e Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 22 Jun 2015 19:59:47 +0200
Subject: [PATCH 4/5] add some more architectures
This does not scale and this check should be removed.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
build_common/SConscript | 2 +-
resource/csdk/connectivity/build/SConscript | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- a/build_common/SConscript
+++ b/build_common/SConscript
@@ -14,7 +14,7 @@ host_target_map = {
# Map of os and allowed archs (os: allowed archs)
os_arch_map = {
- 'linux': ['x86', 'x86_64', 'arm', 'arm64'],
+ 'linux': ['x86', 'x86_64', 'arm', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'],
'tizen': ['x86', 'x86_64', 'arm', 'arm64', 'armeabi-v7a'],
'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
'windows': ['x86', 'amd64', 'arm'],
--- a/resource/csdk/connectivity/build/SConscript
+++ b/resource/csdk/connectivity/build/SConscript
@@ -14,7 +14,7 @@ host_target_map = {
# Map of os and allowed archs (os: allowed archs)
os_arch_map = {
- 'linux': ['x86', 'x86_64', 'arm', 'arm64'],
+ 'linux': ['x86', 'x86_64', 'arm', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'],
'tizen': ['x86', 'x86_64', 'arm', 'arm64'],
'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
'windows': ['x86', 'amd64', 'arm'],

+ 39
- 0
net/iotivity/patches/021-build-do-not-set-TARGET_ARCH-to-default.patch View File

@ -0,0 +1,39 @@
From 792f68219b3ab4ff5238e3abc7aa1c68bfa4a22b Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 10 Dec 2016 18:15:32 +0100
Subject: [PATCH 21/23] build: do not set TARGET_ARCH to default
This check is useless, scons already checks this and returns such an
error message:
Invalid value for option TARGET_ARCH: mips. Valid values are: ['x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64']
Change-Id: I3f7dd3b9fcae875ab20349203fb77537f24be763
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
build_common/SConscript | 3 ---
resource/csdk/connectivity/build/SConscript | 2 --
2 files changed, 5 deletions(-)
--- a/build_common/SConscript
+++ b/build_common/SConscript
@@ -54,9 +54,6 @@ if target_os == 'android':
else:
default_arch = platform.machine()
-if default_arch not in os_arch_map[target_os]:
- default_arch = os_arch_map[target_os][0].lower()
-
target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch
# True if binary needs to be installed on board. (Might need root permissions)
--- a/resource/csdk/connectivity/build/SConscript
+++ b/resource/csdk/connectivity/build/SConscript
@@ -40,8 +40,6 @@ if target_os not in host_target_map[host
Exit(1)
default_arch = platform.machine()
-if default_arch not in os_arch_map[target_os]:
- default_arch = os_arch_map[target_os][0].lower()
target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch

+ 57
- 0
net/iotivity/patches/022-build-restrict-compiler-options-to-supported-archite.patch View File

@ -0,0 +1,57 @@
From 39b0c436c77555849da1e68cc8733c67183c291f Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 10 Dec 2016 18:35:04 +0100
Subject: [PATCH 22/23] build: restrict compiler options to supported
architectures
For Linux we currently only support the following architectures:
'x86', 'x86_64', 'arm', 'arm-v7a', 'armeabi-v7a', 'arm64'
explicitly check for those architectures and also remove ARM hard float.
Change-Id: I7078530bc2a89b88c7049cc53e8bb3fbe5d75ca8
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
build_common/linux/SConscript | 11 +++--------
resource/csdk/connectivity/build/linux/SConscript | 11 +++--------
2 files changed, 6 insertions(+), 16 deletions(-)
--- a/build_common/linux/SConscript
+++ b/build_common/linux/SConscript
@@ -30,14 +30,9 @@ if target_arch in ['x86']:
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:
+elif target_arch in ['arm']:
env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
-elif target_arch.find('v7a-hard') > 0:
+elif target_arch in ['arm-v7a', 'armeabi-v7a']:
env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
- env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard'])
- env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard'])
- env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard'])
-elif target_arch.find('v7a') > 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
-elif target_arch.find('arm64') >= 0:
+elif target_arch.find('arm64') > 0:
env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
--- a/resource/csdk/connectivity/build/linux/SConscript
+++ b/resource/csdk/connectivity/build/linux/SConscript
@@ -29,14 +29,9 @@ if target_arch in ['x86']:
elif target_arch in ['x86_64']:
env.AppendUnique(CCFLAGS = ['-m64'])
env.AppendUnique(LINKFLAGS = ['-m64'])
-elif target_arch.find('v7a-hard') > 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
- env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard'])
- env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard'])
- env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard'])
-elif target_arch.find('v7a') > 0:
+elif target_arch in ['arm']:
+ env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
+elif target_arch in ['arm-v7a', 'armeabi-v7a']:
env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
elif target_arch.find('arm64') > 0:
env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
-else:
- env.AppendUnique(CPPFLAGS = ['-march=armv5te'])

+ 126
- 0
net/iotivity/patches/023-build-take-compiler-options-from-environment.patch View File

@ -0,0 +1,126 @@
From 5f9513eb341d520d10c48f8ba2bd145063405fdd Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 10 Dec 2016 18:08:05 +0100
Subject: [PATCH 23/23] build: take compiler options from environment
This makes it possible to compile IoTivity with custom compiler
options. This way someone can use optimized compiler settings for the
target CPU. I want to use this in OpenWrt / LEDE to build specific
IoTivity binaries for each CPU architecture, there the build system
provides the matching compiler options.
Change-Id: I86772f73b81c41d7e96e51b434fd9e3b4992753a
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
build_common/SConscript | 25 +++++++++++++++++++++
build_common/linux/SConscript | 27 ++++++++++++-----------
resource/csdk/connectivity/build/linux/SConscript | 27 ++++++++++++-----------
3 files changed, 53 insertions(+), 26 deletions(-)
--- a/build_common/SConscript
+++ b/build_common/SConscript
@@ -120,6 +120,7 @@ help_vars.Add(PathVariable('ANDROID_NDK'
help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept))
help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile))
help_vars.Add(EnumVariable('WITH_UPSTREAM_LIBCOAP', 'Use latest stable version of LibCoAP downloaded from github', default_with_upstream_libcoap, allowed_values=('0','1')))
+help_vars.Add(BoolVariable('WITH_ENV', 'Use compiler options from environment', False))
AddOption('--prefix',
dest='prefix',
@@ -153,6 +154,30 @@ else:
)
Help(help_vars.GenerateHelpText(env))
+if env.get('WITH_ENV'):
+ env['ENV'] = os.environ
+ if 'CC' in os.environ:
+ env['CC'] = Split(os.environ['CC'])
+ print "using CC from environment: %s" % env['CC']
+ if 'CXX' in os.environ:
+ env['CXX'] = Split(os.environ['CXX'])
+ print "using CXX from environment: %s" % env['CXX']
+ if 'CFLAGS' in os.environ:
+ env['CFLAGS'] = Split(os.environ['CFLAGS'])
+ print "using CFLAGS from environment: %s" % env['CFLAGS']
+ if 'CXXFLAGS' in os.environ:
+ env['CXXFLAGS'] = Split(os.environ['CXXFLAGS'])
+ print "using CXXFLAGS from environment: %s" % env['CXXFLAGS']
+ if 'CCFLAGS' in os.environ:
+ env['CCFLAGS'] = Split(os.environ['CCFLAGS'])
+ print "using CCFLAGS from environment: %s" % env['CCFLAGS']
+ if 'CPPFLAGS' in os.environ:
+ env['CPPFLAGS'] = Split(os.environ['CPPFLAGS'])
+ print "using CPPFLAGS from environment: %s" % env['CPPFLAGS']
+ if 'LDFLAGS' in os.environ:
+ env['LINKFLAGS'] = Split(os.environ['LDFLAGS'])
+ print "using LDFLAGS/LINKFLAGS from environment: %s" % env['LINKFLAGS']
+
tc_set_msg = '''
************************************ Warning **********************************
* Enviornment variable TC_PREFIX/TC_PATH is set. It will change the default *
--- a/build_common/linux/SConscript
+++ b/build_common/linux/SConscript
@@ -23,16 +23,17 @@ env.AppendUnique(CCFLAGS = ['-Wall', '-W
env.AppendUnique(LIBS = ['dl', 'pthread', 'uuid'])
# Set arch flags that match best TARGET_ARCH variable
-target_arch = env.get('TARGET_ARCH')
-if target_arch in ['x86']:
- env.AppendUnique(CCFLAGS = ['-m32'])
- env.AppendUnique(LINKFLAGS = ['-m32'])
-elif target_arch in ['x86_64']:
- env.AppendUnique(CCFLAGS = ['-m64'])
- env.AppendUnique(LINKFLAGS = ['-m64'])
-elif target_arch in ['arm']:
- env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
-elif target_arch in ['arm-v7a', 'armeabi-v7a']:
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
-elif target_arch.find('arm64') > 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
+if not env.get('WITH_ENV'):
+ target_arch = env.get('TARGET_ARCH')
+ if target_arch in ['x86']:
+ env.AppendUnique(CCFLAGS = ['-m32'])
+ env.AppendUnique(LINKFLAGS = ['-m32'])
+ elif target_arch in ['x86_64']:
+ env.AppendUnique(CCFLAGS = ['-m64'])
+ env.AppendUnique(LINKFLAGS = ['-m64'])
+ elif target_arch in ['arm']:
+ env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
+ elif target_arch in ['arm-v7a', 'armeabi-v7a']:
+ env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
+ elif target_arch.find('arm64') > 0:
+ env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
--- a/resource/csdk/connectivity/build/linux/SConscript
+++ b/resource/csdk/connectivity/build/linux/SConscript
@@ -22,16 +22,17 @@ env.AppendUnique(CCFLAGS = ['-Wall', '-f
env.AppendUnique(LIBS = ['dl', 'pthread'])
# Set arch flags
-target_arch = env.get('TARGET_ARCH')
-if target_arch in ['x86']:
- env.AppendUnique(CCFLAGS = ['-m32'])
- env.AppendUnique(LINKFLAGS = ['-m32'])
-elif target_arch in ['x86_64']:
- env.AppendUnique(CCFLAGS = ['-m64'])
- env.AppendUnique(LINKFLAGS = ['-m64'])
-elif target_arch in ['arm']:
- env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
-elif target_arch in ['arm-v7a', 'armeabi-v7a']:
- env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
-elif target_arch.find('arm64') > 0:
- env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
+if not env.get('WITH_ENV'):
+ target_arch = env.get('TARGET_ARCH')
+ if target_arch in ['x86']:
+ env.AppendUnique(CCFLAGS = ['-m32'])
+ env.AppendUnique(LINKFLAGS = ['-m32'])
+ elif target_arch in ['x86_64']:
+ env.AppendUnique(CCFLAGS = ['-m64'])
+ env.AppendUnique(LINKFLAGS = ['-m64'])
+ elif target_arch in ['arm']:
+ env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
+ elif target_arch in ['arm-v7a', 'armeabi-v7a']:
+ env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
+ elif target_arch.find('arm64') > 0:
+ env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])

+ 2
- 2
net/iotivity/patches/030-remove-check-for-curl.patch View File

@ -1,6 +1,6 @@
--- a/service/resource-container/SConscript
+++ b/service/resource-container/SConscript
@@ -175,36 +175,22 @@ if target_os in ['linux', 'tizen', 'andr
@@ -191,36 +191,22 @@ if target_os in ['linux', 'tizen', 'andr
# build hue sample bundle
######################################################################
@ -52,4 +52,4 @@
+hue_resource_bundle_env.UserInstallTargetLib(HueBundle, 'libHueBundle')
######################################################################
# build resource container unit tests
# Build Container Sample

+ 27
- 0
net/iotivity/patches/040-linux-Use-system-sqlite3.patch View File

@ -0,0 +1,27 @@
From 08b403572985a70fe5d652378e1cfa2b72ac6a3d Mon Sep 17 00:00:00 2001
From: Philippe Coval <philippe.coval@osg.samsung.com>
Date: Fri, 9 Dec 2016 02:12:04 +0100
Subject: [PATCH] linux: Use system sqlite3
Problem was discovered on yocto
Change-Id: I5274bed9e4b7ddcdc1b17a265a1886cd78cb631f
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15305
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
---
resource/csdk/SConscript | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/resource/csdk/SConscript
+++ b/resource/csdk/SConscript
@@ -191,7 +191,7 @@ if with_tcp == True:
if 'SERVER' in rd_mode:
liboctbstack_src.append(OCTBSTACK_SRC + 'oicresourcedirectory.c')
- if target_os not in ['tizen']:
+ if target_os not in ['linux', 'tizen']:
liboctbstack_src.append('#extlibs/sqlite3/sqlite3.c')
if target_os in ['linux']:

+ 0
- 24
net/iotivity/patches/040-remove-provisioning.patch View File

@ -1,24 +0,0 @@
From 4488170af944163b62051b2afee60386a9973c72 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke.mehrtens@intel.com>
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 <hauke.mehrtens@intel.com>
---
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')

+ 54
- 0
net/iotivity/patches/050-csdk-move-OCEntityHandlerResponse-from-stack-to-heap.patch View File

@ -0,0 +1,54 @@
From d8cf30cb0abd5fa8f6282b490618204d683b625c Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 3 Oct 2016 21:00:28 +0200
Subject: [PATCH 1/3] csdk: move OCEntityHandlerResponse from stack to heap
OCEntityHandlerResponse is over 50KByte and I got a stack overflow on MIPS
running on LEDE without this patch. Instead of storing
OCEntityHandlerResponse on the program stack, allocate some memory on
the heap and free it afterwards again.
This fixes one part of this issue for me:
https://jira.iotivity.org/browse/IOT-1374
Change-Id: I365a5c7a34dce2dfb0897a20b57a13ba566748ec
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
resource/csdk/stack/src/ocresource.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
--- a/resource/csdk/stack/src/ocresource.c
+++ b/resource/csdk/stack/src/ocresource.c
@@ -774,15 +774,25 @@ static bool includeThisResourceInRespons
OCStackResult SendNonPersistantDiscoveryResponse(OCServerRequest *request, OCResource *resource,
OCPayload *discoveryPayload, OCEntityHandlerResult ehResult)
{
- OCEntityHandlerResponse response = {0};
+ OCEntityHandlerResponse *response = NULL;
+ OCStackResult result = OC_STACK_ERROR;
- response.ehResult = ehResult;
- response.payload = discoveryPayload;
- response.persistentBufferFlag = 0;
- response.requestHandle = (OCRequestHandle) request->requestId;
- response.resourceHandle = (OCResourceHandle) resource;
+ response = (OCEntityHandlerResponse *)OICCalloc(1, sizeof(*response));
+ VERIFY_PARAM_NON_NULL(TAG, response, "Failed allocating OCEntityHandlerResponse");
- return OCDoResponse(&response);
+ response->ehResult = ehResult;
+ response->payload = discoveryPayload;
+ response->persistentBufferFlag = 0;
+ response->requestHandle = (OCRequestHandle) request->requestId;
+ response->resourceHandle = (OCResourceHandle) resource;
+
+ result = OCDoResponse(response);
+
+ OICFree(response);
+ return result;
+
+exit:
+ return OC_STACK_NO_MEMORY;
}
static OCStackResult EHRequest(OCEntityHandlerRequest *ehRequest, OCPayloadType type,

+ 357
- 0
net/iotivity/patches/051-csdk-move-OCClientResponse-from-stack-to-heap.patch View File

@ -0,0 +1,357 @@
From e8971dd4914c9d42938c4c885b4ac6d784d7e0ff Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 3 Oct 2016 23:22:36 +0200
Subject: [PATCH 2/3] csdk: move OCClientResponse from stack to heap
OCClientResponse is about 50KByte and should not be stored on the
stack. On LEDE with MIPS, musl libc this causes a segmentation fault.
Moving this structure to the heap is the simple solution for this
problem, but this structure should be shrined.
There are probably more places were this is stored on the stack and
will cause problems. This fixes the other issue I saw in
https://jira.iotivity.org/browse/IOT-1374
Change-Id: I45d8aee4a8151fea51d3318acb1eea61ce579060
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
resource/csdk/stack/src/ocstack.c | 163 ++++++++++++++++++++++++--------------
1 file changed, 102 insertions(+), 61 deletions(-)
--- a/resource/csdk/stack/src/ocstack.c
+++ b/resource/csdk/stack/src/ocstack.c
@@ -1042,7 +1042,7 @@ OCStackResult HandlePresenceResponse(con
OCStackApplicationResult cbResult = OC_STACK_DELETE_TRANSACTION;
ClientCB * cbNode = NULL;
char *resourceTypeName = NULL;
- OCClientResponse response = {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}};
+ OCClientResponse *response = NULL;
OCStackResult result = OC_STACK_ERROR;
uint32_t maxAge = 0;
int uriLen;
@@ -1057,15 +1057,23 @@ OCStackResult HandlePresenceResponse(con
return OC_STACK_ERROR;
}
- response.payload = NULL;
- response.result = OC_STACK_OK;
+ response = (OCClientResponse *)OICCalloc(1, sizeof(*response));
+ if (!response)
+ {
+ OIC_LOG(ERROR, TAG, "Allocating memory for response failed");
+ return OC_STACK_ERROR;
+ }
+ response->devAddr.adapter = OC_DEFAULT_ADAPTER;
- CopyEndpointToDevAddr(endpoint, &response.devAddr);
- FixUpClientResponse(&response);
+ response->payload = NULL;
+ response->result = OC_STACK_OK;
+
+ CopyEndpointToDevAddr(endpoint, &response->devAddr);
+ FixUpClientResponse(response);
if (responseInfo->info.payload)
{
- result = OCParsePayload(&response.payload,
+ result = OCParsePayload(&response->payload,
PAYLOAD_TYPE_PRESENCE,
responseInfo->info.payload,
responseInfo->info.payloadSize);
@@ -1075,15 +1083,15 @@ OCStackResult HandlePresenceResponse(con
OIC_LOG(ERROR, TAG, "Presence parse failed");
goto exit;
}
- if(!response.payload || response.payload->type != PAYLOAD_TYPE_PRESENCE)
+ if(!response->payload || response->payload->type != PAYLOAD_TYPE_PRESENCE)
{
OIC_LOG(ERROR, TAG, "Presence payload was wrong type");
result = OC_STACK_ERROR;
goto exit;
}
- response.sequenceNumber = ((OCPresencePayload*)response.payload)->sequenceNumber;
- resourceTypeName = ((OCPresencePayload*)response.payload)->resourceType;
- maxAge = ((OCPresencePayload*)response.payload)->maxAge;
+ response->sequenceNumber = ((OCPresencePayload*)response->payload)->sequenceNumber;
+ resourceTypeName = ((OCPresencePayload*)response->payload)->resourceType;
+ maxAge = ((OCPresencePayload*)response->payload)->maxAge;
}
// check for unicast presence
@@ -1091,6 +1099,7 @@ OCStackResult HandlePresenceResponse(con
responseInfo->isMulticast);
if (uriLen < 0 || (size_t)uriLen >= sizeof (presenceUri))
{
+ OICFree(response);
return OC_STACK_INVALID_URI;
}
OIC_LOG(ERROR, TAG, "check for unicast presence");
@@ -1118,7 +1127,7 @@ OCStackResult HandlePresenceResponse(con
if (presenceSubscribe)
{
- if(cbNode->sequenceNumber == response.sequenceNumber)
+ if(cbNode->sequenceNumber == response->sequenceNumber)
{
OIC_LOG(INFO, TAG, "No presence change");
ResetPresenceTTL(cbNode, maxAge);
@@ -1129,7 +1138,7 @@ OCStackResult HandlePresenceResponse(con
if(maxAge == 0)
{
OIC_LOG(INFO, TAG, "Stopping presence");
- response.result = OC_STACK_PRESENCE_STOPPED;
+ response->result = OC_STACK_PRESENCE_STOPPED;
if(cbNode->presence)
{
OICFree(cbNode->presence->timeOut);
@@ -1165,7 +1174,7 @@ OCStackResult HandlePresenceResponse(con
ResetPresenceTTL(cbNode, maxAge);
- cbNode->sequenceNumber = response.sequenceNumber;
+ cbNode->sequenceNumber = response->sequenceNumber;
}
}
else
@@ -1175,7 +1184,7 @@ OCStackResult HandlePresenceResponse(con
if (0 == maxAge)
{
OIC_LOG(INFO, TAG, "Stopping presence");
- response.result = OC_STACK_PRESENCE_STOPPED;
+ response->result = OC_STACK_PRESENCE_STOPPED;
}
}
@@ -1191,7 +1200,7 @@ OCStackResult HandlePresenceResponse(con
OIC_LOG(INFO, TAG, "Callback for presence");
- cbResult = cbNode->callBack(cbNode->context, cbNode->handle, &response);
+ cbResult = cbNode->callBack(cbNode->context, cbNode->handle, response);
if (cbResult == OC_STACK_DELETE_TRANSACTION)
{
@@ -1199,7 +1208,8 @@ OCStackResult HandlePresenceResponse(con
}
exit:
- OCPayloadDestroy(response.payload);
+ OCPayloadDestroy(response->payload);
+ OICFree(response);
return result;
}
@@ -1240,36 +1250,53 @@ void OCHandleResponse(const CAEndpoint_t
OIC_LOG(INFO, TAG, "Receiving A Timeout for this token");
OIC_LOG(INFO, TAG, "Calling into application address space");
- OCClientResponse response =
- {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}};
- CopyEndpointToDevAddr(endPoint, &response.devAddr);
- FixUpClientResponse(&response);
- response.resourceUri = responseInfo->info.resourceUri;
- memcpy(response.identity.id, responseInfo->info.identity.id,
- sizeof (response.identity.id));
- response.identity.id_length = responseInfo->info.identity.id_length;
+ OCClientResponse *response = NULL;
+
+ response = (OCClientResponse *)OICCalloc(1, sizeof(*response));
+ if (!response)
+ {
+ OIC_LOG(ERROR, TAG, "Allocating memory for response failed");
+ return;
+ }
+
+ response->devAddr.adapter = OC_DEFAULT_ADAPTER;
+ CopyEndpointToDevAddr(endPoint, &response->devAddr);
+ FixUpClientResponse(response);
+ response->resourceUri = responseInfo->info.resourceUri;
+ memcpy(response->identity.id, responseInfo->info.identity.id,
+ sizeof (response->identity.id));
+ response->identity.id_length = responseInfo->info.identity.id_length;
- response.result = CAResponseToOCStackResult(responseInfo->result);
+ response->result = CAResponseToOCStackResult(responseInfo->result);
cbNode->callBack(cbNode->context,
- cbNode->handle, &response);
+ cbNode->handle, response);
FindAndDeleteClientCB(cbNode);
+ OICFree(response);
}
else
{
OIC_LOG(INFO, TAG, "This is a regular response, A client call back is found");
OIC_LOG(INFO, TAG, "Calling into application address space");
- OCClientResponse response =
- {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}};
- response.sequenceNumber = MAX_SEQUENCE_NUMBER + 1;
- CopyEndpointToDevAddr(endPoint, &response.devAddr);
- FixUpClientResponse(&response);
- response.resourceUri = responseInfo->info.resourceUri;
- memcpy(response.identity.id, responseInfo->info.identity.id,
- sizeof (response.identity.id));
- response.identity.id_length = responseInfo->info.identity.id_length;
+ OCClientResponse *response = NULL;
- response.result = CAResponseToOCStackResult(responseInfo->result);
+ response = (OCClientResponse *)OICCalloc(1, sizeof(*response));
+ if (!response)
+ {
+ OIC_LOG(ERROR, TAG, "Allocating memory for response failed");
+ return;
+ }
+
+ response->devAddr.adapter = OC_DEFAULT_ADAPTER;
+ response->sequenceNumber = MAX_SEQUENCE_NUMBER + 1;
+ CopyEndpointToDevAddr(endPoint, &response->devAddr);
+ FixUpClientResponse(response);
+ response->resourceUri = responseInfo->info.resourceUri;
+ memcpy(response->identity.id, responseInfo->info.identity.id,
+ sizeof (response->identity.id));
+ response->identity.id_length = responseInfo->info.identity.id_length;
+
+ response->result = CAResponseToOCStackResult(responseInfo->result);
if(responseInfo->info.payload &&
responseInfo->info.payloadSize)
@@ -1359,21 +1386,23 @@ void OCHandleResponse(const CAEndpoint_t
{
OIC_LOG_V(ERROR, TAG, "Unknown Payload type: %d %s",
cbNode->method, cbNode->requestUri);
+ OICFree(response);
return;
}
- if(OC_STACK_OK != OCParsePayload(&response.payload,
+ if(OC_STACK_OK != OCParsePayload(&response->payload,
type,
responseInfo->info.payload,
responseInfo->info.payloadSize))
{
OIC_LOG(ERROR, TAG, "Error converting payload");
- OCPayloadDestroy(response.payload);
+ OCPayloadDestroy(response->payload);
+ OICFree(response);
return;
}
}
- response.numRcvdVendorSpecificHeaderOptions = 0;
+ response->numRcvdVendorSpecificHeaderOptions = 0;
if(responseInfo->info.numOptions > 0)
{
int start = 0;
@@ -1391,19 +1420,20 @@ void OCHandleResponse(const CAEndpoint_t
observationOption =
(observationOption << 8) | optionData[i];
}
- response.sequenceNumber = observationOption;
- response.numRcvdVendorSpecificHeaderOptions = responseInfo->info.numOptions - 1;
+ response->sequenceNumber = observationOption;
+ response->numRcvdVendorSpecificHeaderOptions = responseInfo->info.numOptions - 1;
start = 1;
}
else
{
- response.numRcvdVendorSpecificHeaderOptions = responseInfo->info.numOptions;
+ response->numRcvdVendorSpecificHeaderOptions = responseInfo->info.numOptions;
}
- if(response.numRcvdVendorSpecificHeaderOptions > MAX_HEADER_OPTIONS)
+ if(response->numRcvdVendorSpecificHeaderOptions > MAX_HEADER_OPTIONS)
{
OIC_LOG(ERROR, TAG, "#header options are more than MAX_HEADER_OPTIONS");
- OCPayloadDestroy(response.payload);
+ OCPayloadDestroy(response->payload);
+ OICFree(response);
return;
}
@@ -1411,19 +1441,19 @@ void OCHandleResponse(const CAEndpoint_t
{
if(&(responseInfo->info.options[i]))
{
- memcpy (&(response.rcvdVendorSpecificHeaderOptions[i-start]),
+ memcpy (&(response->rcvdVendorSpecificHeaderOptions[i-start]),
&(responseInfo->info.options[i]), sizeof(OCHeaderOption));
}
}
}
if (cbNode->method == OC_REST_OBSERVE &&
- response.sequenceNumber > OC_OFFSET_SEQUENCE_NUMBER &&
+ response->sequenceNumber > OC_OFFSET_SEQUENCE_NUMBER &&
cbNode->sequenceNumber <= MAX_SEQUENCE_NUMBER &&
- response.sequenceNumber <= cbNode->sequenceNumber)
+ response->sequenceNumber <= cbNode->sequenceNumber)
{
OIC_LOG_V(INFO, TAG, "Received stale notification. Number :%d",
- response.sequenceNumber);
+ response->sequenceNumber);
}
else
{
@@ -1432,13 +1462,13 @@ void OCHandleResponse(const CAEndpoint_t
char *targetUri = strstr(cbNode->requestUri, OC_RSRVD_RD_URI);
if (targetUri)
{
- OCUpdateResourceInsWithResponse(cbNode->requestUri, &response);
+ OCUpdateResourceInsWithResponse(cbNode->requestUri, response);
}
#endif
OCStackApplicationResult appFeedback = cbNode->callBack(cbNode->context,
cbNode->handle,
- &response);
- cbNode->sequenceNumber = response.sequenceNumber;
+ response);
+ cbNode->sequenceNumber = response->sequenceNumber;
if (appFeedback == OC_STACK_DELETE_TRANSACTION)
{
@@ -1459,7 +1489,8 @@ void OCHandleResponse(const CAEndpoint_t
CA_MSG_ACKNOWLEDGE, 0, NULL, NULL, 0, NULL, CA_RESPONSE_FOR_RES);
}
- OCPayloadDestroy(response.payload);
+ OCPayloadDestroy(response->payload);
+ OICFree(response);
}
return;
}
@@ -1585,16 +1616,26 @@ void HandleCAErrorResponse(const CAEndpo
errorInfo->info.tokenLength, NULL, NULL);
if (cbNode)
{
- OCClientResponse response = { .devAddr = { .adapter = OC_DEFAULT_ADAPTER } };
- CopyEndpointToDevAddr(endPoint, &response.devAddr);
- FixUpClientResponse(&response);
- response.resourceUri = errorInfo->info.resourceUri;
- memcpy(response.identity.id, errorInfo->info.identity.id,
- sizeof (response.identity.id));
- response.identity.id_length = errorInfo->info.identity.id_length;
- response.result = CAResultToOCResult(errorInfo->result);
+ OCClientResponse *response = NULL;
+
+ response = (OCClientResponse *)OICCalloc(1, sizeof(*response));
+ if (!response)
+ {
+ OIC_LOG(ERROR, TAG, "Allocating memory for response failed");
+ return;
+ }
+
+ response->devAddr.adapter = OC_DEFAULT_ADAPTER;
+ CopyEndpointToDevAddr(endPoint, &response->devAddr);
+ FixUpClientResponse(response);
+ response->resourceUri = errorInfo->info.resourceUri;
+ memcpy(response->identity.id, errorInfo->info.identity.id,
+ sizeof (response->identity.id));
+ response->identity.id_length = errorInfo->info.identity.id_length;
+ response->result = CAResultToOCResult(errorInfo->result);
- cbNode->callBack(cbNode->context, cbNode->handle, &response);
+ cbNode->callBack(cbNode->context, cbNode->handle, response);
+ OICFree(response);
}
ResourceObserver *observer = GetObserverUsingToken(errorInfo->info.token,

+ 103
- 0
net/iotivity/patches/053-src-move-OCClientResponse-from-stack-to-heap.patch View File

@ -0,0 +1,103 @@
From 7fb5b6a19b06dc5b0a7f32261551b206b1e6a563 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 8 Jan 2017 19:24:26 +0100
Subject: [PATCH 3/3] src: move OCClientResponse from stack to heap
OCClientResponse is about 50KByte and should not be stored on the
stack. On LEDE with MIPS, musl libc this causes a segmentation fault.
Moving this structure to the heap is the simple solution for this
problem, but this structure should be shrinked.
Change-Id: I7887f93450f45b8031fcdfffb9ee2214fc3d5dd2
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
resource/src/InProcServerWrapper.cpp | 44 +++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 18 deletions(-)
--- a/resource/src/InProcServerWrapper.cpp
+++ b/resource/src/InProcServerWrapper.cpp
@@ -568,51 +568,58 @@ namespace OC
}
else
{
- OCEntityHandlerResponse response;
+ OCEntityHandlerResponse *response = NULL;
+
+ response = (OCEntityHandlerResponse *)OICCalloc(1, sizeof(*response));
+ if (!response) {
+ result = OC_STACK_MALFORMED_RESPONSE;
+ throw OCException(OC::Exception::STR_NULL_RESPONSE, OC_STACK_MALFORMED_RESPONSE);
+ }
+
// OCRepPayload* payLoad = pResponse->getPayload();
HeaderOptions serverHeaderOptions = pResponse->getHeaderOptions();
- response.requestHandle = pResponse->getRequestHandle();
- response.resourceHandle = pResponse->getResourceHandle();
- response.ehResult = pResponse->getResponseResult();
+ response->requestHandle = pResponse->getRequestHandle();
+ response->resourceHandle = pResponse->getResourceHandle();
+ response->ehResult = pResponse->getResponseResult();
- response.payload = reinterpret_cast<OCPayload*>(pResponse->getPayload());
+ response->payload = reinterpret_cast<OCPayload*>(pResponse->getPayload());
- response.persistentBufferFlag = 0;
+ response->persistentBufferFlag = 0;
- response.numSendVendorSpecificHeaderOptions = serverHeaderOptions.size();
+ response->numSendVendorSpecificHeaderOptions = serverHeaderOptions.size();
int i = 0;
for (auto it=serverHeaderOptions.begin(); it != serverHeaderOptions.end(); ++it)
{
- response.sendVendorSpecificHeaderOptions[i].protocolID = OC_COAP_ID;
- response.sendVendorSpecificHeaderOptions[i].optionID =
+ response->sendVendorSpecificHeaderOptions[i].protocolID = OC_COAP_ID;
+ response->sendVendorSpecificHeaderOptions[i].optionID =
static_cast<uint16_t>(it->getOptionID());
- response.sendVendorSpecificHeaderOptions[i].optionLength =
+ response->sendVendorSpecificHeaderOptions[i].optionLength =
(it->getOptionData()).length() + 1;
std::string optionData = it->getOptionData();
std::copy(optionData.begin(),
optionData.end(),
- response.sendVendorSpecificHeaderOptions[i].optionData);
- response.sendVendorSpecificHeaderOptions[i].optionData[it->getOptionData().length()]
+ response->sendVendorSpecificHeaderOptions[i].optionData);
+ response->sendVendorSpecificHeaderOptions[i].optionData[it->getOptionData().length()]
= '\0';
i++;
}
- if(OC_EH_RESOURCE_CREATED == response.ehResult)
+ if(OC_EH_RESOURCE_CREATED == response->ehResult)
{
- pResponse->getNewResourceUri().copy(response.resourceUri,
- sizeof (response.resourceUri) - 1);
- response.resourceUri[pResponse->getNewResourceUri().length()] = '\0';
+ pResponse->getNewResourceUri().copy(response->resourceUri,
+ sizeof (response->resourceUri) - 1);
+ response->resourceUri[pResponse->getNewResourceUri().length()] = '\0';
}
if(cLock)
{
std::lock_guard<std::recursive_mutex> lock(*cLock);
- result = OCDoResponse(&response);
+ result = OCDoResponse(response);
}
else
{
- OICFree(response.payload);
+ OICFree(response->payload);
result = OC_STACK_ERROR;
}
@@ -620,6 +627,7 @@ namespace OC
{
oclog() << "Error sending response\n";
}
+ OICFree(response);
return result;
}
}

+ 0
- 38
net/iotivity/patches/054-resource-encapsulation-deactivate-test-covergae.patch View File

@ -1,38 +0,0 @@
From 8a1a5562904c1bbdb2bcb332c0a74482d7cdea15 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
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 <hauke.mehrtens@lantiq.com>
---
.../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
######################################################################

+ 0
- 39
net/iotivity/patches/060-security-fix-reading-of-permission-attribute-from-co.patch View File

@ -1,39 +0,0 @@
From b1c29c35cba3eb39af18fb8db0ec676e3d658b1d Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke.mehrtens@intel.com>
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 <hauke.mehrtens@intel.com>
---
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

+ 0
- 87
net/iotivity/patches/061-Remove-the-endianness-dependency-for-credential.patch View File

@ -1,87 +0,0 @@
From f182119e571a1b520b4e5ef4ee5e5b5cd243b931 Mon Sep 17 00:00:00 2001
From: Chul Lee <chuls.lee@samsung.com>
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 <chuls.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8829
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hauke Mehrtens <hauke.mehrtens@intel.com>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
(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

+ 0
- 93
net/iotivity/patches/062-Fix-memory-corruption-when-reading-inetgers-from-cbo.patch View File

@ -1,93 +0,0 @@
From 7c99ef8bfa024f11452311c36329eeeeece4fd74 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke.mehrtens@intel.com>
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 <hauke.mehrtens@intel.com>
---
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);

+ 0
- 36
net/iotivity/patches/070-Resource-container-Backported-init-fix-to-1.1-rel.patch View File

@ -1,36 +0,0 @@
From e093390b2839f6039a6ff94ed4942fa45c53a418 Mon Sep 17 00:00:00 2001
From: Philippe Coval <philippe.coval@osg.samsung.com>
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 <inga.stotland@intel.com>
Change-Id: I701096c3b6512546847cf4e120430f690e920453
Signed-off-by: Inga Stotland <inga.stotland@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7759
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: George Nash <george.nash@intel.com>
Reviewed-by: Markus Jung <markus.jung85@gmail.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
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;

+ 27
- 0
net/iotivity/patches/070-ssl-fix-compilation-against-non-debug-mbedtls.patch View File

@ -0,0 +1,27 @@
From 261cf19bfa3dea10ed0f2ebbb2d945c19c9a2804 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 4 Dec 2016 00:18:37 +0100
Subject: [PATCH 5/7] ssl: fix compilation against non debug mbedtls
The function mbedtls_debug_set_threshold() is only available when
MBEDTLS_DEBUG_C is set. make the call depend on this condition.
Change-Id: I8158bc4c55b428167e36084e7a46359c269c5fc7
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 2 ++
1 file changed, 2 insertions(+)
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
@@ -1278,8 +1278,10 @@ static int InitConfig(mbedtls_ssl_config
#if !defined(NDEBUG) || defined(TB_LOG)
mbedtls_ssl_conf_dbg(conf, DebugSsl, NULL);
+#if defined(MBEDTLS_DEBUG_C)
mbedtls_debug_set_threshold(MBED_TLS_DEBUG_LEVEL);
#endif
+#endif
OIC_LOG_V(DEBUG, NET_SSL_TAG, "Out %s", __func__);
return 0;
}

+ 35
- 0
net/iotivity/patches/071-ssl-call-mbedtls_version_get_string-only-if-availabl.patch View File

@ -0,0 +1,35 @@
From cee085e0e62214603b9ae035d63fabca23c491bd Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 8 Jan 2017 01:39:35 +0100
Subject: [PATCH 6/7] ssl: call mbedtls_version_get_string() only if available
The function mbedtls_version_get_string() is only available if
MBEDTLS_VERSION_C is set in the mbedtls configuration. Check this
before calling this function and print the mbedtls version this was
compiled against instead if mbedtls_version_get_string() is not
available.
This fixes a compile problem when MBEDTLS_VERSION_C is not set.
Change-Id: I54c2c2a3fc1f9d35afa475500e3db68420a1b54a
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
@@ -1376,9 +1376,13 @@ CAResult_t CAinitSslAdapter()
/* Initialize TLS library
*/
#if !defined(NDEBUG) || defined(TB_LOG)
+#ifdef MBEDTLS_VERSION_C
char version[MBED_TLS_VERSION_LEN];
mbedtls_version_get_string(version);
OIC_LOG_V(INFO, NET_SSL_TAG, "mbed TLS version: %s", version);
+#else
+ OIC_LOG_V(INFO, NET_SSL_TAG, "mbed TLS version: %s", MBEDTLS_VERSION_STRING);
+#endif
#endif
/* Entropy settings

+ 30
- 0
net/iotivity/patches/072-ssl-call-mbedtls_ssl_conf_renegotiation-only-if-avai.patch View File

@ -0,0 +1,30 @@
From 3684ac3720f91dc131c1c61689395a69ae1865f9 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 8 Jan 2017 20:31:18 +0100
Subject: [PATCH 7/7] ssl: call mbedtls_ssl_conf_renegotiation() only if
available
The function mbedtls_ssl_conf_renegotiation() is only available if
MBEDTLS_SSL_RENEGOTIATION is set in the mbedtls configuration. Check this
before calling this function.
This fixes a compile problem when MBEDTLS_SSL_RENEGOTIATION is not set.
Change-Id: I69f15359d2dcaed1e4fe56fc7799737e38d6c2e7
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 2 ++
1 file changed, 2 insertions(+)
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
@@ -1273,7 +1273,9 @@ static int InitConfig(mbedtls_ssl_config
mbedtls_ssl_conf_rng(conf, mbedtls_ctr_drbg_random, &g_caSslContext->rnd);
mbedtls_ssl_conf_curves(conf, curve[ADAPTER_CURVE_SECP256R1]);
mbedtls_ssl_conf_min_version(conf, MBEDTLS_SSL_MAJOR_VERSION_3, MBEDTLS_SSL_MINOR_VERSION_3);
+#ifdef MBEDTLS_SSL_RENEGOTIATION
mbedtls_ssl_conf_renegotiation(conf, MBEDTLS_SSL_RENEGOTIATION_DISABLED);
+#endif
mbedtls_ssl_conf_authmode(conf, MBEDTLS_SSL_VERIFY_REQUIRED);
#if !defined(NDEBUG) || defined(TB_LOG)

+ 44
- 0
net/iotivity/patches/075-ssl-enable-usage-of-patched-mbed-functions-condition.patch View File

@ -0,0 +1,44 @@
From 01796db0b166e720860eff200acabff410ba6979 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 4 Dec 2016 00:15:21 +0100
Subject: [PATCH 4/7] ssl: enable usage of patched mbed functions conditionally
Only activate support for the MBEDTLS_KEY_EXCHANGE_ECDH_ANON_ENABLED
cipher suite when this is actually available in mbedtls.
This makes it possible to compile IoTivity against a unpatched mbedtls
version.
Change-Id: Ic56d7faf7597cc5dc08f9d55be29dde898949609
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
@@ -237,7 +237,9 @@ int tlsCipher[ADAPTER_CIPHER_MAX][2] =
{
{MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA, 0},
{MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8, 0},
+#ifdef MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256
{MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256, 0},
+#endif
{MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256, 0},
{MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM, 0},
{MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 0}
@@ -1943,6 +1945,7 @@ CAResult_t CAsetTlsCipherSuite(const uin
g_caSslContext->cipher = ADAPTER_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8;
break;
}
+#ifdef MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256
case MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256:
{
#ifdef __WITH_TLS__
@@ -1960,6 +1963,7 @@ CAResult_t CAsetTlsCipherSuite(const uin
g_caSslContext->cipher = ADAPTER_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA_256;
break;
}
+#endif
case MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256:
{
#if 0 // PIN OTM

+ 22
- 0
net/iotivity/patches/078-use-system-mbedtls.patch View File

@ -0,0 +1,22 @@
Make it possible to use system mbedtls version
--- a/resource/csdk/connectivity/src/SConscript
+++ b/resource/csdk/connectivity/src/SConscript
@@ -73,16 +73,7 @@ if env.get('SECURED') == '1':
env.AppendUnique(CPPPATH = [src_dir + '/resource/csdk/security/include'])
env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
env.AppendUnique(CPPPATH = [os.path.join(root_dir, 'external/inc')])
- tls_path = 'extlibs/mbedtls';
- tls_headers_path = 'mbedtls/include';
- if ca_os == 'tizen' and os.path.exists(root_dir + '/' + tls_path):
- env.SConscript(os.path.join(root_dir, tls_path + '/SConscript'))
- env.AppendUnique(CPPPATH = [os.path.join(root_dir, tls_path + '/' + tls_headers_path)])
- else:
- if ca_os != 'android':
- env.SConscript('#' + tls_path + '/SConscript')
- env.AppendUnique(CPPPATH = ['#' + tls_path + '/' + tls_headers_path])
- env.AppendUnique(CA_SRC = [os.path.join(ca_path, 'adapter_util/ca_adapter_net_ssl.c')])
+ env.AppendUnique(CA_SRC = [os.path.join(ca_path, 'adapter_util/ca_adapter_net_ssl.c')])
if ((secured == '1') and (with_tcp == True)):
env.AppendUnique(CPPDEFINES = ['__WITH_TLS__'])

+ 31
- 0
net/iotivity/patches/080-zigbee_wrapper-do-not-check-for-floating-point.patch View File

@ -0,0 +1,31 @@
From df8360447163762c63994dcb07f9e69a5a365a1c Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 8 Jan 2017 22:01:57 +0100
Subject: [PATCH 8/8] zigbee_wrapper: do not check for floating point
This makes the compile fail for soft float builds. In such builds the
double is still 64 bit long.
Change-Id: I45d3f19b49f5d23d2b65307738a362765c5ea1c2
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
plugins/zigbee_wrapper/src/zigbee_wrapper.c | 8 --------
1 file changed, 8 deletions(-)
--- a/plugins/zigbee_wrapper/src/zigbee_wrapper.c
+++ b/plugins/zigbee_wrapper/src/zigbee_wrapper.c
@@ -37,14 +37,6 @@
#include <math.h>
#include <errno.h>
-// The following #define must be here under "math.h".
-// This ifdef ensures that "__STDC_IEC_559__" is defined. If it is defined,
-// then we are guaranteed that the 'double' type is 64-bit. Otherwise, the
-// compilation of this file should fail because we are no longer guaranteed.
-#ifndef __STDC_IEC_559__
-#error "Requires IEEE 754 floating point!"
-#endif
-
#include "zigbee_wrapper.h"
#include "telegesis_wrapper.h"
#include "pluginlist.h"

+ 15
- 18
net/iotivity/patches/140-remove-glib2.patch View File

@ -1,35 +1,32 @@
--- a/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript
+++ b/resource/csdk/connectivity/src/bt_le_adapter/linux/SConscript
@@ -73,7 +73,7 @@ env.AppendUnique(
@@ -73,7 +73,6 @@ env.AppendUnique(
# The Linux BLE adapter implementation uses GDBus to make D-Bus based
# method calls to BlueZ. Pull in the necessary dependencies.
-env.ParseConfig("pkg-config gio-unix-2.0 --cflags --libs")
+# env.ParseConfig("pkg-config gio-unix-2.0 --cflags --libs")
# Set up commands to generate GDBus code from the D-Bus introspection
# XML.
--- a/resource/csdk/security/provisioning/sample/SConscript
+++ b/resource/csdk/security/provisioning/sample/SConscript
@@ -58,7 +58,7 @@ if env.get('SECURED') == '1':
if env.get('DTLS_WITH_X509') == '1':
provisioning_env.AppendUnique(LIBS = ['CKManager'])
provisioning_env.AppendUnique(LIBS = ['asn1'])
-provisioning_env.ParseConfig('pkg-config --libs glib-2.0');
+# provisioning_env.ParseConfig('pkg-config --libs glib-2.0');
provisioning_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
@@ -70,7 +70,6 @@ if target_os not in ['windows']:
if target_os not in ['msys_nt', 'windows']:
provisioning_env.AppendUnique(LIBS = ['dl', 'm'])
- provisioning_env.ParseConfig('pkg-config --libs glib-2.0');
provisioning_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
else:
provisioning_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
--- a/resource/csdk/security/provisioning/SConscript
+++ b/resource/csdk/security/provisioning/SConscript
@@ -76,8 +76,8 @@ provisioning_env.AppendUnique(LIBS = ['t
if env.get('DTLS_WITH_X509') == '1':
provisioning_env.AppendUnique(LIBS = ['CKManager', 'asn1'])
@@ -73,9 +73,6 @@ provisioning_env.PrependUnique(LIBS = ['
provisioning_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
-if target_os != 'android':
-if target_os not in ['msys_nt', 'windows', 'android', 'ios']:
- 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 in ['windows', 'msys_nt']:
provisioning_env.AppendUnique(LIBS = ['ws2_32', 'advapi32', 'iphlpapi'])
if target_os == 'tizen':
provisioning_env.ParseConfig('pkg-config --cflags --libs sqlite3')

Loading…
Cancel
Save