From: José Bollo Date: Mon, 22 Sep 2014 16:02:58 +0000 (+0200) Subject: Adding signature checking X-Git-Tag: accepted/tizen/common/20140924.112649^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fsystem%2Ftizen-platform-config.git;a=commitdiff_plain;h=4367f56cdcd5dea828e2fa17a2b781e6395a9ee9 Adding signature checking The couple tizen-platform-wrapper/tizen-platform-config is intended to be a foundation of what is the tizen configuration. As such, each change of the set of keys SHOULD implies a full rebuild of tizen. It is what normally happens via the set of build dependencies. But some developper encountered problems because they were taking part of the system, having different versions of configuration. Especially, it happened was installing a fresh rpm built with GBS on an old image. This problem is reported in the following file: Bug-Tizen: TC-1626 This commit modify the behaviour of the generated library but doesn't modify its API. The new principle is to add a signup that it linked to the client and checked by the shared library. If the client's signup misfits library's one, a critical error is printed to using syslog and the program is aborted. Change-Id: If234efbcf998049c51246f58e94c06f706b40983 Signed-off-by: José Bollo --- diff --git a/configure.ac b/configure.ac index 4ff65ef..4acc6fc 100644 --- a/configure.ac +++ b/configure.ac @@ -11,8 +11,8 @@ AC_PROG_CC AM_PROG_AR LT_INIT([disable-static]) -AC_SUBST([LIBTZPLATFORM_CONFIG_SO_VERSION], [1:0:0]) -AC_SUBST([LIBTZPLATFORM_CONFIG_VERSION], [1.0]) +AC_SUBST([LIBTZPLATFORM_CONFIG_SO_VERSION], [2:0:0]) +AC_SUBST([LIBTZPLATFORM_CONFIG_VERSION], [2.0]) AC_CONFIG_FILES([ Makefile diff --git a/libtzplatform-config.pc.in b/libtzplatform-config.pc.in index 5698811..b985220 100644 --- a/libtzplatform-config.pc.in +++ b/libtzplatform-config.pc.in @@ -4,7 +4,7 @@ libdir=@libdir@ includedir=@includedir@ Name: @PACKAGE_NAME@ Description: Tizen Platform Config library. -Version: @PACKAGE_VERSION@ +Version: @LIBTZPLATFORM_CONFIG_VERSION@ URL: @PACKAGE_URL@ -Libs: -L${libdir} -ltzplatform-config-@LIBTZPLATFORM_CONFIG_VERSION@ +Libs: -L${libdir} -ltzplatform-config-static -ltzplatform-config-@LIBTZPLATFORM_CONFIG_VERSION@ Cflags: -I${includedir}/ diff --git a/packaging/tizen-platform-config.spec b/packaging/tizen-platform-config.spec index d6dd2c3..e611555 100644 --- a/packaging/tizen-platform-config.spec +++ b/packaging/tizen-platform-config.spec @@ -1,7 +1,8 @@ %define libname libtzplatform-config +%define keepstatic 1 Name: tizen-platform-config -Version: 1.0 +Version: 2.0 Release: 0 Summary: Tizen Platform Configuration License: MIT @@ -10,7 +11,7 @@ Group: System/Configuration Source0: %{name}-%{version}.tar.gz Source1: %{name}-rpmlintrc Source1001: %{name}.manifest -BuildRequires: tizen-platform-wrapper +BuildRequires: tizen-platform-wrapper >= 2 # the main package only contains a config file but other dependent packages # will contain binary. So, we can't build a noarch package and have to avoid @@ -49,7 +50,7 @@ Tizen Platform Configuration - helper program to lookup Tizen variables easily cp %{SOURCE1001} . %build -%reconfigure --disable-static +%reconfigure --enable-static %__make %{?_smp_mflags} %check @@ -78,6 +79,7 @@ cp %{SOURCE1001} . %{_libdir}/pkgconfig/*.pc %{_includedir}/*.h %config %{_sysconfdir}/rpm/macros.tizen-platform +%{_libdir}/*.a %files -n %{name}-tools %manifest %{name}.manifest diff --git a/src/Makefile.am b/src/Makefile.am index 0d2a594..8a5a105 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,10 +1,15 @@ lib_LTLIBRARIES = libtzplatform-config-@LIBTZPLATFORM_CONFIG_VERSION@.la +lib_LIBRARIES = libtzplatform-config-static.a + bin_PROGRAMS = tzplatform-get -wrappersrcdir=$(shell pkg-config --variable=srcdir tizen-platform-wrapper) +wrappersrcdir=$(shell pkg-config --variable=datadir tizen-platform-wrapper) + +SRC_FROMWRAPPER_STATIC= \ + static-api.c -SRC_FROMWRAPPER= \ +SRC_FROMWRAPPER_SHARED= \ buffer.h \ buffer.c \ foreign.h \ @@ -17,19 +22,34 @@ SRC_FROMWRAPPER= \ passwd.c \ scratch.h \ scratch.c \ - tzplatform_config.c \ + context.c \ + context.h \ + hashing.c \ + hashing.h \ + init.c \ + init.h \ + shared-api.c \ + shared-api.h \ + tzplatform_config.sym \ tzplatform_config.h +SRC_FROMWRAPPER=$(SRC_FROMWRAPPER_SHARED) $(SRC_FROMWRAPPER_STATIC) + SRC_FROMTOOL= \ tzplatform_variables.h \ + signup.inc \ hash.inc +CFLAGS += -fPIC + BUILT_SOURCES=$(SRC_FROMWRAPPER) $(SRC_FROMTOOL) CLEANFILES=$(SRC_FROMWRAPPER) $(SRC_FROMTOOL) -nodist_libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_SOURCES = \ - $(SRC_FROMWRAPPER) \ +libtzplatform_config_static_a_SOURCES = $(SRC_FROMWRAPPER_STATIC) + +libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_SOURCES = \ + $(SRC_FROMWRAPPER_SHARED) \ $(SRC_FROMTOOL) tizen-platform.conf: ../tizen-platform.meta @@ -44,8 +64,11 @@ tzplatform_variables.h: tizen-platform.conf hash.inc: tizen-platform.conf tzplatform-tool c $< >$@ +signup.inc: tizen-platform.conf + tzplatform-tool signup $< >$@ + libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_LDFLAGS = -version-info $(LIBTZPLATFORM_CONFIG_SO_VERSION) -libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_LDFLAGS += -export-symbols-regex tzplatform_.* +libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_LDFLAGS += -Wl,--version-script=tzplatform_config.sym libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_LDFLAGS += -Wl,-O3 libtzplatform_config_@LIBTZPLATFORM_CONFIG_VERSION@_la_LDFLAGS += -lpthread @@ -61,4 +84,7 @@ tzplatform_config_sysconfdir= $(sysconfdir)/rpm dist_tzplatform_config_sysconf_DATA=macros.tizen-platform tzplatform_get_SOURCES = tzplatform_get.c -tzplatform_get_LDADD = libtzplatform-config-@LIBTZPLATFORM_CONFIG_VERSION@.la +tzplatform_get_LDADD = libtzplatform-config-static.a libtzplatform-config-@LIBTZPLATFORM_CONFIG_VERSION@.la + + +