From: Sandipan Patra Date: Wed, 9 Mar 2016 08:34:31 +0000 (+0530) Subject: [Tizen Secure Mode] Tizen enrollee build using security mode enabled X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cacf88d328ec0a4efb2bc4024d3a102abf9e13d0;p=contrib%2Fiotivity.git [Tizen Secure Mode] Tizen enrollee build using security mode enabled Change-Id: I5a4d91e5e56863a9a859f681202f52828207a00a Signed-off-by: Sandipan Patra Reviewed-on: https://gerrit.iotivity.org/gerrit/5611 Reviewed-by: Jon A. Cruz Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- diff --git a/resource/csdk/security/provisioning/SConscript b/resource/csdk/security/provisioning/SConscript index 5558dd0..2385e84 100644 --- a/resource/csdk/security/provisioning/SConscript +++ b/resource/csdk/security/provisioning/SConscript @@ -116,6 +116,6 @@ provisioning_env.UserInstallTargetLib(provisioningserver, 'libocpmapi') if env.get('DTLS_WITH_X509') == '1': SConscript('ck_manager/SConscript') -if target_os in ['linux']: +if target_os in ['linux', 'tizen']: SConscript('sample/SConscript') diff --git a/resource/csdk/security/provisioning/sample/SConscript b/resource/csdk/security/provisioning/sample/SConscript index 87a1970..74e4568 100644 --- a/resource/csdk/security/provisioning/sample/SConscript +++ b/resource/csdk/security/provisioning/sample/SConscript @@ -70,17 +70,18 @@ provisioningclient = provisioning_env.Program('provisioningclient', 'provisionin sampleserver_justworks = provisioning_env.Program('sampleserver_justworks', 'sampleserver_justworks.cpp') sampleserver_randompin = provisioning_env.Program('sampleserver_randompin', 'sampleserver_randompin.cpp') -Alias("samples", [provisioningclient, sampleserver_justworks, sampleserver_randompin]) - -provisioning_env.AppendTarget('samples') - src_dir = provisioning_env.get('SRC_DIR') sec_provisioning_src_dir = src_dir + '/resource/csdk/security/provisioning/sample/' sec_provisioning_build_dir = env.get('BUILD_DIR') +'/resource/csdk/security/provisioning/sample/' -provisioning_env.Alias("install", provisioning_env.Install( sec_provisioning_build_dir, - sec_provisioning_src_dir + 'oic_svr_db_client.json')) -provisioning_env.Alias("install", provisioning_env.Install( sec_provisioning_build_dir, - sec_provisioning_src_dir + 'oic_svr_db_server_justworks.json')) -provisioning_env.Alias("install", provisioning_env.Install( sec_provisioning_build_dir, - sec_provisioning_src_dir + 'oic_svr_db_server_randompin.json')) +clientjson = provisioning_env.Install(sec_provisioning_build_dir, + sec_provisioning_src_dir + 'oic_svr_db_client.json') +justworksjson = provisioning_env.Install(sec_provisioning_build_dir, + sec_provisioning_src_dir + 'oic_svr_db_server_justworks.json') +randompinjson = provisioning_env.Install(sec_provisioning_build_dir, + sec_provisioning_src_dir+ 'oic_svr_db_server_randompin.json') + +Alias("samples", [provisioningclient, sampleserver_justworks, sampleserver_randompin, clientjson, justworksjson, randompinjson]) + +provisioning_env.AppendTarget('samples') + diff --git a/resource/provisioning/SConscript b/resource/provisioning/SConscript index 7108dbc..ad2f40b 100755 --- a/resource/provisioning/SConscript +++ b/resource/provisioning/SConscript @@ -46,7 +46,7 @@ if target_os == 'android': ocprovision_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) ocprovision_env.AppendUnique(LIBS = ['oc', 'octbstack', 'ocpmapi', 'oc_logger', 'boost_thread', 'gnustl_shared', 'log']) -if target_os == 'linux': +if target_os in ['linux', 'tizen']: ocprovision_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) ocprovision_env.AppendUnique(LIBS = ['oc', 'octbstack', 'ocpmapi', 'oc_logger', 'boost_thread']) @@ -63,6 +63,7 @@ ocprovision_src = [ ocprovision = ocprovision_env.SharedLibrary('ocprovision', ocprovision_src) ocprovision_env.InstallTarget(ocprovision, 'libocprovision') +ocprovision_env.UserInstallTargetLib(ocprovision, 'libocprovision') -if target_os in ['linux']: +if target_os in ['linux', 'tizen']: SConscript('examples/SConscript') diff --git a/resource/provisioning/examples/SConscript b/resource/provisioning/examples/SConscript index 598c451..8e9c696 100644 --- a/resource/provisioning/examples/SConscript +++ b/resource/provisioning/examples/SConscript @@ -91,11 +91,12 @@ if target_os in ['darwin', 'ios']: ###################################################################### provisioningclient = examples_env.Program('provisioningclient', 'provisioningclient.cpp') -Alias("examples", [provisioningclient]) -env.AppendTarget('examples') - src_dir = examples_env.get('SRC_DIR') svr_db_src_dir = src_dir + '/resource/provisioning/examples/' svr_db_build_dir = env.get('BUILD_DIR') +'/resource/provisioning/examples/' -examples_env.Alias("install", examples_env.Install( svr_db_build_dir, - svr_db_src_dir + 'oic_svr_db_client.json')) + +clientjson = examples_env.Install(svr_db_build_dir, svr_db_src_dir + 'oic_svr_db_client.json') + +Alias("examples", [provisioningclient, clientjson]) +env.AppendTarget('examples') + diff --git a/resource/src/SConscript b/resource/src/SConscript index 2fdc62a..0058bdc 100644 --- a/resource/src/SConscript +++ b/resource/src/SConscript @@ -113,5 +113,5 @@ oclib_env.UserInstallTargetHeader(header_dir + 'OCUtilities.h', 'resource', 'OCU oclib_env.UserInstallTargetHeader(header_dir + 'CAManager.h', 'resource', 'CAManager.h') # Add Provisioning library -if target_os in ['linux', 'android'] and env.get('SECURED') == '1': +if target_os in ['linux', 'android', 'tizen'] and env.get('SECURED') == '1': SConscript('../provisioning/SConscript') diff --git a/service/easy-setup/enrollee/SConscript b/service/easy-setup/enrollee/SConscript index 8b19cb1..0ee8b10 100644 --- a/service/easy-setup/enrollee/SConscript +++ b/service/easy-setup/enrollee/SConscript @@ -125,22 +125,23 @@ if target_os == 'linux': enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrollee') if target_os == 'tizen': - enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', - [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi/networkhandler.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi/softapnative.cpp']) + enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', [ + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi/networkhandler.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi/softapnative.cpp']) enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrolleeSDK') + enrollee_env.UserInstallTargetLib(enrollee_sdk_shared, 'libESEnrolleeSDK') if target_os == 'arduino': es_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK', [ - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.cpp', - enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp']) + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.cpp', + enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp']) enrollee_env.InstallTarget(es_sdk_static, 'libESEnrolleeSDK') #Go to build sample apps diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh index b8eff08..5479bcc 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh @@ -42,6 +42,7 @@ cp ./extra_options.scons $sourcedir/tmp cp ./tools/tizen/*.spec ./tmp/packaging cp ./tools/tizen/*.manifest ./tmp/packaging cp ./SConstruct ./tmp +cp ./LICENSE.md ./tmp # copy dependency RPMs and conf files for tizen build cp ./tools/tizen/*.rpm ./tmp @@ -65,7 +66,7 @@ if [ ! -d .git ]; then fi echo "Calling core gbs build command" -gbscommand="gbs build -A armv7l --include-all --repository ./ --define 'TARGET_TRANSPORT IP' --define 'SECURED 0' --define 'RELEASE 0' --define 'LOGGING true'" +gbscommand="gbs build -A armv7l --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $5' --define 'LOGGING $6' --define 'ES_ROLE $7' --define 'ES_TARGET_ENROLLEE $8' --define 'ES_SOFTAP_MODE $9'" echo $gbscommand if eval $gbscommand; then echo "Core build is successful" diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp index caf0020..fac4c5d 100755 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp @@ -21,6 +21,7 @@ #include "easysetup.h" +#include #include #include #include diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript index a5ed7e2..bc58c75 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript @@ -45,7 +45,6 @@ env.Append(LIBS=['octbstack','connectivity_abstraction','coap', 'libESEnrolleeSD if secured == '1': env.PrependUnique(CPPPATH = [root_dir + '/external/inc/']) env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__']) - env.Append(LIBS=['-ltinydtls']) env.Program('enrollee_wifi', [sample_dir + 'enrolleewifi.cpp']) diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt b/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt index 357b824..9ff6ebc 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt @@ -24,20 +24,16 @@ Build Procedure 1) If you are building first time, then delete GBS-ROOT folder from home directory. Note: Default build server URL for Tizen is set in gbs configuration file @ iotivity/tools/tizen/.gbs.conf. If needed, same can be modified as per appropriate target. -2) Make the changes to spec file. - File name: iotivity/tools/tizen/iotivity.spec - Attributes to change[line no. 28~32] : - attribute value - es_target_enrollee tizen - es_role enrollee - softap_mode ENROLLEE_SOFTAP -3) Go to "iotivity/" folder. -4) Execute following command(s) to start build based on transport selection required : +2) Go to "iotivity/" folder. +3) Execute following command(s) to start build based on transport selection required : scons -f service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP ROUTING=EP RELEASE=0 LOGGING=true ES_ROLE=enrollee ES_TARGET_ENROLLEE=android ES_SOFTAP_MODE=ENROLLEE_SOFTAP +4) If built for security mode: + After installing sample RPM on device, copy required json files and other applications to the same path where enrollee_wifi(executable) is available + (If needed, modify the parameters accordingly) Note :- Upon successful execution of above command(s) RI library and sample console application(for tizen enrollee) will be generated at path "~/GBS-ROOT/local/repos//armv7l/RPMS". diff --git a/tools/tizen/iotivity.spec b/tools/tizen/iotivity.spec index 0bdc29b..076e540 100644 --- a/tools/tizen/iotivity.spec +++ b/tools/tizen/iotivity.spec @@ -38,6 +38,9 @@ Requires(post): /sbin/ldconfig %{!?SECURED: %define SECURED 0} %{!?LOGGING: %define LOGGING True} %{!?ROUTING: %define ROUTING GW} +%{!?ES_TARGET_ENROLLEE: %define ES_TARGET_ENROLLEE tizen} +%{!?ES_ROLE: %define ES_ROLE enrollee} +%{!?ES_SOFTAP_MODE: %define ES_SOFTAP_MODE MEDIATOR_SOFTAP} %description An open source reference implementation of the OIC standard specifications @@ -107,6 +110,7 @@ cp %{SOURCE1001} ./%{name}-test.manifest scons -j2 --prefix=%{_prefix} \ TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \ RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \ + ES_TARGET_ENROLLEE=%{ES_TARGET_ENROLLEE} ES_ROLE=%{ES_ROLE} ES_SOFTAP_MODE=%{ES_SOFTAP_MODE} \ LIB_INSTALL_DIR=%{_libdir} @@ -116,6 +120,7 @@ CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; scons install --install-sandbox=%{buildroot} --prefix=%{_prefix} \ TARGET_OS=tizen TARGET_ARCH=%{RPM_ARCH} TARGET_TRANSPORT=%{TARGET_TRANSPORT} \ RELEASE=%{RELEASE} SECURED=%{SECURED} LOGGING=%{LOGGING} ROUTING=%{ROUTING} \ + ES_TARGET_ENROLLEE=%{ES_TARGET_ENROLLEE} ES_ROLE=%{ES_ROLE} ES_SOFTAP_MODE=%{ES_SOFTAP_MODE} \ LIB_INSTALL_DIR=%{_libdir} @@ -149,8 +154,10 @@ cp out/tizen/*/%{build_mode}/resource/examples/simpleserverHQ %{ex_install_dir} cp out/tizen/*/%{build_mode}/resource/examples/threadingsample %{ex_install_dir} cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_server.json %{ex_install_dir} cp out/tizen/*/%{build_mode}/resource/examples/oic_svr_db_client.json %{ex_install_dir} +cp out/tizen/*/%{build_mode}/libcoap.a %{buildroot}%{_libdir} %if 0%{?SECURED} == 1 mkdir -p %{ex_install_dir}/provisioning +mkdir -p %{ex_install_dir}/provision-sample cp out/tizen/*/%{build_mode}/resource/provisioning/examples/oic_svr_db_client.json %{ex_install_dir}/provisioning/ cp out/tizen/*/%{build_mode}/resource/provisioning/examples/provisioningclient %{ex_install_dir}/provisioning/ @@ -162,7 +169,8 @@ cp ./resource/csdk/security/provisioning/include/*.h %{buildroot}%{_includedir} cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/provisioningclient %{ex_install_dir}/provision-sample/ cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_justworks %{ex_install_dir}/provision-sample/ cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_randompin %{ex_install_dir}/provision-sample/ -cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/*.json %{ex_install_dir}/provision-sample/ +cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/oic_svr_db_client.json %{ex_install_dir}/provision-sample/ +cp out/tizen/*/%{build_mode}/resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.json %{ex_install_dir}/provision-sample/ %endif @@ -173,6 +181,7 @@ cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-service cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-test %endif cp resource/c_common/*.h %{buildroot}%{_includedir} +cp resource/csdk/stack/include/*.h %{buildroot}%{_includedir} cp service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir} cp service/easy-setup/inc/*.h %{buildroot}%{_includedir} @@ -209,6 +218,11 @@ cp service/easy-setup/enrollee/inc/*.h %{buildroot}%{_includedir} %{_libdir}/librcs_common.so %{_libdir}/librcs_container.so %{_libdir}/librcs_server.so +%{_libdir}/libESEnrolleeSDK.so +%if 0%{?SECURED} == 1 +%{_libdir}/libocpmapi.so +%{_libdir}/libocprovision.so +%endif %if 0%{?tizen_version_major} < 3 %{_datadir}/license/%{name}-service %else