Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F1841561
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
26 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/Makefile.am b/Makefile.am
index ff85e55b..418b4b34 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,209 +1,205 @@
#
# Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
#
# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
#
# This software licensed under GPL-2.0+
#
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \
config.guess config.sub missing install-sh \
ltmain.sh compile config.h.in config.h.in~ \
autoscan.log configure.scan test-driver \
m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 \
m4/ltsugar.m4 m4/ltversion.m4
include $(top_srcdir)/build-aux/check.mk
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4
SPEC = $(PACKAGE_NAME).spec
TARGZFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz
EXTRA_DIST = autogen.sh .version \
NOTES_TO_PACKAGE_MAINTAINERS \
$(SPEC).in build-aux
SUBDIRS = libnozzle libknet
if BUILD_MAN
SUBDIRS += man
endif
-if BUILD_POC
-SUBDIRS += poc-code
-endif
-
dist_doc_DATA = \
COPYING.applications \
COPYING.libraries \
COPYRIGHT \
README.licence \
README
all-local: $(SPEC)
clean-local:
rm -rf $(SPEC) cov*
distclean-local:
rm -f $(PACKAGE_NAME)-*.tar.* $(PACKAGE_NAME)-*.sha256* tag-*
## make rpm/srpm section.
$(SPEC): $(SPEC).in .version config.status
rm -f $@-t $@
date="`LC_ALL=C $(UTC_DATE_AT)$(SOURCE_EPOCH) "+%a %b %d %Y"`" && \
gvgver="`cd $(abs_srcdir); build-aux/git-version-gen --fallback $(VERSION) .tarball-version .gitarchivever`" && \
if [ "$$gvgver" = "`echo $$gvgver | sed 's/-/./'`" ];then \
rpmver="$$gvgver" && \
alphatag="" && \
dirty="" && \
numcomm="0"; \
else \
gitver="`echo $$gvgver | sed 's/\(.*\)\./\1-/'`" && \
rpmver=`echo $$gitver | sed 's/-.*//g'` && \
alphatag=`echo $$gvgver | sed 's/[^-]*-\([^-]*\).*/\1/'` && \
numcomm=`echo $$gitver | sed 's/[^-]*-\([^-]*\).*/\1/'` && \
dirty="" && \
if [ "`echo $$gitver | sed 's/^.*-dirty$$//g'`" = "" ];then \
dirty="dirty"; \
fi \
fi && \
if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \
if [ "$$numcomm" = "0" ]; then \
sed \
-e "s#@version@#$$rpmver#g" \
-e "s#%glo.*alpha.*##g" \
-e "s#%glo.*numcomm.*##g" \
-e "s#@dirty@#$$dirty#g" \
-e "s#@date@#$$date#g" \
$(abs_srcdir)/$@.in > $@-t; \
else \
sed \
-e "s#@version@#$$rpmver#g" \
-e "s#@alphatag@#$$alphatag#g" \
-e "s#@numcomm@#$$numcomm#g" \
-e "s#@dirty@#$$dirty#g" \
-e "s#@date@#$$date#g" \
$(abs_srcdir)/$@.in > $@-t; \
fi; \
if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi
if BUILD_SCTP
sed -i -e "s#@sctp@#bcond_without#g" $@-t
else
sed -i -e "s#@sctp@#bcond_with#g" $@-t
endif
if BUILD_CRYPTO_NSS
sed -i -e "s#@nss@#bcond_without#g" $@-t
else
sed -i -e "s#@nss@#bcond_with#g" $@-t
endif
if BUILD_CRYPTO_OPENSSL
sed -i -e "s#@openssl@#bcond_without#g" $@-t
else
sed -i -e "s#@openssl@#bcond_with#g" $@-t
endif
if BUILD_COMPRESS_ZLIB
sed -i -e "s#@zlib@#bcond_without#g" $@-t
else
sed -i -e "s#@zlib@#bcond_with#g" $@-t
endif
if BUILD_COMPRESS_LZ4
sed -i -e "s#@lz4@#bcond_without#g" $@-t
else
sed -i -e "s#@lz4@#bcond_with#g" $@-t
endif
if BUILD_COMPRESS_LZO2
sed -i -e "s#@lzo2@#bcond_without#g" $@-t
else
sed -i -e "s#@lzo2@#bcond_with#g" $@-t
endif
if BUILD_COMPRESS_LZMA
sed -i -e "s#@lzma@#bcond_without#g" $@-t
else
sed -i -e "s#@lzma@#bcond_with#g" $@-t
endif
if BUILD_COMPRESS_BZIP2
sed -i -e "s#@bzip2@#bcond_without#g" $@-t
else
sed -i -e "s#@bzip2@#bcond_with#g" $@-t
endif
if BUILD_COMPRESS_ZSTD
sed -i -e "s#@zstd@#bcond_without#g" $@-t
else
sed -i -e "s#@zstd@#bcond_with#g" $@-t
endif
if BUILD_LIBNOZZLE
sed -i -e "s#@libnozzle@#bcond_without#g" $@-t
else
sed -i -e "s#@libnozzle@#bcond_with#g" $@-t
endif
if BUILD_RUNAUTOGEN
sed -i -e "s#@runautogen@#bcond_without#g" $@-t
else
sed -i -e "s#@runautogen@#bcond_with#g" $@-t
endif
if OVERRIDE_RPM_DEBUGINFO
sed -i -e "s#@overriderpmdebuginfo@#bcond_without#g" $@-t
else
sed -i -e "s#@overriderpmdebuginfo@#bcond_with#g" $@-t
endif
if BUILD_RPM_DEBUGINFO
sed -i -e "s#@rpmdebuginfo@#bcond_without#g" $@-t
else
sed -i -e "s#@rpmdebuginfo@#bcond_with#g" $@-t
endif
if BUILD_MAN
sed -i -e "s#@buildman@#bcond_without#g" $@-t
else
sed -i -e "s#@buildman@#bcond_with#g" $@-t
endif
if INSTALL_TESTS
sed -i -e "s#@installtests@#bcond_without#g" $@-t
else
sed -i -e "s#@installtests@#bcond_with#g" $@-t
endif
sed -i -e "s#@defaultadmgroup@#$(DEFAULTADMGROUP)#g" $@-t
chmod a-w $@-t
mv $@-t $@
rm -f $@-t*
$(TARGZFILE):
$(MAKE) dist
RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
--define "_specdir $(abs_builddir)" \
--define "_builddir $(abs_builddir)" \
--define "_srcrpmdir $(abs_builddir)" \
--define "_rpmdir $(abs_builddir)"
srpm: clean
$(MAKE) $(SPEC) $(TARGZFILE)
rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
rpm: clean
$(MAKE) $(SPEC) $(TARGZFILE)
rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
# release/versioning
BUILT_SOURCES = .version
.version:
echo $(VERSION) > $@-t && mv $@-t $@
dist-hook: gen-ChangeLog
echo $(VERSION) > $(distdir)/.tarball-version
echo $(SOURCE_EPOCH) > $(distdir)/source_epoch
gen_start_date = 2000-01-01
.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d $(abs_srcdir)/.git; then \
LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog \
--since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
diff --git a/configure.ac b/configure.ac
index d3ff26dd..2ec8fd94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,392 +1,385 @@
#
# Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
#
# Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
# Federico Simoncelli <fsimon@kronosnet.org>
#
# This software licensed under GPL-2.0+
#
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
AC_PREREQ([2.63])
AC_INIT([kronosnet],
m4_esyscmd([build-aux/git-version-gen .tarball-version .gitarchivever]),
[devel@lists.kronosnet.org])
# Don't let AC_PROC_CC (invoked by AC_USE_SYSTEM_EXTENSIONS) replace
# undefined CFLAGS with -g -O2, overriding our special OPT_CFLAGS.
: ${CFLAGS=""}
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([1.13 dist-bzip2 dist-xz color-tests -Wno-portability subdir-objects])
LT_PREREQ([2.2.6])
# --enable-new-dtags: Use RUNPATH instead of RPATH.
# It is necessary to have this done before libtool does linker detection.
# See also: https://github.com/kronosnet/kronosnet/issues/107
# --as-needed: Modern systems have builtin ceil() making -lm superfluous but
# AC_SEARCH_LIBS can't detect this because it tests with a false prototype
AX_CHECK_LINK_FLAG([-Wl,--enable-new-dtags],
[AM_LDFLAGS=-Wl,--enable-new-dtags],
[AC_MSG_ERROR(["Linker support for --enable-new-dtags is required"])])
AX_CHECK_LINK_FLAG([-Wl,--as-needed], [AM_LDFLAGS="$AM_LDFLAGS -Wl,--as-needed"])
AC_SUBST([AM_LDFLAGS])
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$AM_LDFLAGS $LDFLAGS"
LT_INIT
LDFLAGS="$saved_LDFLAGS"
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([libknet/handle.c])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
AC_LANG([C])
if test "$prefix" = "NONE"; then
prefix="/usr"
if test "$localstatedir" = "\${prefix}/var"; then
localstatedir="/var"
fi
if test "$libdir" = "\${exec_prefix}/lib"; then
if test -e /usr/lib64; then
libdir="/usr/lib64"
else
libdir="/usr/lib"
fi
fi
fi
AC_PROG_AWK
AC_PROG_GREP
AC_PROG_SED
AC_PROG_CPP
AC_PROG_CC
AC_PROG_CC_C99
if test "x$ac_cv_prog_cc_c99" = "xno"; then
AC_MSG_ERROR(["C99 support is required"])
fi
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
AC_CHECK_PROGS([VALGRIND_EXEC], [valgrind])
AM_CONDITIONAL([HAS_VALGRIND], [test x$VALGRIND_EXEC != "x"])
AC_CHECK_PROGS([COVBUILD_EXEC], [cov-build])
AM_CONDITIONAL([HAS_COVBUILD], [test x$COVBUILD_EXEC != "x"])
AC_CHECK_PROGS([COVANALYZE_EXEC], [cov-analyze])
AM_CONDITIONAL([HAS_COVANALYZE], [test x$COVANALYZE_EXEC != "x"])
AC_CHECK_PROGS([COVFORMATERRORS_EXEC], [cov-format-errors])
AM_CONDITIONAL([HAS_COVFORMATERRORS], [test x$COVFORMATERRORS_EXEC != "x"])
# KNET_OPTION_DEFINES(stem,type,detection code)
# stem: enters name of option, Automake conditional and preprocessor define
# type: compress or crypto, determines where the default comes from
AC_DEFUN([KNET_OPTION_DEFINES],[
AC_ARG_ENABLE([$2-$1],[AS_HELP_STRING([--disable-$2-$1],[disable libknet $1 support])],,
[enable_$2_$1="$enable_$2_all"])
AM_CONDITIONAL([BUILD_]m4_toupper([$2_$1]),[test "x$enable_$2_$1" = xyes])
if test "x$enable_$2_$1" = xyes; then
$3
fi
AC_DEFINE_UNQUOTED([WITH_]m4_toupper([$2_$1]), [`test "x$enable_$2_$1" != xyes; echo $?`], $1 $2 [built in])
])
AC_ARG_ENABLE([man],
[AS_HELP_STRING([--disable-man],[disable man page creation])],,
[ enable_man="yes" ])
AM_CONDITIONAL([BUILD_MAN], [test x$enable_man = xyes])
AC_ARG_ENABLE([libknet-sctp],
[AS_HELP_STRING([--disable-libknet-sctp],[disable libknet SCTP support])],,
[ enable_libknet_sctp="yes" ])
AM_CONDITIONAL([BUILD_SCTP], [test x$enable_libknet_sctp = xyes])
AC_ARG_ENABLE([crypto-all],
[AS_HELP_STRING([--disable-crypto-all],[disable libknet all crypto modules support])],,
[ enable_crypto_all="yes" ])
KNET_OPTION_DEFINES([nss],[crypto],[PKG_CHECK_MODULES([nss], [nss])])
KNET_OPTION_DEFINES([openssl],[crypto],[PKG_CHECK_MODULES([openssl],[libcrypto])])
AC_ARG_ENABLE([compress-all],
[AS_HELP_STRING([--disable-compress-all],[disable libknet all compress modules support])],,
[ enable_compress_all="yes" ])
KNET_OPTION_DEFINES([zstd],[compress],[PKG_CHECK_MODULES([libzstd], [libzstd])])
KNET_OPTION_DEFINES([zlib],[compress],[PKG_CHECK_MODULES([zlib], [zlib])])
KNET_OPTION_DEFINES([lz4],[compress],[PKG_CHECK_MODULES([liblz4], [liblz4])])
KNET_OPTION_DEFINES([lzo2],[compress],[
PKG_CHECK_MODULES([lzo2], [lzo2],
[# work around broken pkg-config file in v2.10
AC_SUBST([lzo2_CFLAGS],[`echo $lzo2_CFLAGS | sed 's,/lzo *, ,'`])],
[AC_CHECK_HEADERS([lzo/lzo1x.h],
[AC_CHECK_LIB([lzo2], [lzo1x_decompress_safe],
[AC_SUBST([lzo2_LIBS], [-llzo2])])],
[AC_MSG_ERROR(["missing required lzo/lzo1x.h header"])])])
])
KNET_OPTION_DEFINES([lzma],[compress],[PKG_CHECK_MODULES([liblzma], [liblzma])])
KNET_OPTION_DEFINES([bzip2],[compress],[
PKG_CHECK_MODULES([bzip2], [bzip2],,
[AC_CHECK_HEADERS([bzlib.h],
[AC_CHECK_LIB([bz2], [BZ2_bzBuffToBuffCompress],
[AC_SUBST([bzip2_LIBS], [-lbz2])])],
[AC_MSG_ERROR(["missing required bzlib.h"])])])
])
AC_ARG_ENABLE([install-tests],
[AS_HELP_STRING([--enable-install-tests],[install tests])],,
[ enable_install_tests="no" ])
AM_CONDITIONAL([INSTALL_TESTS], [test x$enable_install_tests = xyes])
-AC_ARG_ENABLE([poc],
- [AS_HELP_STRING([--enable-poc],[enable building poc code])],,
- [ enable_poc="no" ])
-AM_CONDITIONAL([BUILD_POC], [test x$enable_poc = xyes])
-
AC_ARG_ENABLE([runautogen],
[AS_HELP_STRING([--enable-runautogen],[run autogen.sh])],,
[ enable_runautogen="no" ])
AM_CONDITIONAL([BUILD_RUNAUTOGEN], [test x$enable_runautogen = xyes])
override_rpm_debuginfo_option="yes"
AC_ARG_ENABLE([rpm-debuginfo],
[AS_HELP_STRING([--enable-rpm-debuginfo],[build debuginfo packages])],,
[ enable_rpm_debuginfo="no", override_rpm_debuginfo_option="no" ])
AM_CONDITIONAL([BUILD_RPM_DEBUGINFO], [test x$enable_rpm_debuginfo = xyes])
AM_CONDITIONAL([OVERRIDE_RPM_DEBUGINFO], [test x$override_rpm_debuginfo_option = xyes])
AC_ARG_ENABLE([libnozzle],
[AS_HELP_STRING([--enable-libnozzle],[libnozzle support])],,
[ enable_libnozzle="yes" ])
AM_CONDITIONAL([BUILD_LIBNOZZLE], [test x$enable_libnozzle = xyes])
# Checks for libraries.
AX_PTHREAD(,[AC_MSG_ERROR([POSIX threads support is required])])
saved_LIBS="$LIBS"
LIBS=
AC_SEARCH_LIBS([ceil], [m], , [AC_MSG_ERROR([ceil not found])])
AC_SUBST([m_LIBS], [$LIBS])
LIBS=
AC_SEARCH_LIBS([clock_gettime], [rt], , [AC_MSG_ERROR([clock_gettime not found])])
AC_SUBST([rt_LIBS], [$LIBS])
LIBS=
AC_SEARCH_LIBS([dlopen], [dl dld], , [AC_MSG_ERROR([dlopen not found])])
AC_SUBST([dl_LIBS], [$LIBS])
LIBS="$saved_LIBS"
# Check RTLD_DI_ORIGIN (not decalred by musl. glibc has it as an enum so cannot use ifdef)
AC_CHECK_DECL([RTLD_DI_ORIGIN], [AC_DEFINE([HAVE_RTLD_DI_ORIGIN], 1,
[define when RTLD_DI_ORIGIN is declared])], ,[[#include <dlfcn.h>]])
# OS detection
AC_MSG_CHECKING([for os in ${host_os}])
case "$host_os" in
*linux*)
AC_DEFINE_UNQUOTED([KNET_LINUX], [1], [Compiling for Linux platform])
AC_MSG_RESULT([Linux])
;;
*bsd*)
AC_DEFINE_UNQUOTED([KNET_BSD], [1], [Compiling for BSD platform])
AC_MSG_RESULT([BSD])
;;
*)
AC_MSG_ERROR([Unsupported OS? hmmmm])
;;
esac
# Checks for header files.
AC_CHECK_HEADERS([sys/epoll.h])
AC_CHECK_FUNCS([kevent])
# if neither sys/epoll.h nor kevent are present, we should fail.
if test "x$ac_cv_header_sys_epoll_h" = xno && test "x$ac_cv_func_kevent" = xno; then
AC_MSG_ERROR([Both epoll and kevent unavailable on this OS])
fi
if test "x$ac_cv_header_sys_epoll_h" = xyes && test "x$ac_cv_func_kevent" = xyes; then
AC_MSG_ERROR([Both epoll and kevent available on this OS, please contact the maintainers to fix the code])
fi
if test "x$enable_libknet_sctp" = xyes; then
AC_CHECK_HEADERS([netinet/sctp.h],, [AC_MSG_ERROR(["missing required SCTP headers"])])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
PKG_CHECK_MODULES([libqb], [libqb])
if test "x$enable_man" = "xyes"; then
AC_ARG_VAR([DOXYGEN], [override doxygen executable])
AC_CHECK_PROGS([DOXYGEN], [doxygen], [no])
if test "x$DOXYGEN" = xno; then
AC_MSG_ERROR(["Doxygen command not found"])
fi
AC_ARG_VAR([DOXYGEN2MAN], [override doxygen2man executable])
if test "x$cross_compiling" = "xno"; then
PKG_CHECK_VAR([libqb_PREFIX], [libqb], [prefix])
AC_PATH_PROG([DOXYGEN2MAN], [doxygen2man], [no], [$libqb_PREFIX/bin$PATH_SEPARATOR$PATH])
fi
if test "x$DOXYGEN2MAN" = "xno"; then
# required by doxyxml to build man pages dynamically
# Don't let AC_PROC_CC (invoked by AX_PROG_CC_FOR_BUILD) replace
# undefined CFLAGS_FOR_BUILD with -g -O2, overriding our special OPT_CFLAGS.
: ${CFLAGS_FOR_BUILD=""}
AX_PROG_CC_FOR_BUILD
saved_PKG_CONFIG="$PKG_CONFIG"
saved_ac_cv_path_PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
unset PKG_CONFIG ac_cv_path_PKG_CONFIG
AC_PATH_PROG([PKG_CONFIG], [pkg-config])
PKG_CHECK_MODULES([libqb_BUILD], [libqb])
PKG_CHECK_VAR([libqb_BUILD_PREFIX], [libqb], [prefix])
AC_PATH_PROG([DOXYGEN2MAN], [doxygen2man], [no], [$libqb_BUILD_PREFIX/bin$PATH_SEPARATOR$PATH])
if test "x$DOXYGEN2MAN" = "xno"; then
PKG_CHECK_MODULES([libxml_BUILD], [libxml-2.0])
DOXYGEN2MAN="\${abs_top_builddir}/man/doxyxml"
build_doxy=yes
fi
PKG_CONFIG="$saved_PKG_CONFIG"
ac_cv_path_PKG_CONFIG="$saved_ac_cv_path_PKG_CONFIG"
fi
AC_SUBST([DOXYGEN2MAN])
fi
AM_CONDITIONAL([BUILD_DOXYXML], [test "x$build_doxy" = "xyes"])
# checks for libnozzle
if test "x$enable_libnozzle" = xyes; then
if `echo $host_os | grep -q linux`; then
PKG_CHECK_MODULES([libnl], [libnl-3.0])
PKG_CHECK_MODULES([libnlroute], [libnl-route-3.0 >= 3.3], [],
[PKG_CHECK_MODULES([libnlroute], [libnl-route-3.0 < 3.3],
[AC_DEFINE_UNQUOTED([LIBNL3_WORKAROUND], [1], [Enable libnl < 3.3 build workaround])], [])])
fi
fi
# local options
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[enable debug build])])
AC_ARG_WITH([testdir],
[AS_HELP_STRING([--with-testdir=DIR],[path to /usr/lib../kronosnet/tests/ dir where to install the test suite])],
[ TESTDIR="$withval" ],
[ TESTDIR="$libdir/kronosnet/tests" ])
## do subst
AC_SUBST([TESTDIR])
# debug build stuff
if test "x${enable_debug}" = xyes; then
AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code])
OPT_CFLAGS="-O0"
else
OPT_CFLAGS="-O3"
fi
# gdb flags
if test "x${GCC}" = xyes; then
GDB_FLAGS="-ggdb3"
else
GDB_FLAGS="-g"
fi
DEFAULT_CFLAGS="-Werror -Wall -Wextra"
# manual overrides
# generates too much noise for stub APIs
UNWANTED_CFLAGS="-Wno-unused-parameter"
AC_SUBST([AM_CFLAGS],["$OPT_CFLAGS $GDB_FLAGS $DEFAULT_CFLAGS $UNWANTED_CFLAGS"])
AX_PROG_DATE
AS_IF([test "$ax_cv_prog_date_gnu_date:$ax_cv_prog_date_gnu_utc" = yes:yes],
[UTC_DATE_AT="date -u -d@"],
[AS_IF([test "x$ax_cv_prog_date_bsd_date" = xyes],
[UTC_DATE_AT="date -u -r"],
[AC_MSG_ERROR([date utility unable to convert epoch to UTC])])])
AC_SUBST([UTC_DATE_AT])
AC_ARG_VAR([SOURCE_EPOCH],[last modification date of the source])
AC_MSG_NOTICE([trying to determine source epoch])
AC_MSG_CHECKING([for source epoch in \$SOURCE_EPOCH])
AS_IF([test -n "$SOURCE_EPOCH"],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([for source epoch in source_epoch file])
AS_IF([test -e "$srcdir/source_epoch"],
[read SOURCE_EPOCH <"$srcdir/source_epoch"
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([for source epoch baked in by gitattributes export-subst])
SOURCE_EPOCH='$Format:%at$' # template for rewriting by git-archive
AS_CASE([$SOURCE_EPOCH],
[?Format:*], # was not rewritten
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([for source epoch in \$SOURCE_DATE_EPOCH])
AS_IF([test "x$SOURCE_DATE_EPOCH" != x],
[SOURCE_EPOCH="$SOURCE_DATE_EPOCH"
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([whether git log can provide a source epoch])
SOURCE_EPOCH=f${SOURCE_EPOCH#\$F} # convert into git log --pretty format
SOURCE_EPOCH=$(cd "$srcdir" && git log -1 --pretty=${SOURCE_EPOCH%$} 2>/dev/null)
AS_IF([test -n "$SOURCE_EPOCH"],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no, using current time and breaking reproducibility])
SOURCE_EPOCH=$(date +%s)])])],
[AC_MSG_RESULT([yes])]
)])
])
AC_MSG_NOTICE([using source epoch $($UTC_DATE_AT$SOURCE_EPOCH +'%F %T %Z')])
AC_CONFIG_FILES([
Makefile
libnozzle/Makefile
libnozzle/libnozzle.pc
libnozzle/tests/Makefile
libknet/Makefile
libknet/libknet.pc
libknet/tests/Makefile
man/Makefile
man/Doxyfile-knet
man/Doxyfile-nozzle
- poc-code/Makefile
- poc-code/iov-hash/Makefile
])
if test "x$VERSION" = "xUNKNOWN"; then
AC_MSG_ERROR([m4_text_wrap([
configure was unable to determine the source tree's current version. This
generally happens when using git archive (or the github download button)
generated tarball/zip file. In order to workaround this issue, either use git
clone https://github.com/kronosnet/kronosnet.git or use an official release
tarball, available at https://kronosnet.org/releases/. Alternatively you
can add a compatible version in a .tarball-version file at the top of the
source tree, wipe your autom4te.cache dir and generated configure, and rerun
autogen.sh.
], [ ], [ ], [76])])
fi
AC_OUTPUT
diff --git a/poc-code/Makefile.am b/poc-code/Makefile.am
deleted file mode 100644
index 6c03b49a..00000000
--- a/poc-code/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+
-#
-
-MAINTAINERCLEANFILES = Makefile.in
-
-include $(top_srcdir)/build-aux/check.mk
-
-SUBDIRS = iov-hash
diff --git a/poc-code/iov-hash/.gitignore b/poc-code/iov-hash/.gitignore
deleted file mode 100644
index 1f05f557..00000000
--- a/poc-code/iov-hash/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-nss_hash
diff --git a/poc-code/iov-hash/Makefile.am b/poc-code/iov-hash/Makefile.am
deleted file mode 100644
index ed76e412..00000000
--- a/poc-code/iov-hash/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
-#
-# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
-#
-# This software licensed under GPL-2.0+
-#
-
-MAINTAINERCLEANFILES = Makefile.in
-
-include $(top_srcdir)/build-aux/check.mk
-
-# override global LIBS that pulls in lots of craft we don't need here
-LIBS =
-
-noinst_PROGRAMS = nss_hash
-
-nss_hash_SOURCES = main.c
-
-nss_hash_CFLAGS = $(AM_CFLAGS) $(nss_CFLAGS)
-
-nss_hash_LDADD = $(nss_LIBS)
diff --git a/poc-code/iov-hash/main.c b/poc-code/iov-hash/main.c
deleted file mode 100644
index b3efae34..00000000
--- a/poc-code/iov-hash/main.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2016-2020 Red Hat, Inc. All rights reserved.
- *
- * Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
- *
- * This software licensed under GPL-2.0+
- */
-
-/* Example code to illustrate DES enccryption/decryption using NSS.
- * The example skips the details of obtaining the Key & IV to use, and
- * just uses a hardcoded Key & IV.
- * Note: IV is only needed if Cipher Blocking Chaining (CBC) mode of encryption
- * is used
- *
- * The recommended approach is to store and transport WRAPPED (encrypted)
- * DES Keys (IVs can be in the clear). However, it is a common (and dangerous)
- * practice to use raw DES Keys. This example shows the use of a RAW key.
- */
-
-#ifdef BUILDCRYPTONSS
-#include <nss.h>
-#include <pk11pub.h>
-#include <prerror.h>
-#include <blapit.h>
-
-/* example Key & IV */
-unsigned char gKey[] = {0xe8, 0xa7, 0x7c, 0xe2, 0x05, 0x63, 0x6a, 0x31};
-unsigned char gIV[] = {0xe4, 0xbb, 0x3b, 0xd3, 0xc3, 0x71, 0x2e, 0x58};
-
-int main(int argc, char **argv)
-{
- CK_MECHANISM_TYPE hashMech;
- PK11SlotInfo* slot = NULL;
- PK11SymKey* SymKey = NULL;
- SECItem SecParam;
- PK11Context* HashContext = NULL;
- SECItem keyItem;
- SECStatus rv, rv1, rv2;
- unsigned char buf1[1024], buf2[1024];
- char data[1024];
- unsigned int i;
- unsigned int tmp2_outlen;
-
- /* Initialize NSS
- * * If your application code has already initialized NSS, you can skip it
- * * here.
- * * This code uses the simplest of the Init functions, which does not
- * * require a NSS database to exist
- * */
- rv = NSS_NoDB_Init(".");
- if (rv != SECSuccess)
- {
- fprintf(stderr, "NSS initialization failed (err %d)\n",
- PR_GetError());
- goto out;
- }
-
- /* choose mechanism: CKM_DES_CBC_PAD, CKM_DES3_ECB, CKM_DES3_CBC.....
- * * Note that some mechanisms (*_PAD) imply the padding is handled for you
- * * by NSS. If you choose something else, then data padding is the
- * * application's responsibility
- * */
- hashMech = CKM_SHA_1_HMAC;
- slot = PK11_GetBestSlot(hashMech, NULL);
- /* slot = PK11_GetInternalKeySlot(); is a simpler alternative but in
- * * theory, it *may not* return the optimal slot for the operation. For
- * * DES ops, Internal slot is typically the best slot
- * */
- if (slot == NULL)
- {
- fprintf(stderr, "Unable to find security device (err %d)\n",
- PR_GetError());
- goto out;
- }
-
- /* NSS passes blobs around as SECItems. These contain a pointer to
- * * data and a length. Turn the raw key into a SECItem. */
- keyItem.type = siBuffer;
- keyItem.data = gKey;
- keyItem.len = sizeof(gKey);
-
- /* Turn the raw key into a key object. We use PK11_OriginUnwrap
- * * to indicate the key was unwrapped - which is what should be done
- * * normally anyway - using raw keys isn't a good idea */
- SymKey = PK11_ImportSymKey(slot, hashMech, PK11_OriginUnwrap, CKA_SIGN,
- &keyItem, NULL);
- if (SymKey == NULL)
- {
- fprintf(stderr, "Failure to import key into NSS (err %d)\n",
- PR_GetError());
- goto out;
- }
-
- SecParam.type = siBuffer;
- SecParam.data = 0;
- SecParam.len = 0;
-
- /* sample data we'll hash */
- strcpy(data, "Hash me!");
- fprintf(stderr, "Clear Data: %s\n", data);
-
- /* ========================= START SECTION ============================= */
- /* If using the the same key and iv over and over, stuff before this */
- /* section and after this section needs to be done only ONCE */
-
- /* Create cipher context */
- HashContext = PK11_CreateContextBySymKey(hashMech, CKA_SIGN,
- SymKey, &SecParam);
-
- if (!HashContext) {
- fprintf(stderr, "no hash context today?\n");
- goto out;
- }
-
- if (PK11_DigestBegin(HashContext) != SECSuccess) {
- fprintf(stderr, "hash doesn't begin?\n");
- goto out;
- }
-
- rv1 = PK11_DigestOp(HashContext, (unsigned char *)data, strlen(data)+1);
-
- rv2 = PK11_DigestFinal(HashContext, buf2, &tmp2_outlen, SHA1_BLOCK_LENGTH);
-
- PK11_DestroyContext(HashContext, PR_TRUE);
- if (rv1 != SECSuccess || rv2 != SECSuccess)
- goto out;
-
- fprintf(stderr, "Hash Data: ");
- for (i=0; i<tmp2_outlen; i++)
- fprintf(stderr, "%02x ", buf2[i]);
- fprintf(stderr, "\n");
-
- /* =========================== END SECTION ============================= */
-
- /* ========================= START SECTION ============================= */
- /* If using the the same key and iv over and over, stuff before this */
- /* section and after this section needs to be done only ONCE */
-
- memset(buf1, 0, sizeof(buf1));
- memset(buf2, 0, sizeof(buf2));
-
- /* Create cipher context */
- HashContext = PK11_CreateContextBySymKey(hashMech, CKA_SIGN,
- SymKey, &SecParam);
-
- if (!HashContext) {
- fprintf(stderr, "no hash context today?\n");
- goto out;
- }
-
- if (PK11_DigestBegin(HashContext) != SECSuccess) {
- fprintf(stderr, "hash doesn't begin?\n");
- goto out;
- }
-
- rv1 = PK11_DigestOp(HashContext, (unsigned char *)data, 5);
- rv1 = PK11_DigestOp(HashContext, (unsigned char *)data+5, 4);
-
- rv2 = PK11_DigestFinal(HashContext, buf2, &tmp2_outlen, SHA1_BLOCK_LENGTH);
-
- PK11_DestroyContext(HashContext, PR_TRUE);
- if (rv1 != SECSuccess || rv2 != SECSuccess)
- goto out;
-
- fprintf(stderr, "Hash Data: ");
- for (i=0; i<tmp2_outlen; i++)
- fprintf(stderr, "%02x ", buf2[i]);
- fprintf(stderr, "\n");
-
- /* =========================== END SECTION ============================= */
-
-
-out:
- if (SymKey)
- PK11_FreeSymKey(SymKey);
-
- return 0;
-
-}
-#else
-#include <stdio.h>
-
-int main(void)
-{
- printf("you need nss build for this PoC to work\n");
- return 0;
-}
-#endif
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 23, 5:48 AM (10 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1012383
Default Alt Text
(26 KB)
Attached To
Mode
rK kronosnet
Attached
Detach File
Event Timeline
Log In to Comment