aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_amount_lib.h3
-rw-r--r--src/include/taler_crypto_lib.h60
-rw-r--r--src/include/taler_extensions.h35
3 files changed, 83 insertions, 15 deletions
diff --git a/src/include/taler_amount_lib.h b/src/include/taler_amount_lib.h
index c1f42e473..c6d2f474e 100644
--- a/src/include/taler_amount_lib.h
+++ b/src/include/taler_amount_lib.h
@@ -21,6 +21,9 @@
#ifndef TALER_AMOUNT_LIB_H
#define TALER_AMOUNT_LIB_H
+#include <stdint.h>
+#include "gnunet/gnunet_common.h"
+
#ifdef __cplusplus
extern "C"
{
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index c521541fe..7261d4de5 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -280,6 +280,37 @@ struct TALER_MasterSignatureP
struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
};
+/*
+ * @brief Type of a list of age groups, represented as bit mask.
+ *
+ * The bits set in the mask mark the edges at the beginning of a next age
+ * group. F.e. for the age groups
+ * 0-7, 8-9, 10-11, 12-14, 14-15, 16-17, 18-21, 21-*
+ * the following bits are set:
+ *
+ * 31 24 16 8 0
+ * | | | | |
+ * oooooooo oo1oo1o1 o1o1o1o1 ooooooo1
+ *
+ * A value of 0 means that the exchange does not support the extension for
+ * age-restriction.
+ */
+struct TALER_AgeMask
+{
+ uint32_t mask;
+};
+
+/**
+ * @brief Age restriction commitment of a coin.
+ */
+struct TALER_AgeHash
+{
+ /**
+ * The commitment is a SHA-256 hash code.
+ */
+ struct GNUNET_ShortHashCode shash;
+};
+
/**
* @brief Type of public keys for Taler coins. The same key material is used
@@ -292,6 +323,10 @@ struct TALER_CoinSpendPublicKeyP
*/
struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub;
+ /*
+ * If age restriction applies to the coin, it must come with a hash of the age commitment
+ */
+ struct TALER_AgeHash age_commitment_hash;
};
@@ -346,18 +381,6 @@ struct TALER_RefreshCommitmentP
/**
- * Age restriction commitment of a coin.
- */
-struct TALER_AgeHash
-{
- /**
- * The commitment is a SHA-256 hash code.
- */
- struct GNUNET_ShortHashCode shash;
-};
-
-
-/**
* Token used for access control to the merchant's unclaimed
* orders.
*/
@@ -569,7 +592,7 @@ struct TALER_DenominationPublicKey
/**
* Age restriction mask used for the key.
*/
- uint32_t age_mask;
+ struct TALER_AgeMask age_mask;
/**
* Details, depending on @e cipher.
@@ -631,6 +654,11 @@ struct TALER_CoinPublicInfo
struct TALER_DenominationHash denom_pub_hash;
/**
+ * Hash of the age commitment.
+ */
+ struct TALER_AgeHash age_commitment_hash;
+
+ /**
* (Unblinded) signature over @e coin_pub with @e denom_pub,
* which demonstrates that the coin is valid.
*/
@@ -880,7 +908,7 @@ TALER_blinded_denom_sig_cmp (
*/
void
TALER_denom_priv_to_pub (const struct TALER_DenominationPrivateKey *denom_priv,
- uint32_t age_mask,
+ const struct TALER_AgeMask age_mask,
struct TALER_DenominationPublicKey *denom_pub);
@@ -929,7 +957,6 @@ TALER_coin_ev_hash (const void *coin_ev,
/**
* Compute the hash of a coin.
- * FIXME-Oec: add age restriction hash here!
*
* @param coin_pub public key of the coin
* @param[out] coin_h where to write the hash
@@ -1020,6 +1047,9 @@ struct TALER_FreshCoin
*/
struct TALER_CoinSpendPrivateKeyP coin_priv;
+ /**
+ * FIXME-Oec: Age-verification vector, as pointer: Dyn alloc!
+ */
};
diff --git a/src/include/taler_extensions.h b/src/include/taler_extensions.h
new file mode 100644
index 000000000..c22a23b86
--- /dev/null
+++ b/src/include/taler_extensions.h
@@ -0,0 +1,35 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2014-2021 Taler Systems SA
+
+ TALER 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.
+
+ TALER 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
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file include/taler_extensions.h
+ * @brief Interface for extensions
+ * @author Özgür Kesim
+ */
+#ifndef TALER_EXTENSIONS_H
+#define TALER_EXTENSIONS_H
+
+/**
+ *
+ * @param cfg
+ * @param[out] mask for age restriction
+ * @return Error if extension for age restriction was set but age groups were
+ * invalid, OK otherwise.
+ */
+enum GNUNET_GenericReturnValue
+TALER_get_age_mask (const struct GNUNET_CONFIGURATION_Handle *cfg, struct
+ TALER_AgeMask *mask);
+
+#endif