commit c59bc3e2ae2bc169d0b1898d692166e546004fdd
parent acb897dd97da52174f5c407549f65841b048a47a
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 13 Nov 2023 14:50:26 +0100
add GANA
Diffstat:
15 files changed, 207 insertions(+), 11 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -6,3 +6,4 @@ config.log
configure
configure~
taler_config.h.in~
+src/include/donau_signatures.h
diff --git a/.gitmodules b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "contrib/gana"]
+ path = contrib/gana
+ url = https://git.gnunet.org/gana.git
diff --git a/aclocal.m4 b/aclocal.m4
@@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
@@ -108,7 +108,7 @@ dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-dnl only at the first occurence in configure.ac, so if the first place
+dnl only at the first occurrence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
@@ -177,14 +177,14 @@ if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
- $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
- $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
- # Put the nasty error message in config.log where it belongs
- echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
- m4_default([$4], [AC_MSG_ERROR(
+ m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
@@ -196,7 +196,7 @@ _PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
- m4_default([$4], [AC_MSG_FAILURE(
+ m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
@@ -206,10 +206,10 @@ _PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
- $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
- $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
- $3
+ $3
fi[]dnl
])dnl PKG_CHECK_MODULES
@@ -296,6 +296,74 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
+dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------
+dnl
+dnl Prepare a "--with-" configure option using the lowercase
+dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
+dnl PKG_CHECK_MODULES in a single macro.
+AC_DEFUN([PKG_WITH_MODULES],
+[
+m4_pushdef([with_arg], m4_tolower([$1]))
+
+m4_pushdef([description],
+ [m4_default([$5], [build with ]with_arg[ support])])
+
+m4_pushdef([def_arg], [m4_default([$6], [auto])])
+m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
+m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
+
+m4_case(def_arg,
+ [yes],[m4_pushdef([with_without], [--without-]with_arg)],
+ [m4_pushdef([with_without],[--with-]with_arg)])
+
+AC_ARG_WITH(with_arg,
+ AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
+ [AS_TR_SH([with_]with_arg)=def_arg])
+
+AS_CASE([$AS_TR_SH([with_]with_arg)],
+ [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
+ [auto],[PKG_CHECK_MODULES([$1],[$2],
+ [m4_n([def_action_if_found]) $3],
+ [m4_n([def_action_if_not_found]) $4])])
+
+m4_popdef([with_arg])
+m4_popdef([description])
+m4_popdef([def_arg])
+
+])dnl PKG_WITH_MODULES
+
+dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl -----------------------------------------------
+dnl
+dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
+dnl check._[VARIABLE-PREFIX] is exported as make variable.
+AC_DEFUN([PKG_HAVE_WITH_MODULES],
+[
+PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
+
+AM_CONDITIONAL([HAVE_][$1],
+ [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
+])dnl PKG_HAVE_WITH_MODULES
+
+dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------------------
+dnl
+dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
+dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
+dnl and preprocessor variable.
+AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
+[
+PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
+
+AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
+ [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
+])dnl PKG_HAVE_DEFINE_WITH_MODULES
+
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
diff --git a/bootstrap b/bootstrap
@@ -11,6 +11,10 @@ fi
echo "$0: Updating submodules"
echo | git submodule update --init --force --remote
+# Generate based on pinned submodule
+./contrib/gana-generate.sh
+
+
# This is more portable than `which' but comes with
# the caveat of not(?) properly working on busybox's ash:
existence()
diff --git a/contrib/gana b/contrib/gana
@@ -0,0 +1 @@
+Subproject commit 235075f0b21536d3d1c3dd6c2b2b1709555c82e0
diff --git a/contrib/gana-generate.sh b/contrib/gana-generate.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# This file is in the public domain.
+#
+# Helper script to recompute error codes based on submodule
+# Run from exchange/ main directory.
+set -eu
+
+domake ()
+{
+ # $1 -- dir under contrib/
+ dir="contrib/$1"
+
+ make -C $dir
+}
+
+ensure ()
+{
+ # $1 -- filename
+ # $2 -- src dir under contrib/
+ # $3 -- dst dir under ./
+ fn="$1"
+ src="contrib/$2/$fn"
+ dst="./$3/$fn"
+
+ if ! diff $src $dst > /dev/null
+ then
+ test ! -f $dst || chmod +w $dst
+ cp $src $dst
+ chmod -w $dst
+ fi
+}
+
+domake sigp
+ensure donau_signatures.h sigp src/include
diff --git a/contrib/gana-latest.sh b/contrib/gana-latest.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Helper script to update to latest GANA
+# Run from exchange/ main directory.
+set -eu
+
+cd contrib/gana
+git pull origin master
+cd ../..
+
+exec ./contrib/gana-generate.sh
diff --git a/contrib/sigp/.gitignore b/contrib/sigp/.gitignore
@@ -0,0 +1,3 @@
+/registry.rec
+/taler_signatures.h
+/taler_signatures.h.tmp
diff --git a/contrib/sigp/Makefile b/contrib/sigp/Makefile
@@ -0,0 +1,21 @@
+FILES = donau_signatures.h
+
+gana = ../gana
+
+
+all: check $(FILES)
+check: registry.rec
+ recfix --check registry.rec
+registry.rec:
+ ln -s $(gana)/gnunet-signatures/registry.rec
+distclean:
+ rm -f *.tmp
+clean:
+ rm -f $(FILES) *.tmp registry.rec
+donau_signatures.h.tmp: registry.rec h.template
+ $(gana)/format.sh h.template 'Package = "Donau"' < registry.rec > $@
+
+donau_signatures.h: h.header donau_signatures.h.tmp h.footer
+ cat h.header donau_signatures.h.tmp h.footer > $@
+
+.PHONY: check clean distclean
diff --git a/contrib/sigp/README b/contrib/sigp/README
@@ -0,0 +1,10 @@
+This directory contains bootstrap code to extract info from the
+Signature Purposes database (registry) and format it in various ways.
+It is a peer of ${top_srcdir}/contrib/gana/ (q.v.).
+
+NB: New database entries MUST have field "Package: Donau" if
+ you want them to be visible to the Makefile in this directory.
+
+Don't make changes to registry.rec here (it is a symlink, after all).
+Instead, make them in ../gana/gnunet-signatures/ or from a separate
+checkout of the GANA Git repo (commit from there, too).
diff --git a/contrib/sigp/h.footer b/contrib/sigp/h.footer
@@ -0,0 +1,3 @@
+
+
+#endif
diff --git a/contrib/sigp/h.header b/contrib/sigp/h.header
@@ -0,0 +1,29 @@
+/*
+ This file is part of DONAU
+ Copyright (C) 2014-2022 Donau Systems SA
+
+ DONAU is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ DONAU is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ DONAU; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file donau_signatures.h
+ * @brief message formats and signature constants used to define
+ * the binary formats of signatures in Donau
+ *
+ * This file should define the constants and C structs that one needs
+ * to know to implement Donau clients (wallets or merchants or
+ * auditor) that need to produce or verify Donau signatures.
+ */
+#ifndef DONAU_SIGNATURES_H
+#define DONAU_SIGNATURES_H
+
+
+
diff --git a/contrib/sigp/h.template b/contrib/sigp/h.template
@@ -0,0 +1,6 @@
+
+
+/**
+ * {{Comment}}
+ */
+#define DONAU_SIGNATURE_{{Name}} {{Number}}
diff --git a/contrib/sigp/registry.rec b/contrib/sigp/registry.rec
@@ -0,0 +1 @@
+../gana/gnunet-signatures/registry.rec
+\ No newline at end of file
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
@@ -3,6 +3,7 @@ talerincludedir = $(includedir)/taler
talerinclude_HEADERS = \
donau_service.h \
+ donau_signatures.h \
donaudb_lib.h \
donaudb_plugin.h