Compare commits

...

44 Commits

Author SHA1 Message Date
7624db4efd
-refactor TALER_AgeMask.mask -> TALER_AgeMask.bits
also: fix off-by-one in TALER_age_restriction_commit
2022-03-02 10:59:42 +01:00
4978b1e966
-amend missing parts to commit b20ddf0c8
- functions TALER_age_commitment_attest and
      TALER_age_commitment_verify
      implemented.
    - age restriction implementation moved into util/age_restriction.c
2022-03-02 07:58:55 +01:00
b20ddf0c8a
[age restriction] progress 17/n - attestation implemented
- functions TALER_age_commitment_attest and TALER_age_commitment_verify
  implemented.
- age restriction implementation moved into util/age_restriction.c
2022-03-01 19:30:57 +01:00
e9eb00e285
Refactoring TALER_AgeCommitment
Instead of a single struct TALER_AgeCommitment, we now use
 1. TALER_AgeCommitment for the age mask and list public keys for age
    restriciton.
 2. TALER_AgeProof for list of private keys for age restriction
 3. TALER_AgeCommitmentProof for the aggregation of the former two.

Also, we introduce TALER_AgeAttestation as the EDDSA signature to attest
a particular age group, along with the function prototypes
TALER_age_commitment_attest and TALER_age_commitment_verify.
2022-03-01 17:02:37 +01:00
Marco Boss
3716592add
Merge branch 'dev/boss/sharding' 2022-03-01 16:00:08 +01:00
Marco Boss
b4f7fef224
stay with partitions for now - find shards on dev/boss/sharding 2022-03-01 15:54:47 +01:00
Marco Boss
0eed0c0de2
tested shard creation locally 2022-03-01 14:01:42 +01:00
Marco Boss
afb1b5f902
prepare sharding / partitioning init
- create exchange-0001.sql with functions to create all tables and partitions / shards
- create exchange-0002.sql for the master db
2022-03-01 12:11:58 +01:00
Christian Grothoff
e24a6369aa
test-sync passes again 2022-02-28 23:18:40 +01:00
Christian Grothoff
a8d9e7e0a6
-more bool cleanup 2022-02-28 22:46:24 +01:00
Christian Grothoff
3d4e580699
work on auditor-sync update to latest DB 2022-02-28 22:41:24 +01:00
Christian Grothoff
ee79f31275
-work on test_sync.sh, incomplete 2022-02-28 22:41:24 +01:00
Marco Boss
0efc7fd524
cleaner sql 2022-02-28 22:32:59 +01:00
Christian Grothoff
23bc09fe3c
get test-auditor and #7181 to pass 2022-02-28 20:37:19 +01:00
Christian Grothoff
8f77bda2e0
-towards getting auditor tests to pass again with new logic 2022-02-28 16:13:30 +01:00
Christian Grothoff
d7bbf934a0
make DB generation work with new CS logic 2022-02-28 16:13:30 +01:00
Marco Boss
58eb3d95fc
towards adding shard/partitioning init functionality 2022-02-27 21:23:20 +01:00
Marco Boss
99dd36f7f6
add index on wire_targets
- better performance on local db
- many queries use wire_target_serial_id as join condition -> discussion use this as shard key?
2022-02-26 17:37:52 +01:00
Christian Grothoff
f11cab90ff
-add parens 2022-02-24 23:58:17 +01:00
Marco Boss
3d52f52164
Fix ON CONFLICT statements for distributed tables 2022-02-24 14:31:19 +01:00
Christian Grothoff
fd9ba53c49
make_coin_known can experience serialization failures, add retry logic 2022-02-24 13:53:19 +01:00
Christian Grothoff
10b9023575
-on conflict example 2022-02-24 10:16:10 +01:00
Christian Grothoff
5e5004020e
-fix aggregator with deferred constraint 2022-02-24 10:06:43 +01:00
Christian Grothoff
e253a5b055
-unique constraint is crucial 2022-02-24 09:06:15 +01:00
b244e23859
-make age commiment structs const in traits 2022-02-23 16:08:27 +01:00
7910ca183f
double melt test no works with age restriction
- added missing field h_age_commitment in exchange's error response
- slight refactoring
2022-02-22 18:35:10 +01:00
Christian Grothoff
fbdc1996a6
-use correct idx 2022-02-22 17:28:44 +01:00
Christian Grothoff
900b2d6fd9
-use correct idx 2022-02-22 17:26:27 +01:00
26158fc725
[age restriction] progress 16/n - refresh/reveal/link tests
Age restriction works now with withdraw, melt/refresh/reveal and link,
including tests.

However, there is still a problem with the tests:  The melting operation
"refresh-melt-failing-age" that should fail (because of conflict), but
currently fails for other reasons.  I decided to disable that particular
test (and the next) and submit the patch I have so far.
2022-02-22 14:34:47 +01:00
Christian Grothoff
0141a82161
-add CS-helpers to Debian package 2022-02-22 13:29:58 +01:00
3cd6156513
do not clamp EdDSA private keys 2022-02-21 16:08:45 +01:00
Christian Grothoff
544ba42f44
-big renaming of structs for consistent naming with P suffix 2022-02-21 00:23:23 +01:00
Christian Grothoff
19624fd776
-ensure different HKDF is used in melt vs. withdraw 2022-02-20 21:51:46 +01:00
Lucien Heuzeveldt
dbc5adba7f
add feedback to refresh in cs thesis 2022-02-20 21:33:08 +01:00
Christian Grothoff
bc150693de
-work around missing constraint, if not present 2022-02-20 19:26:01 +01:00
Thien-Thi Nguyen
e02c850acf
add libtalerextensions.la to _LDADD (two instances)
* src/benchmark/Makefile.am (taler_bank_benchmark_LDADD): ...here.
* src/exchange-tools/Makefile.am (taler_auditor_offline_LDADD): Likewise.
2022-02-19 21:36:08 -05:00
Thien-Thi Nguyen
82bdb6b1aa
Add m4 to compare version numbers
* m4/ax_compare_version.m4: New file (serial 13).
2022-02-19 21:12:17 -05:00
Thien-Thi Nguyen
4db0f22159
Update PostgreSQL m4
* m4/ax_lib_postgresql.m4: Update to serial 22.
2022-02-19 21:03:25 -05:00
Thien-Thi Nguyen
6e0e5c9a9d
Bump required PostgreSQL to 13.0 (per README)
* configure.ac (AX_LIB_POSTGRESQL): ...here.
2022-02-19 20:53:11 -05:00
Thien-Thi Nguyen
d00456fac7
spell it "PostgreSQL" 2022-02-19 20:52:15 -05:00
Christian Grothoff
3f23bede87
-bump version requirement 2022-02-19 21:34:50 +01:00
Christian Grothoff
bc3ec56373
reject wire deadline of 'never' (#7157) 2022-02-19 21:26:27 +01:00
Christian Grothoff
bccdf7e452
-reduce default fakebank memory allocation (see #7156) 2022-02-19 21:21:24 +01:00
Christian Grothoff
917b2f373e
-update GANA 2022-02-19 21:06:02 +01:00
137 changed files with 6789 additions and 3485 deletions

6
README
View File

@ -24,7 +24,7 @@ works fine. that does not work yet. This package also only includes
the Taler exchange, not the other components of the system. the Taler exchange, not the other components of the system.
Documentation about Taler can be found at https://taler.net/. Documentation about Taler can be found at https://taler.net/.
Our bug tracker is at https://gnunet.org/bugs/. Our bug tracker is at https://bugs.taler.net/.
Joining GNU Joining GNU
@ -43,9 +43,9 @@ Dependencies:
These are the direct dependencies for running a Taler exchange: These are the direct dependencies for running a Taler exchange:
- GNUnet >= 0.15.4 - GNUnet >= 0.16.0
- GNU libmicrohttpd >= 0.9.71 - GNU libmicrohttpd >= 0.9.71
- Postgres >= 9.5 - PostgreSQL >= 13.0

View File

@ -335,7 +335,7 @@ AS_IF([test $jansson = 0],
# test for postgres # test for postgres
AX_LIB_POSTGRESQL([9.3]) AX_LIB_POSTGRESQL([13.0])
AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true]) AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true])
TALER_LIB_LDFLAGS="-export-dynamic -no-undefined" TALER_LIB_LDFLAGS="-export-dynamic -no-undefined"

@ -1 +1 @@
Subproject commit f0deccc31022f5aa0eecfe4c9c173625f4a6d848 Subproject commit 24eb905bac48869b4184801571c0728c772b299c

View File

@ -2,6 +2,7 @@ usr/bin/taler-exchange-aggregator
usr/bin/taler-exchange-closer usr/bin/taler-exchange-closer
usr/bin/taler-exchange-dbinit usr/bin/taler-exchange-dbinit
usr/bin/taler-exchange-httpd usr/bin/taler-exchange-httpd
usr/bin/taler-exchange-secmod-cs
usr/bin/taler-exchange-secmod-eddsa usr/bin/taler-exchange-secmod-eddsa
usr/bin/taler-exchange-secmod-rsa usr/bin/taler-exchange-secmod-rsa
usr/bin/taler-exchange-transfer usr/bin/taler-exchange-transfer
@ -13,6 +14,7 @@ usr/share/man/man1/taler-exchange-dbinit*
usr/share/man/man1/taler-exchange-httpd* usr/share/man/man1/taler-exchange-httpd*
usr/share/man/man1/taler-exchange-secmod-eddsa* usr/share/man/man1/taler-exchange-secmod-eddsa*
usr/share/man/man1/taler-exchange-secmod-rsa* usr/share/man/man1/taler-exchange-secmod-rsa*
usr/share/man/man1/taler-exchange-secmod-cs*
usr/share/man/man1/taler-exchange-transfer* usr/share/man/man1/taler-exchange-transfer*
usr/share/man/man1/taler-exchange-wirewatch* usr/share/man/man1/taler-exchange-wirewatch*
usr/share/man/man1/taler-bank* usr/share/man/man1/taler-bank*

View File

@ -9,6 +9,7 @@ _GROUPNAME=taler-exchange-secmod
_DBGROUPNAME=taler-exchange-db _DBGROUPNAME=taler-exchange-db
_EUSERNAME=taler-exchange-httpd _EUSERNAME=taler-exchange-httpd
_CLOSERUSERNAME=taler-exchange-closer _CLOSERUSERNAME=taler-exchange-closer
_CSECUSERNAME=taler-exchange-secmod-cs
_RSECUSERNAME=taler-exchange-secmod-rsa _RSECUSERNAME=taler-exchange-secmod-rsa
_ESECUSERNAME=taler-exchange-secmod-eddsa _ESECUSERNAME=taler-exchange-secmod-eddsa
_AGGRUSERNAME=taler-exchange-aggregator _AGGRUSERNAME=taler-exchange-aggregator
@ -33,6 +34,9 @@ configure)
if ! getent passwd ${_RSECUSERNAME} >/dev/null; then if ! getent passwd ${_RSECUSERNAME} >/dev/null; then
adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_RSECUSERNAME} adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_RSECUSERNAME}
fi fi
if ! getent passwd ${_CSECUSERNAME} >/dev/null; then
adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_CSECUSERNAME}
fi
if ! getent passwd ${_ESECUSERNAME} >/dev/null; then if ! getent passwd ${_ESECUSERNAME} >/dev/null; then
adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_ESECUSERNAME} adduser --quiet --system --no-create-home --ingroup ${_GROUPNAME} --home ${TALER_HOME} ${_ESECUSERNAME}
fi fi

View File

@ -1,8 +1,8 @@
[Unit] [Unit]
Description=GNU Taler payment system exchange REST API Description=GNU Taler payment system exchange REST API
AssertPathExists=/run/taler/exchange-httpd AssertPathExists=/run/taler/exchange-httpd
Requires=taler-exchange-httpd.socket taler-exchange-secmod-rsa.service taler-exchange-secmod-eddsa.service Requires=taler-exchange-httpd.socket taler-exchange-secmod-cs.service taler-exchange-secmod-rsa.service taler-exchange-secmod-eddsa.service
After=postgres.service network.target taler-exchange-secmod-rsa.service taler-exchange-secmod-eddsa.service After=postgres.service network.target taler-exchange-secmod-cs.service taler-exchange-secmod-rsa.service taler-exchange-secmod-eddsa.service
PartOf=taler-exchange.target PartOf=taler-exchange.target
[Service] [Service]

View File

@ -0,0 +1,16 @@
[Unit]
Description=GNU Taler payment system exchange CS security module
AssertPathExists=/run/taler/exchange-secmod-cs
PartOf=taler-exchange.target
[Service]
User=taler-exchange-secmod-cs
Type=simple
Restart=always
RestartSec=100ms
ExecStart=/usr/bin/taler-exchange-secmod-cs -c /etc/taler/taler.conf
StandardOutput=journal
StandardError=journal
PrivateTmp=no
PrivateDevices=yes
ProtectSystem=full

View File

@ -111,12 +111,12 @@ The denomination key was chosen because it has the recopu protocol in place that
\\\text{generate withdraw secret:} \\\text{generate withdraw secret:}
\\ \omega := randombytes(32) \\ \omega := randombytes(32)
\\ \text{persist } \langle \omega, D_p \rangle \\ \text{persist } \langle \omega, D_p \rangle
\\ n_w := \text{HKDF}(256, \omega,\text{"n"}) \\ n_w := \text{HKDF}(256, \omega, \text{"n"})
\\ & \xrightarrow[\rule{2.5cm}{0pt}]{n_w, D_p} & \\ & \xrightarrow[\rule{2.5cm}{0pt}]{n_w, D_p} &
% generate R % generate R
\\ & & \text{verify if } D_p \text{ is valid} \\ & & \text{verify if } D_p \text{ is valid}
\\ & & r_0 := \text{HKDF}(256,n_w || d_s, \text{"r0"}) \\ & & r_0 := \text{HKDF}(256,n_w || d_s, \text{"wr0"})
\\ & & r_1 := \text{HKDF}(256,n_w || d_s, \text{"r1"}) \\ & & r_1 := \text{HKDF}(256,n_w || d_s, \text{"wr1"})
\\ & & R_0 := r_0G \\ & & R_0 := r_0G
\\ & & R_1 := r_1G \\ & & R_1 := r_1G
\\ & \xleftarrow[\rule{2.5cm}{0pt}]{R_0, R_1} & \\ & \xleftarrow[\rule{2.5cm}{0pt}]{R_0, R_1} &
@ -169,13 +169,13 @@ The denomination key was chosen because it has the recopu protocol in place that
\\ & & b := \text{HKDF}(1,n_w || d_s, \text{"b"}) \\ & & b := \text{HKDF}(1,n_w || d_s, \text{"b"})
\\ & & s \leftarrow \text{GetWithdraw}(n_w, D_p) \\ & & s \leftarrow \text{GetWithdraw}(n_w, D_p)
\\ & & \textbf{if } s = \bot \\ & & \textbf{if } s = \bot
\\ & & \textbf{check !} \text{NonceReuse} (n_w, D_p) \\ & & \textbf{check !} \text{NonceReuse} (n_w, D_p, \rho_W)
\\ & & r_b := \text{HKDF}(256,n_w || d_s, \text{"r}b\text{"}) \\ & & r_b := \text{HKDF}(256,n_w || d_s, \text{"r}b\text{"})
% sign coin % sign coin
\\ & & s := r_b + c_b d_s \mod p \\ & & s := r_b + c_b d_s \mod p
% the following db operations are atomic % the following db operations are atomic
\\ & & \text{decrease balance if sufficient and} \\ & & \text{decrease balance if sufficient and}
\\ & & \text{persist NonceUse } \langle n_w, D_p, s \rangle \\ & & \text{persist NonceUse } \langle n_w, D_p, \rho_W \rangle
\\ & & \text{persist } \langle D_p, s \rangle \\ & & \text{persist } \langle D_p, s \rangle
\\ & & \textbf{endif} \\ & & \textbf{endif}
\\ & \xleftarrow[\rule{2.5cm}{0pt}]{b,s} & \\ & \xleftarrow[\rule{2.5cm}{0pt}]{b,s} &
@ -265,23 +265,21 @@ In the reveal phase, the RSA signing and unblinding is exchanged with Schnorr's
\\ \text{coin}_0 = \langle D_{p(0)}, c_s^{(0)}, C_p^{(0)}, \sigma_c^{(0)} \rangle && \text{new denomination keys } d_s, D_P \\ \text{coin}_0 = \langle D_{p(0)}, c_s^{(0)}, C_p^{(0)}, \sigma_c^{(0)} \rangle && \text{new denomination keys } d_s, D_P
% request r % request r
\\ & & \\ & &
\\ \omega := randombytes(32) \\ n_r := randombytes(32)
\\ \text{persist } \langle \omega, D_p \rangle \\ \text{persist } \langle n_r, D_p \rangle
%\\ s_w := \text{HKDF}(256, c_s^{(0)},\text{"n"})
\\ n_r := \text{HKDF}(256, \omega,\text{"n"})
% sign with reserve sk % sign with reserve sk
\\ & \xrightarrow[\rule{2.5cm}{0pt}]{n_r, D_p} & \\ & \xrightarrow[\rule{2.5cm}{0pt}]{n_r, D_p} &
% generate R % generate R
\\ & & \text{verify if } D_p \text{ is valid} \\ & & \text{verify if } D_p \text{ is valid}
\\ & & r_0 := \text{HKDF}(256,n_r || d_s, \text{"r0"}) \\ & & r_0 := \text{HKDF}(256, n_r || d_s, \text{"mr0"})
\\ & & r_1 := \text{HKDF}(256,n_r || d_s, \text{"r1"}) \\ & & r_1 := \text{HKDF}(256, n_r || d_s, \text{"mr1"})
\\ & & R_0 := r_0G \\ & & R_0 := r_0G
\\ & & R_1 := r_1G \\ & & R_1 := r_1G
\\ & \xleftarrow[\rule{2cm}{0pt}]{R_0, R_1} & \\ & \xleftarrow[\rule{2cm}{0pt}]{R_0, R_1} &
% refresh request % refresh request
\\ \textbf{for } i = 1, \dots, \kappa: % generate k derives \\ \textbf{for } i = 1, \dots, \kappa: % generate k derives
%\\ s_i \leftarrow \{0,1\}^{256} % seed generation %\\ s_i \leftarrow \{0,1\}^{256} % seed generation
\\ t_i := \text{HKDF}(256, \omega || R_0 || R_1,\text{"t} i \text{"} ) % seed generation \\ t_i := \text{HKDF}(256, c_s^{(0)}, n_r || R_0 || R_1,\text{"t} i \text{"} ) % seed generation
\\ X_i := \text{RefreshDerive}(t_i, D_p, C_p^{(0)}, R_0, R_1) \\ X_i := \text{RefreshDerive}(t_i, D_p, C_p^{(0)}, R_0, R_1)
\\ (T_i, c_s^{(i)}, C_p^{(i)}, \overline{c_0}, \overline{c_1}):= X_i \\ (T_i, c_s^{(i)}, C_p^{(i)}, \overline{c_0}, \overline{c_1}):= X_i
\\ \textbf{endfor} \\ \textbf{endfor}
@ -293,7 +291,7 @@ In the reveal phase, the RSA signing and unblinding is exchanged with Schnorr's
\\ \rho_{RC} := \langle h_C, D_p, \text{ } D_{p(0)}, C_p^{(0)}, \sigma_C^{(0)} \rangle \\ \rho_{RC} := \langle h_C, D_p, \text{ } D_{p(0)}, C_p^{(0)}, \sigma_C^{(0)} \rangle
\\ \sigma_{RC} := \text{Ed25519.Sign}(c_s^{(0)}, \rho_{RC}) \\ \sigma_{RC} := \text{Ed25519.Sign}(c_s^{(0)}, \rho_{RC})
\\ \text{Persist refresh-request} \\ \text{Persist refresh-request}
\\ \langle \omega, R_0, R_1, \rho_{RC}, \sigma_{RC} \rangle \\ \langle n_r, R_0, R_1, \rho_{RC}, \sigma_{RC} \rangle
\\ \\
\\ & \textit{Continued in figure \ref{fig:refresh-commit-part2}} & \\ & \textit{Continued in figure \ref{fig:refresh-commit-part2}} &
\end{array}$ \end{array}$
@ -324,7 +322,7 @@ In the reveal phase, the RSA signing and unblinding is exchanged with Schnorr's
\\ & & v := \text{Denomination}(D_p) \\ & & v := \text{Denomination}(D_p)
\\ & & \textbf{check } \text{IsOverspending}(C_p^{(0)}, D_ {p(0)}, v) \\ & & \textbf{check } \text{IsOverspending}(C_p^{(0)}, D_ {p(0)}, v)
\\ & & \text{verify if } D_p \text{ is valid} \\ & & \text{verify if } D_p \text{ is valid}
\\ & & \textbf{check !} \text{NonceReuse} (n_r, D_p) \\ & & \textbf{check !} \text{NonceReuse} (n_r, D_p, \rho_{RC})
\\ & & \textbf{check } \text{Schnorr.Verify}(D_{p(0)}, C_p^{(0)}, \sigma_C^{(0)}) \\ & & \textbf{check } \text{Schnorr.Verify}(D_{p(0)}, C_p^{(0)}, \sigma_C^{(0)})
\\ & & \text{MarkFractionalSpend}(C_p^{(0)}, v) \\ & & \text{MarkFractionalSpend}(C_p^{(0)}, v)
\\ & & \gamma \leftarrow \{1, \dots, \kappa\} \\ & & \gamma \leftarrow \{1, \dots, \kappa\}
@ -366,7 +364,7 @@ In the reveal phase, the RSA signing and unblinding is exchanged with Schnorr's
\\ & & \langle T'_\gamma, \overline{c_0}_\gamma, \overline{c_1}_\gamma, S \rangle := \rho_{RR} \\ & & \langle T'_\gamma, \overline{c_0}_\gamma, \overline{c_1}_\gamma, S \rangle := \rho_{RR}
\\ & & \langle t_1,\dots,t_{\gamma-1},t_{\gamma+1},\dots,t_\kappa \rangle := S \\ & & \langle t_1,\dots,t_{\gamma-1},t_{\gamma+1},\dots,t_\kappa \rangle := S
\\ & & \textbf{check } \text{Ed25519.Verify}(C_p^{(0)}, \sigma_L, \rho_L) \\ & & \textbf{check } \text{Ed25519.Verify}(C_p^{(0)}, \sigma_L, \rho_L)
\\ & & b := \text{HKDF}(1,n_r || d_{s(i)}, \text{"b"}) \\ & & b := \text{HKDF}(1, n_r || d_{s(i)}, \text{"b"})
\\ & & \textbf{for } i = 1,\dots, \gamma-1, \gamma+1,\dots, \kappa \\ & & \textbf{for } i = 1,\dots, \gamma-1, \gamma+1,\dots, \kappa
\\ & & X_i := \text{RefreshDerive}(t_i, D_p, C_p^{(0)} \\ &&, R_0, R_1) \\ & & X_i := \text{RefreshDerive}(t_i, D_p, C_p^{(0)} \\ &&, R_0, R_1)
\\ & & \langle T_i, c_s^{(i)}, C_p^{(i)}, \overline{c_1}_i, \overline{c_2}_i \rangle := X_i \\ & & \langle T_i, c_s^{(i)}, C_p^{(i)}, \overline{c_1}_i, \overline{c_2}_i \rangle := X_i
@ -377,7 +375,7 @@ In the reveal phase, the RSA signing and unblinding is exchanged with Schnorr's
\\ & & h_{\overline{c}}' := H(h_{\overline{c_0}}, h_{\overline{c_1}}, n_r) \\ & & h_{\overline{c}}' := H(h_{\overline{c_0}}, h_{\overline{c_1}}, n_r)
\\ & & h_C' = H(h_T', h_{\overline{c}}') \\ & & h_C' = H(h_T', h_{\overline{c}}')
\\ & & \textbf{check } h_C = h_C' \\ & & \textbf{check } h_C = h_C'
\\ & & r_b := \text{HKDF}(256,n_r || d_s, \text{"r}b\text{"}) \\ & & r_b := \text{HKDF}(256, n_r || d_s, \text{"mr}b\text{"})
\\ & & \overline{s}_{C_p}^{(\gamma)} = r_b + \overline{c_{b_\gamma}} d_s \mod p \\ & & \overline{s}_{C_p}^{(\gamma)} = r_b + \overline{c_{b_\gamma}} d_s \mod p
\\ & & \text{persist } \langle \rho_L, \sigma_L, S \rangle \\ & & \text{persist } \langle \rho_L, \sigma_L, S \rangle
\\ & \xleftarrow[\rule{2.5cm}{0pt}]{b, \overline{s}_C^{(\gamma)}} & \\ & \xleftarrow[\rule{2.5cm}{0pt}]{b, \overline{s}_C^{(\gamma)}} &

177
m4/ax_compare_version.m4 Normal file
View File

@ -0,0 +1,177 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
#
# DESCRIPTION
#
# This macro compares two version strings. Due to the various number of
# minor-version numbers that can exist, and the fact that string
# comparisons are not compatible with numeric comparisons, this is not
# necessarily trivial to do in a autoconf script. This macro makes doing
# these comparisons easy.
#
# The six basic comparisons are available, as well as checking equality
# limited to a certain number of minor-version levels.
#
# The operator OP determines what type of comparison to do, and can be one
# of:
#
# eq - equal (test A == B)
# ne - not equal (test A != B)
# le - less than or equal (test A <= B)
# ge - greater than or equal (test A >= B)
# lt - less than (test A < B)
# gt - greater than (test A > B)
#
# Additionally, the eq and ne operator can have a number after it to limit
# the test to that number of minor versions.
#
# eq0 - equal up to the length of the shorter version
# ne0 - not equal up to the length of the shorter version
# eqN - equal up to N sub-version levels
# neN - not equal up to N sub-version levels
#
# When the condition is true, shell commands ACTION-IF-TRUE are run,
# otherwise shell commands ACTION-IF-FALSE are run. The environment
# variable 'ax_compare_version' is always set to either 'true' or 'false'
# as well.
#
# Examples:
#
# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
#
# would both be true.
#
# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
#
# would both be false.
#
# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
#
# would be true because it is only comparing two minor versions.
#
# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
#
# would be true because it is only comparing the lesser number of minor
# versions of the two values.
#
# Note: The characters that separate the version numbers do not matter. An
# empty string is the same as version 0. OP is evaluated by autoconf, not
# configure, so must be a string, not a variable.
#
# The author would like to acknowledge Guido Draheim whose advice about
# the m4_case and m4_ifvaln functions make this macro only include the
# portions necessary to perform the specific comparison specified by the
# OP argument in the final configure script.
#
# LICENSE
#
# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 13
dnl #########################################################################
AC_DEFUN([AX_COMPARE_VERSION], [
AC_REQUIRE([AC_PROG_AWK])
# Used to indicate true or false condition
ax_compare_version=false
# Convert the two version strings to be compared into a format that
# allows a simple string comparison. The end result is that a version
# string of the form 1.12.5-r617 will be converted to the form
# 0001001200050617. In other words, each number is zero padded to four
# digits, and non digits are removed.
AS_VAR_PUSHDEF([A],[ax_compare_version_A])
A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
AS_VAR_PUSHDEF([B],[ax_compare_version_B])
B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
dnl # then the first line is used to determine if the condition is true.
dnl # The sed right after the echo is to remove any indented white space.
m4_case(m4_tolower($2),
[lt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[gt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[le],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],
[ge],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],[
dnl Split the operator from the subversion count if present.
m4_bmatch(m4_substr($2,2),
[0],[
# A count of zero means use the length of the shorter version.
# Determine the number of characters in A and B.
ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
# Set A to no more than B's length and B to no more than A's length.
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
],
[[0-9]+],[
# A count greater than zero means use only that many subversions
A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
],
[.+],[
AC_WARNING(
[invalid OP numeric parameter: $2])
],[])
# Pad zeros at end of numbers to make same length.
ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
B="$B`echo $A | sed 's/./0/g'`"
A="$ax_compare_version_tmp_A"
# Check for equality or inequality as necessary.
m4_case(m4_tolower(m4_substr($2,0,2)),
[eq],[
test "x$A" = "x$B" && ax_compare_version=true
],
[ne],[
test "x$A" != "x$B" && ax_compare_version=true
],[
AC_WARNING([invalid OP parameter: $2])
])
])
AS_VAR_POPDEF([A])dnl
AS_VAR_POPDEF([B])dnl
dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
if test "$ax_compare_version" = "true" ; then
m4_ifvaln([$4],[$4],[:])dnl
m4_ifvaln([$5],[else $5])dnl
fi
]) dnl AX_COMPARE_VERSION

View File

@ -1,10 +1,10 @@
# =========================================================================== # ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_lib_postgresql.html # https://www.gnu.org/software/autoconf-archive/ax_lib_postgresql.html
# =========================================================================== # ===========================================================================
# #
# SYNOPSIS # SYNOPSIS
# #
# AX_LIB_POSTGRESQL([MINIMUM-VERSION]) # AX_LIB_POSTGRESQL([MINIMUM-VERSION],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
# #
# DESCRIPTION # DESCRIPTION
# #
@ -23,133 +23,225 @@
# should be in the PATH) # should be in the PATH)
# #
# path - complete path to pg_config utility, use this option if pg_config # path - complete path to pg_config utility, use this option if pg_config
# can't be found in the PATH # can't be found in the PATH (You could set also PG_CONFIG variable)
# #
# This macro calls: # This macro calls:
# #
# AC_SUBST(POSTGRESQL_CPPFLAGS) # AC_SUBST(POSTGRESQL_CPPFLAGS)
# AC_SUBST(POSTGRESQL_LDFLAGS) # AC_SUBST(POSTGRESQL_LDFLAGS)
# AC_SUBST(POSTGRESQL_LIBS)
# AC_SUBST(POSTGRESQL_VERSION) # AC_SUBST(POSTGRESQL_VERSION)
# #
# And sets: # And sets:
# #
# HAVE_POSTGRESQL # HAVE_POSTGRESQL
# #
# It execute if found ACTION-IF-FOUND (empty by default) and
# ACTION-IF-NOT-FOUND (AC_MSG_FAILURE by default) if not found.
#
# LICENSE # LICENSE
# #
# Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net> # Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
# Copyright (c) 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
# Copyright (c) 2018 Bastien Roucaries <rouca@debian.org>
# #
# Copying and distribution of this file, with or without modification, are # Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice # permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any # and this notice are preserved. This file is offered as-is, without any
# warranty. # warranty.
#serial 9 #serial 22
AC_DEFUN([_AX_LIB_POSTGRESQL_OLD],[
found_postgresql="no"
_AX_LIB_POSTGRESQL_OLD_fail="no"
while true; do
AC_CACHE_CHECK([for the pg_config program], [ac_cv_path_PG_CONFIG],
[AC_PATH_PROGS_FEATURE_CHECK([PG_CONFIG], [pg_config],
[[ac_cv_path_PG_CONFIG="";$ac_path_PG_CONFIG --includedir > /dev/null \
&& ac_cv_path_PG_CONFIG=$ac_path_PG_CONFIG ac_path_PG_CONFIG_found=:]],
[ac_cv_path_PG_CONFIG=""])])
PG_CONFIG=$ac_cv_path_PG_CONFIG
AS_IF([test "X$PG_CONFIG" = "X"],[break])
AC_CACHE_CHECK([for the PostgreSQL libraries CPPFLAGS],[ac_cv_POSTGRESQL_CPPFLAGS],
[ac_cv_POSTGRESQL_CPPFLAGS="-I`$PG_CONFIG --includedir`" || _AX_LIB_POSTGRESQL_OLD_fail=yes])
AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break])
POSTGRESQL_CPPFLAGS="$ac_cv_POSTGRESQL_CPPFLAGS"
AC_CACHE_CHECK([for the PostgreSQL libraries LDFLAGS],[ac_cv_POSTGRESQL_LDFLAGS],
[ac_cv_POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir`" || _AX_LIB_POSTGRESQL_OLD_fail=yes])
AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break])
POSTGRESQL_LDFLAGS="$ac_cv_POSTGRESQL_LDFLAGS"
AC_CACHE_CHECK([for the PostgreSQL libraries LIBS],[ac_cv_POSTGRESQL_LIBS],
[ac_cv_POSTGRESQL_LIBS="-lpq"])
POSTGRESQL_LIBS="$ac_cv_POSTGRESQL_LIBS"
AC_CACHE_CHECK([for the PostgreSQL version],[ac_cv_POSTGRESQL_VERSION],
[
ac_cv_POSTGRESQL_VERSION=`$PG_CONFIG --version | sed "s/^PostgreSQL[[[:space:]]][[[:space:]]]*\([[0-9.]][[0-9.]]*\).*/\1/"` \
|| _AX_LIB_POSTGRESQL_OLD_fail=yes
])
AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break])
POSTGRESQL_VERSION="$ac_cv_POSTGRESQL_VERSION"
dnl
dnl Check if required version of PostgreSQL is available
dnl
AS_IF([test X"$postgresql_version_req" != "X"],[
AC_MSG_CHECKING([if PostgreSQL version $POSTGRESQL_VERSION is >= $postgresql_version_req])
AX_COMPARE_VERSION([$POSTGRESQL_VERSION],[ge],[$postgresql_version_req],
[found_postgresql_req_version=yes],[found_postgresql_req_version=no])
AC_MSG_RESULT([$found_postgresql_req_version])
])
AS_IF([test "Xfound_postgresql_req_version" = "Xno"],[break])
found_postgresql="yes"
break
done
])
AC_DEFUN([_AX_LIB_POSTGRESQL_PKG_CONFIG],
[
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
found_postgresql=no
while true; do
PKG_PROG_PKG_CONFIG
AS_IF([test X$PKG_CONFIG = X],[break])
_AX_LIB_POSTGRESQL_PKG_CONFIG_fail=no;
AS_IF([test "X$postgresql_version_req" = "X"],
[PKG_CHECK_EXISTS([libpq],[found_postgresql_pkg_config=yes],[found_postgresql=no])],
[PKG_CHECK_EXISTS([libpq >= "$postgresql_version_req"],
[found_postgresql=yes],[found_postgresql=no])])
AS_IF([test "X$found_postgresql" = "no"],[break])
AC_CACHE_CHECK([for the PostgreSQL libraries CPPFLAGS],[ac_cv_POSTGRESQL_CPPFLAGS],
[ac_cv_POSTGRESQL_CPPFLAGS="`$PKG_CONFIG libpq --cflags-only-I`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes])
AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break])
POSTGRESQL_CPPFLAGS="$ac_cv_POSTGRESQL_CPPFLAGS"
AC_CACHE_CHECK([for the PostgreSQL libraries LDFLAGS],[ac_cv_POSTGRESQL_LDFLAGS],
[ac_cv_POSTGRESQL_LDFLAGS="`$PKG_CONFIG libpq --libs-only-L --libs-only-other`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes])
AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break])
POSTGRESQL_LDFLAGS="$ac_cv_POSTGRESQL_LDFLAGS"
AC_CACHE_CHECK([for the PostgreSQL libraries LIBS],[ac_cv_POSTGRESQL_LIBS],
[ac_cv_POSTGRESQL_LIBS="`$PKG_CONFIG libpq --libs-only-l`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=ye])
AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break])
POSTGRESQL_LIBS="$ac_cv_POSTGRESQL_LIBS"
dnl already checked by exist but need to be recovered
AC_CACHE_CHECK([for the PostgreSQL version],[ac_cv_POSTGRESQL_VERSION],
[ac_cv_POSTGRESQL_VERSION="`$PKG_CONFIG libpq --modversion`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes])
AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break])
POSTGRESQL_VERSION="$ac_cv_POSTGRESQL_VERSION"
found_postgresql=yes
break;
done
])
AC_DEFUN([AX_LIB_POSTGRESQL], AC_DEFUN([AX_LIB_POSTGRESQL],
[ [
AC_ARG_WITH([postgresql], AC_ARG_WITH([postgresql],
AS_HELP_STRING([--with-postgresql=@<:@ARG@:>@], AS_HELP_STRING([--with-postgresql=@<:@ARG@:>@],
[use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config] [use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config]
), ),
[ [
if test "$withval" = "no"; then AS_CASE([$withval],
want_postgresql="no" [[[nN]][[oO]]],[want_postgresql="no"],
elif test "$withval" = "yes"; then [[[yY]][[eE]][[sS]]],[want_postgresql="yes"],
want_postgresql="yes" [
else want_postgresql="yes"
want_postgresql="yes" PG_CONFIG="$withval"
PG_CONFIG="$withval" ])
fi ],
], [want_postgresql="yes"]
[want_postgresql="yes"]
) )
POSTGRESQL_CPPFLAGS="" AC_ARG_VAR([POSTGRESQL_CPPFLAGS],[cpp flags for PostgreSQL overriding detected flags])
POSTGRESQL_LDFLAGS="" AC_ARG_VAR([POSTGRESQL_LIBFLAGS],[libs for PostgreSQL overriding detected flags])
AC_ARG_VAR([POSTGRESQL_LDFLAGS],[linker flags for PostgreSQL overriding detected flags])
# populate cache
AS_IF([test "X$POSTGRESQL_CPPFLAGS" != X],[ac_cv_POSTGRESQL_CPPFLAGS="$POSTGRESQL_CPPFLAGS"])
AS_IF([test "X$POSTGRESQL_LDFLAGS" != X],[ac_cv_POSTGRESQL_LDFLAGS="$POSTGRESQL_LDFLAGS"])
AS_IF([test "X$POSTGRESQL_LIBS" != X],[ac_cv_POSTGRESQL_LIBS="$POSTGRESQL_LIBS"])
postgresql_version_req=ifelse([$1], [], [], [$1])
found_postgresql="no"
POSTGRESQL_VERSION="" POSTGRESQL_VERSION=""
dnl dnl
dnl Check PostgreSQL libraries (libpq) dnl Check PostgreSQL libraries (libpq)
dnl dnl
AS_IF([test X"$want_postgresql" = "Xyes"],[
if test "$want_postgresql" = "yes"; then _AX_LIB_POSTGRESQL_PKG_CONFIG
if test -z "$PG_CONFIG" -o test; then
AC_PATH_PROG([PG_CONFIG], [pg_config], [])
fi
if test ! -x "$PG_CONFIG"; then
dnl AC_MSG_ERROR([$PG_CONFIG does not exist or it is not an exectuable file])
PG_CONFIG="no"
found_postgresql="no"
fi
if test "$PG_CONFIG" != "no"; then
AC_MSG_CHECKING([for PostgreSQL libraries])
POSTGRESQL_CPPFLAGS="-I`$PG_CONFIG --includedir`"
POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir`"
POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##' | awk '{print $1}'`
AC_DEFINE([HAVE_POSTGRESQL], [1],
[Define to 1 if PostgreSQL libraries are available])
found_postgresql="yes"
AC_MSG_RESULT([yes])
else
found_postgresql="no"
AC_MSG_RESULT([no])
fi
fi
dnl
dnl Check if required version of PostgreSQL is available
dnl
postgresql_version_req=ifelse([$1], [], [], [$1]) AS_IF([test X"$found_postgresql" = "Xno"],
[_AX_LIB_POSTGRESQL_OLD])
if test "$found_postgresql" = "yes" -a -n "$postgresql_version_req"; then AS_IF([test X"$found_postgresql" = Xyes],[
_AX_LIB_POSTGRESQL_OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
_AX_LIB_POSTGRESQL_OLD_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $POSTGRESQL_LDFLAGS"
_AX_LIB_POSTGRESQL_OLD_LIBS="$LIBS"
LIBS="$LIBS $POSTGRESQL_LIBS"
while true; do
dnl try to compile
AC_CHECK_HEADER([libpq-fe.h],[],[found_postgresql=no])
AS_IF([test "X$found_postgresql" = "Xno"],[break])
dnl try now to link
AC_CACHE_CHECK([for the PostgreSQL library linking is working],[ac_cv_postgresql_found],
[
AC_LINK_IFELSE([
AC_LANG_PROGRAM(
[
#include <libpq-fe.h>
],
[[
char conninfo[]="dbname = postgres";
PGconn *conn;
conn = PQconnectdb(conninfo);
]]
)
],[ac_cv_postgresql_found=yes],
[ac_cv_postgresql_found=no])
])
found_postgresql="$ac_cv_postgresql_found"
AS_IF([test "X$found_postgresql" = "Xno"],[break])
break
done
CPPFLAGS="$_AX_LIB_POSTGRESQL_OLD_CPPFLAGS"
LDFLAGS="$_AX_LIB_POSTGRESQL_OLD_LDFLAGS"
LIBS="$_AX_LIB_POSTGRESQL_OLD_LIBS"
])
AC_MSG_CHECKING([if PostgreSQL version $POSTGRESQL_VERSION is >= $postgresql_version_req])
dnl Decompose required version string of PostgreSQL AS_IF([test "x$found_postgresql" = "xyes"],[
dnl and calculate its number representation AC_DEFINE([HAVE_POSTGRESQL], [1],
postgresql_version_req_major=`expr $postgresql_version_req : '\([[0-9]]*\)'` [Define to 1 if PostgreSQL libraries are available])])
postgresql_version_req_minor=`expr $postgresql_version_req : '[[0-9]]*\.\([[0-9]]*\)'` ])
postgresql_version_req_micro=`expr $postgresql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$postgresql_version_req_micro" = "x"; then
postgresql_version_req_micro="0"
fi
postgresql_version_req_number=`expr $postgresql_version_req_major \* 1000000 \
\+ $postgresql_version_req_minor \* 1000 \
\+ $postgresql_version_req_micro`
dnl Decompose version string of installed PostgreSQL
dnl and calculate its number representation
postgresql_version_major=`expr $POSTGRESQL_VERSION : '\([[0-9]]*\)'`
postgresql_version_minor=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
postgresql_version_micro=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$postgresql_version_micro" = "x"; then
postgresql_version_micro="0"
fi
postgresql_version_number=`expr $postgresql_version_major \* 1000000 \
\+ $postgresql_version_minor \* 1000 \
\+ $postgresql_version_micro`
postgresql_version_check=`expr $postgresql_version_number \>\= $postgresql_version_req_number`
if test "$postgresql_version_check" = "1"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST([POSTGRESQL_VERSION]) AC_SUBST([POSTGRESQL_VERSION])
AC_SUBST([POSTGRESQL_CPPFLAGS]) AC_SUBST([POSTGRESQL_CPPFLAGS])
AC_SUBST([POSTGRESQL_LDFLAGS]) AC_SUBST([POSTGRESQL_LDFLAGS])
AC_SUBST([POSTGRESQL_LIBS])
AS_IF([test "x$found_postgresql" = "xyes"],
[ifelse([$2], , :, [$2])],
[ifelse([$3], , AS_IF([test X"$want_postgresql" = "Xyes"],[AC_MSG_ERROR([Library requirements (PostgreSQL) not met.])],[:]), [$3])])
]) ])

View File

@ -193,14 +193,16 @@ check_SCRIPTS = \
test-sync.sh test-sync.sh
.NOTPARALLEL: .NOTPARALLEL:
# Disabled for now: need working wallet first! # revocation test disabled for now: need working wallet first!
# TESTS = $(check_SCRIPTS) # TESTS = $(check_SCRIPTS)
TESTS = \
test-auditor.sh \
test-sync.sh
EXTRA_DIST = \ EXTRA_DIST = \
taler-auditor.in \ taler-auditor.in \
taler-helper-auditor-render.py \ taler-helper-auditor-render.py \
auditor.conf \ auditor.conf \
test-auditor.conf \
test-sync-in.conf \ test-sync-in.conf \
test-sync-out.conf \ test-sync-out.conf \
generate-auditor-basedb.sh \ generate-auditor-basedb.sh \
@ -209,8 +211,10 @@ EXTRA_DIST = \
generate-auditor-basedb-template.conf \ generate-auditor-basedb-template.conf \
$(check_SCRIPTS) \ $(check_SCRIPTS) \
auditor-basedb.age \ auditor-basedb.age \
auditor-basedb.conf \
auditor-basedb.sql \ auditor-basedb.sql \
auditor-basedb.mpub \ auditor-basedb.mpub \
revoke-basedb.age \ revoke-basedb.age \
revoke-basedb.conf \
revoke-basedb.sql \ revoke-basedb.sql \
revoke-basedb.mpub revoke-basedb.mpub

View File

@ -1 +1 @@
1638356946 1646042841

View File

@ -0,0 +1,186 @@
[arm]
CONFIG = /research/taler/exchange/src/auditor/auditor-basedb.conf
[benchmark]
MERCHANT_DETAILS = merchant_details.json
BANK_DETAILS = bank_details.json
[coin_kudos_10]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.01
fee_withdraw = TESTKUDOS:0.01
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:10
[coin_kudos_8]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.04
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.02
fee_withdraw = TESTKUDOS:0.05
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:8
[coin_kudos_5]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.01
fee_withdraw = TESTKUDOS:0.01
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:5
[coin_kudos_4]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.02
fee_refresh = TESTKUDOS:0.04
fee_deposit = TESTKUDOS:0.03
fee_withdraw = TESTKUDOS:0.03
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:4
[coin_kudos_2]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.02
fee_refresh = TESTKUDOS:0.04
fee_deposit = TESTKUDOS:0.03
fee_withdraw = TESTKUDOS:0.03
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:2
[coin_kudos_1]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.02
fee_withdraw = TESTKUDOS:0.02
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:1
[coin_kudos_ct_10]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.03
fee_deposit = TESTKUDOS:0.01
fee_withdraw = TESTKUDOS:0.01
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:0.10
[coin_kudos_ct_1]
rsa_keysize = 1024
CIPHER = RSA
fee_refund = TESTKUDOS:0.01
fee_refresh = TESTKUDOS:0.01
fee_deposit = TESTKUDOS:0.01
fee_withdraw = TESTKUDOS:0.01
duration_legal = 3 years
duration_spend = 2 years
duration_withdraw = 7 days
value = TESTKUDOS:0.01
[payments-generator]
exchange = http://localhost:8081/
exchange-admin = http://localhost:18080/
exchange_admin = http://localhost:18080/
merchant = http://localhost:9966/
bank = http://localhost:8082/
instance = default
currency = TESTKUDOS
[merchant-exchange-default]
CURRENCY = TESTKUDOS
EXCHANGE_BASE_URL = http://localhost:8081/
MASTER_KEY = TMQ09D9G18Z8TFEABD833SDJ6JQWRYKFHPTWT6DMPQS54ZC66RDG
[merchant-account-merchant]
ACTIVE_default = YES
HONOR_default = YES
PAYTO_URI = payto://x-taler-bank/localhost/42
[exchange-accountcredentials-1]
PASSWORD = x
USERNAME = Exchange
WIRE_GATEWAY_AUTH_METHOD = basic
WIRE_GATEWAY_URL = http://localhost:8082/taler-wire-gateway/Exchange/
[exchange-account-1]
enable_credit = yes
enable_debit = yes
PAYTO_URI = payto://x-taler-bank/localhost/Exchange
[instance-default]
NAME = Merchant Inc.
KEYFILE = ${TALER_DATA_HOME}/merchant/default.priv
[taler]
CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
CURRENCY = TESTKUDOS
[merchantdb-postgres]
CONFIG = postgres:///auditor-basedb
[merchant]
DEFAULT_MAX_WIRE_FEE = TESTKUDOS:0.10
KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv
DEFAULT_MAX_DEPOSIT_FEE = TESTKUDOS:0.1
WIREFORMAT = default
WIRE_TRANSFER_DELAY = 1 minute
FORCE_AUDIT = YES
UNIXPATH = ${TALER_RUNTIME_DIR}/merchant.http
[exchangedb-postgres]
CONFIG = postgres:///auditor-basedb
[exchange]
LOOKAHEAD_SIGN = 32 weeks 1 day
SIGNKEY_DURATION = 4 weeks
MASTER_PUBLIC_KEY = TMQ09D9G18Z8TFEABD833SDJ6JQWRYKFHPTWT6DMPQS54ZC66RDG
SIGNKEY_LEGAL_DURATION = 4 weeks
UNIXPATH = ${TALER_RUNTIME_DIR}/exchange.http
[bank]
SERVE = http
ALLOW_REGISTRATIONS = YES
SUGGESTED_EXCHANGE_PAYTO = payto://x-taler-bank/localhost/2
SUGGESTED_EXCHANGE = http://localhost:8081/
HTTP_PORT = 8082
MAX_DEBT_BANK = TESTKUDOS:100000.0
MAX_DEBT = TESTKUDOS:50.0
DATABASE = postgres:///taler-auditor-basedb
[auditordb-postgres]
CONFIG = postgres:///taler-auditor-basedb
[auditor]
PUBLIC_KEY = 95FVPHMW4110HTPVSGMT2YMDE2BSGXZEV5WSV0TD1DXMF2RQ5HN0
TINY_AMOUNT = TESTKUDOS:0.01
BASE_URL = http://localhost:8083/
[PATHS]
TALER_CACHE_HOME = $TALER_HOME/.cache/taler/
TALER_CONFIG_HOME = $TALER_HOME/.config/taler/
TALER_DATA_HOME = $TALER_HOME/.local/share/taler/
TALER_HOME = ${PWD}/generate_auditordb_home/

View File

@ -1 +1 @@
R8JBA9089F3YRRSQDPWB92CZ5V1V0J1BPVW8J1B0P8VCVH71CYY0 TMQ09D9G18Z8TFEABD833SDJ6JQWRYKFHPTWT6DMPQS54ZC66RDG

File diff suppressed because it is too large Load Diff

View File

@ -41,9 +41,9 @@ BASEDB=${1:-"auditor-basedb"}
# Name of the Postgres database we will use for the script. # Name of the Postgres database we will use for the script.
# Will be dropped, do NOT use anything that might be used # Will be dropped, do NOT use anything that might be used
# elsewhere # elsewhere
TARGET_DB=taler-auditor-basedb export TARGET_DB=${BASEDB}
WALLET_DB=${BASEDB:-"wallet"}.wdb export WALLET_DB=${BASEDB:-"wallet"}.wdb
# delete existing wallet database # delete existing wallet database
rm -f $WALLET_DB rm -f $WALLET_DB
@ -51,7 +51,7 @@ rm -f $WALLET_DB
# Configuration file will be edited, so we create one # Configuration file will be edited, so we create one
# from the template. # from the template.
CONF=generate-auditor-basedb-prod.conf CONF=${BASEDB}.conf
cp generate-auditor-basedb-template.conf $CONF cp generate-auditor-basedb-template.conf $CONF
@ -92,8 +92,11 @@ mkdir -p $AUDITOR_PRIV_DIR
gnunet-ecc -g1 $AUDITOR_PRIV_FILE > /dev/null gnunet-ecc -g1 $AUDITOR_PRIV_FILE > /dev/null
AUDITOR_PUB=`gnunet-ecc -p $AUDITOR_PRIV_FILE` AUDITOR_PUB=`gnunet-ecc -p $AUDITOR_PRIV_FILE`
echo "AUDITOR PUB is $AUDITOR_PUB using file $AUDITOR_PRIV_FILE"
# patch configuration # patch configuration
taler-config -c $CONF -s exchange -o MASTER_PUBLIC_KEY -V $MASTER_PUB taler-config -c $CONF -s exchange -o MASTER_PUBLIC_KEY -V $MASTER_PUB
taler-config -c $CONF -s auditor -o PUBLIC_KEY -V $AUDITOR_PUB
taler-config -c $CONF -s merchant-exchange-default -o MASTER_KEY -V $MASTER_PUB taler-config -c $CONF -s merchant-exchange-default -o MASTER_KEY -V $MASTER_PUB
taler-config -c $CONF -s exchangedb-postgres -o CONFIG -V postgres:///$TARGET_DB taler-config -c $CONF -s exchangedb-postgres -o CONFIG -V postgres:///$TARGET_DB
taler-config -c $CONF -s auditordb-postgres -o CONFIG -V postgres:///$TARGET_DB taler-config -c $CONF -s auditordb-postgres -o CONFIG -V postgres:///$TARGET_DB
@ -120,6 +123,7 @@ TBINPFX=`dirname $TFN`
TLIBEXEC=${TBINPFX}/../lib/taler/libexec/ TLIBEXEC=${TBINPFX}/../lib/taler/libexec/
taler-exchange-secmod-eddsa -c $CONF 2> taler-exchange-secmod-eddsa.log & taler-exchange-secmod-eddsa -c $CONF 2> taler-exchange-secmod-eddsa.log &
taler-exchange-secmod-rsa -c $CONF 2> taler-exchange-secmod-rsa.log & taler-exchange-secmod-rsa -c $CONF 2> taler-exchange-secmod-rsa.log &
taler-exchange-secmod-cs -c $CONF 2> taler-exchange-secmod-cs.log &
taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log & taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log &
taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log & taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log &
taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log & taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log &
@ -237,7 +241,6 @@ echo "Final clean up"
dropdb $TARGET_DB dropdb $TARGET_DB
rm -rf $DATA_DIR || true rm -rf $DATA_DIR || true
rm $CONF
echo "=====================================" echo "====================================="
echo " Finished generation of $BASEDB" echo " Finished generation of $BASEDB"

View File

@ -32,7 +32,7 @@ export BASEDB=${1:-"revoke-basedb"}
# Name of the Postgres database we will use for the script. # Name of the Postgres database we will use for the script.
# Will be dropped, do NOT use anything that might be used # Will be dropped, do NOT use anything that might be used
# elsewhere # elsewhere
export TARGET_DB=taler-auditor-revokedb export TARGET_DB=${BASEDB}
TMP_DIR=`mktemp -d revocation-tmp-XXXXXX` TMP_DIR=`mktemp -d revocation-tmp-XXXXXX`
export WALLET_DB=wallet-revocation.json export WALLET_DB=wallet-revocation.json
rm -f $WALLET_DB rm -f $WALLET_DB
@ -109,7 +109,9 @@ TLIBEXEC=${TBINPFX}/../lib/taler/libexec/
taler-exchange-secmod-eddsa -c $CONF 2> taler-exchange-secmod-eddsa.log & taler-exchange-secmod-eddsa -c $CONF 2> taler-exchange-secmod-eddsa.log &
SIGNKEY_HELPER_PID=$! SIGNKEY_HELPER_PID=$!
taler-exchange-secmod-rsa -c $CONF 2> taler-exchange-secmod-rsa.log & taler-exchange-secmod-rsa -c $CONF 2> taler-exchange-secmod-rsa.log &
DENOM_HELPER_PID=$! RSA_DENOM_HELPER_PID=$!
taler-exchange-secmod-cs -c $CONF 2> taler-exchange-secmod-cs.log &
CS_DENOM_HELPER_PID=$!
taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log & taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log &
EXCHANGE_PID=$! EXCHANGE_PID=$!
taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log & taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log &
@ -277,12 +279,15 @@ export TIMETRAVEL="--timetravel=604800000000"
echo "Launching exchange 1 week in the future" echo "Launching exchange 1 week in the future"
kill -TERM $EXCHANGE_PID kill -TERM $EXCHANGE_PID
kill -TERM $DENOM_HELPER_PID kill -TERM $RSA_DENOM_HELPER_PID
kill -TERM $CS_DENOM_HELPER_PID
kill -TERM $SIGNKEY_HELPER_PID kill -TERM $SIGNKEY_HELPER_PID
taler-exchange-secmod-eddsa $TIMETRAVEL -c $CONF 2> taler-exchange-secmod-eddsa.log & taler-exchange-secmod-eddsa $TIMETRAVEL -c $CONF 2> taler-exchange-secmod-eddsa.log &
SIGNKEY_HELPER_PID=$! SIGNKEY_HELPER_PID=$!
taler-exchange-secmod-rsa $TIMETRAVEL -c $CONF 2> taler-exchange-secmod-rsa.log & taler-exchange-secmod-rsa $TIMETRAVEL -c $CONF 2> taler-exchange-secmod-rsa.log &
DENOM_HELPER_PID=$! RSA_DENOM_HELPER_PID=$!
taler-exchange-secmod-cs $TIMETRAVEL -c $CONF 2> taler-exchange-secmod-cs.log &
CS_DENOM_HELPER_PID=$!
taler-exchange-httpd $TIMETRAVEL -c $CONF 2> taler-exchange-httpd.log & taler-exchange-httpd $TIMETRAVEL -c $CONF 2> taler-exchange-httpd.log &
export EXCHANGE_PID=$! export EXCHANGE_PID=$!

View File

@ -172,7 +172,7 @@ add_denomination (
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info_by_hash ( TALER_ARL_get_denomination_info_by_hash (
const struct TALER_DenominationHash *dh, const struct TALER_DenominationHashP *dh,
const struct TALER_DenominationKeyValidityPS **issue) const struct TALER_DenominationKeyValidityPS **issue)
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
@ -186,6 +186,7 @@ TALER_ARL_get_denomination_info_by_hash (
NULL); NULL);
if (0 > qs) if (0 > qs)
{ {
GNUNET_break (0);
*issue = NULL; *issue = NULL;
return qs; return qs;
} }
@ -211,6 +212,7 @@ TALER_ARL_get_denomination_info_by_hash (
&issue); &issue);
if (qs <= 0) if (qs <= 0)
{ {
GNUNET_break (qs >= 0);
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Denomination %s not found\n", "Denomination %s not found\n",
@ -245,9 +247,9 @@ enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info ( TALER_ARL_get_denomination_info (
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationKeyValidityPS **issue, const struct TALER_DenominationKeyValidityPS **issue,
struct TALER_DenominationHash *dh) struct TALER_DenominationHashP *dh)
{ {
struct TALER_DenominationHash hc; struct TALER_DenominationHashP hc;
if (NULL == dh) if (NULL == dh)
dh = &hc; dh = &hc;
@ -558,7 +560,7 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
"BASE_URL"); "BASE_URL");
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_YES == GNUNET_is_zero (&TALER_ARL_master_pub)) if (GNUNET_is_zero (&TALER_ARL_master_pub))
{ {
/* -m option not given, try configuration */ /* -m option not given, try configuration */
char *master_public_key_str; char *master_public_key_str;
@ -596,8 +598,36 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
"Taler auditor running for exchange master public key %s\n", "Taler auditor running for exchange master public key %s\n",
TALER_B2S (&TALER_ARL_master_pub)); TALER_B2S (&TALER_ARL_master_pub));
if (GNUNET_YES == GNUNET_is_zero (&TALER_ARL_auditor_pub)) if (GNUNET_is_zero (&TALER_ARL_auditor_pub))
{ {
char *auditor_public_key_str;
if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (c,
"auditor",
"PUBLIC_KEY",
&auditor_public_key_str))
{
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_public_key_from_string (
auditor_public_key_str,
strlen (auditor_public_key_str),
&TALER_ARL_auditor_pub.eddsa_pub))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"auditor",
"PUBLIC_KEY",
"invalid key");
GNUNET_free (auditor_public_key_str);
return GNUNET_SYSERR;
}
GNUNET_free (auditor_public_key_str);
}
}
if (GNUNET_is_zero (&TALER_ARL_auditor_pub))
{
/* public key not configured */
/* try loading private key and deriving public key */ /* try loading private key and deriving public key */
char *fn; char *fn;
@ -609,6 +639,9 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
{ {
struct TALER_AuditorPrivateKeyP auditor_priv; struct TALER_AuditorPrivateKeyP auditor_priv;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Loading offline private key from `%s' to get auditor public key\n",
fn);
if (GNUNET_OK == if (GNUNET_OK ==
GNUNET_CRYPTO_eddsa_key_from_file (fn, GNUNET_CRYPTO_eddsa_key_from_file (fn,
GNUNET_NO, /* do NOT create it! */ GNUNET_NO, /* do NOT create it! */
@ -621,36 +654,12 @@ TALER_ARL_init (const struct GNUNET_CONFIGURATION_Handle *c)
} }
} }
if (GNUNET_YES == GNUNET_is_zero (&TALER_ARL_auditor_pub)) if (GNUNET_is_zero (&TALER_ARL_auditor_pub))
{ {
/* private key not available, try configuration for public key */ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_INFO,
char *auditor_public_key_str; "auditor",
"PUBLIC_KEY/AUDITOR_PRIV_FILE");
if (GNUNET_OK != return GNUNET_SYSERR;
GNUNET_CONFIGURATION_get_value_string (c,
"auditor",
"PUBLIC_KEY",
&auditor_public_key_str))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"auditor",
"PUBLIC_KEY");
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_public_key_from_string (
auditor_public_key_str,
strlen (auditor_public_key_str),
&TALER_ARL_auditor_pub.eddsa_pub))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"auditor",
"PUBLIC_KEY",
"invalid key");
GNUNET_free (auditor_public_key_str);
return GNUNET_SYSERR;
}
GNUNET_free (auditor_public_key_str);
} }
if (GNUNET_OK != if (GNUNET_OK !=

View File

@ -101,7 +101,7 @@ TALER_ARL_report (json_t *array,
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info_by_hash ( TALER_ARL_get_denomination_info_by_hash (
const struct TALER_DenominationHash *dh, const struct TALER_DenominationHashP *dh,
const struct TALER_DenominationKeyValidityPS **issue); const struct TALER_DenominationKeyValidityPS **issue);
@ -118,7 +118,7 @@ enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info ( TALER_ARL_get_denomination_info (
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationKeyValidityPS **issue, const struct TALER_DenominationKeyValidityPS **issue,
struct TALER_DenominationHash *dh); struct TALER_DenominationHashP *dh);
/** /**

View File

@ -91,6 +91,7 @@ struct Table
static struct Table tables[] = { static struct Table tables[] = {
{ .rt = TALER_EXCHANGEDB_RT_DENOMINATIONS}, { .rt = TALER_EXCHANGEDB_RT_DENOMINATIONS},
{ .rt = TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS}, { .rt = TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS},
{ .rt = TALER_EXCHANGEDB_RT_WIRE_TARGETS},
{ .rt = TALER_EXCHANGEDB_RT_RESERVES}, { .rt = TALER_EXCHANGEDB_RT_RESERVES},
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_IN}, { .rt = TALER_EXCHANGEDB_RT_RESERVES_IN},
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_CLOSE}, { .rt = TALER_EXCHANGEDB_RT_RESERVES_CLOSE},
@ -202,20 +203,16 @@ transact (void)
src->lookup_serial_by_table (src->cls, src->lookup_serial_by_table (src->cls,
tables[i].rt, tables[i].rt,
&tables[i].end_serial); &tables[i].end_serial);
if (0 > src->rollback (src->cls);
src->commit (src->cls))
return GNUNET_SYSERR;
if (GNUNET_OK != if (GNUNET_OK !=
dst->start (src->cls, dst->start (dst->cls,
"lookup dst serials")) "lookup dst serials"))
return GNUNET_SYSERR; return GNUNET_SYSERR;
for (unsigned int i = 0; ! tables[i].end; i++) for (unsigned int i = 0; ! tables[i].end; i++)
dst->lookup_serial_by_table (dst->cls, dst->lookup_serial_by_table (dst->cls,
tables[i].rt, tables[i].rt,
&tables[i].start_serial); &tables[i].start_serial);
if (0 > dst->rollback (dst->cls);
dst->commit (dst->cls))
return GNUNET_SYSERR;
for (unsigned int i = 0; ! tables[i].end; i++) for (unsigned int i = 0; ! tables[i].end; i++)
{ {
struct Table *table = &tables[i]; struct Table *table = &tables[i];

View File

@ -390,10 +390,10 @@ struct WireCheckContext
* @param[out] deposit_gain amount the coin contributes excluding refunds * @param[out] deposit_gain amount the coin contributes excluding refunds
* @return #GNUNET_OK on success, #GNUNET_SYSERR if the transaction must fail (hard error) * @return #GNUNET_OK on success, #GNUNET_SYSERR if the transaction must fail (hard error)
*/ */
static int static enum GNUNET_GenericReturnValue
check_transaction_history_for_deposit ( check_transaction_history_for_deposit (
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_DenominationKeyValidityPS *issue, const struct TALER_DenominationKeyValidityPS *issue,
const struct TALER_EXCHANGEDB_TransactionList *tl_head, const struct TALER_EXCHANGEDB_TransactionList *tl_head,
@ -683,6 +683,7 @@ check_transaction_history_for_deposit (
* @param rowid which row in the table is the information from (for diagnostics) * @param rowid which row in the table is the information from (for diagnostics)
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
* @param account_pay_uri where did we transfer the funds? * @param account_pay_uri where did we transfer the funds?
* @param h_payto hash over @a account_payto_uri as it is in the DB
* @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
* @param h_contract_terms which proposal was this payment about * @param h_contract_terms which proposal was this payment about
* @param denom_pub denomination of @a coin_pub * @param denom_pub denomination of @a coin_pub
@ -698,8 +699,9 @@ wire_transfer_information_cb (
uint64_t rowid, uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_pay_uri, const char *account_pay_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *coin_value, const struct TALER_Amount *coin_value,
@ -712,7 +714,18 @@ wire_transfer_information_cb (
struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tl;
struct TALER_CoinPublicInfo coin; struct TALER_CoinPublicInfo coin;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
struct TALER_PaytoHashP hpt;
TALER_payto_hash (account_pay_uri,
&hpt);
if (0 !=
GNUNET_memcmp (&hpt,
h_payto))
{
report_row_inconsistency ("wire_targets",
rowid,
"h-payto does not match payto URI");
}
/* Obtain coin's transaction history */ /* Obtain coin's transaction history */
qs = TALER_ARL_edb->get_coin_transactions (TALER_ARL_edb->cls, qs = TALER_ARL_edb->get_coin_transactions (TALER_ARL_edb->cls,
coin_pub, coin_pub,

View File

@ -673,7 +673,7 @@ struct CoinContext
* @return transaction status code * @return transaction status code
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
init_denomination (const struct TALER_DenominationHash *denom_hash, init_denomination (const struct TALER_DenominationHashP *denom_hash,
struct DenominationSummary *ds) struct DenominationSummary *ds)
{ {
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
@ -760,7 +760,7 @@ init_denomination (const struct TALER_DenominationHash *denom_hash,
static struct DenominationSummary * static struct DenominationSummary *
get_denomination_summary (struct CoinContext *cc, get_denomination_summary (struct CoinContext *cc,
const struct TALER_DenominationKeyValidityPS *issue, const struct TALER_DenominationKeyValidityPS *issue,
const struct TALER_DenominationHash *dh) const struct TALER_DenominationHashP *dh)
{ {
struct DenominationSummary *ds; struct DenominationSummary *ds;
@ -802,7 +802,7 @@ sync_denomination (void *cls,
void *value) void *value)
{ {
struct CoinContext *cc = cls; struct CoinContext *cc = cls;
struct TALER_DenominationHash denom_h = { struct TALER_DenominationHashP denom_h = {
.hash = *denom_hash .hash = *denom_hash
}; };
struct DenominationSummary *ds = value; struct DenominationSummary *ds = value;
@ -963,7 +963,7 @@ sync_denomination (void *cls,
static enum GNUNET_GenericReturnValue static enum GNUNET_GenericReturnValue
withdraw_cb (void *cls, withdraw_cb (void *cls,
uint64_t rowid, uint64_t rowid,
const struct TALER_BlindedCoinHash *h_blind_ev, const struct TALER_BlindedCoinHashP *h_blind_ev,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig, const struct TALER_ReserveSignatureP *reserve_sig,
@ -972,7 +972,7 @@ withdraw_cb (void *cls,
{ {
struct CoinContext *cc = cls; struct CoinContext *cc = cls;
struct DenominationSummary *ds; struct DenominationSummary *ds;
struct TALER_DenominationHash dh; struct TALER_DenominationHashP dh;
const struct TALER_DenominationKeyValidityPS *issue; const struct TALER_DenominationKeyValidityPS *issue;
struct TALER_Amount value; struct TALER_Amount value;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
@ -1275,7 +1275,7 @@ refresh_session_cb (void *cls,
/* verify melt signature */ /* verify melt signature */
{ {
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct TALER_Amount fee_refresh; struct TALER_Amount fee_refresh;
TALER_denom_pub_hash (denom_pub, TALER_denom_pub_hash (denom_pub,
@ -1611,8 +1611,8 @@ deposit_cb (void *cls,
/* Verify deposit signature */ /* Verify deposit signature */
{ {
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct TALER_Amount deposit_fee; struct TALER_Amount deposit_fee;
TALER_denom_pub_hash (denom_pub, TALER_denom_pub_hash (denom_pub,
@ -1761,7 +1761,7 @@ refund_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_MerchantSignatureP *merchant_sig, const struct TALER_MerchantSignatureP *merchant_sig,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
uint64_t rtransaction_id, uint64_t rtransaction_id,
const struct TALER_Amount *amount_with_fee) const struct TALER_Amount *amount_with_fee)
{ {
@ -2089,7 +2089,7 @@ recoup_refresh_cb (void *cls,
struct GNUNET_TIME_Timestamp timestamp, struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub, const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_DenominationHash *old_denom_pub_hash, const struct TALER_DenominationHashP *old_denom_pub_hash,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
@ -2194,7 +2194,12 @@ check_denomination (
&issue->denom_hash, &issue->denom_hash,
&TALER_ARL_auditor_pub, &TALER_ARL_auditor_pub,
&auditor_sig); &auditor_sig);
if (0 >= qs) if (0 > qs)
{
GNUNET_break (0);
return; /* skip! */
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Encountered denomination `%s' (%s) valid from %s (%llu-%llu) that this auditor is not auditing!\n", "Encountered denomination `%s' (%s) valid from %s (%llu-%llu) that this auditor is not auditing!\n",

View File

@ -491,7 +491,7 @@ handle_reserve_in (void *cls,
static enum GNUNET_GenericReturnValue static enum GNUNET_GenericReturnValue
handle_reserve_out (void *cls, handle_reserve_out (void *cls,
uint64_t rowid, uint64_t rowid,
const struct TALER_BlindedCoinHash *h_blind_ev, const struct TALER_BlindedCoinHashP *h_blind_ev,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig, const struct TALER_ReserveSignatureP *reserve_sig,
@ -508,7 +508,7 @@ handle_reserve_out (void *cls,
struct GNUNET_TIME_Timestamp valid_start; struct GNUNET_TIME_Timestamp valid_start;
struct GNUNET_TIME_Timestamp expire_withdraw; struct GNUNET_TIME_Timestamp expire_withdraw;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/* should be monotonically increasing */ /* should be monotonically increasing */
GNUNET_assert (rowid >= ppr.last_reserve_out_serial_id); GNUNET_assert (rowid >= ppr.last_reserve_out_serial_id);

View File

@ -866,10 +866,10 @@ function test_13() {
echo "===========13: wrong melt signature ===========" echo "===========13: wrong melt signature ==========="
# Modify denom_sig, so it is wrong # Modify denom_sig, so it is wrong
COIN_ID=`echo "SELECT old_known_coin_id FROM refresh_commitments LIMIT 1;" | psql $DB -Aqt` COIN_PUB=`echo "SELECT old_coin_pub FROM refresh_commitments LIMIT 1;" | psql $DB -Aqt`
OLD_SIG=`echo "SELECT old_coin_sig FROM refresh_commitments WHERE old_known_coin_id='$COIN_ID';" | psql $DB -Aqt` OLD_SIG=`echo "SELECT old_coin_sig FROM refresh_commitments WHERE old_known_pub='$COIN_PUB';" | psql $DB -Aqt`
NEW_SIG="\xba588af7c13c477dca1ac458f65cc484db8fba53b969b873f4353ecbd815e6b4c03f42c0cb63a2b609c2d726e612fd8e0c084906a41f409b6a23a08a83c89a02" NEW_SIG="\xba588af7c13c477dca1ac458f65cc484db8fba53b969b873f4353ecbd815e6b4c03f42c0cb63a2b609c2d726e612fd8e0c084906a41f409b6a23a08a83c89a02"
echo "UPDATE refresh_commitments SET old_coin_sig='$NEW_SIG' WHERE old_known_coin_id='$COIN_ID'" | psql -Aqt $DB echo "UPDATE refresh_commitments SET old_coin_sig='$NEW_SIG' WHERE old_coin_pub='$COIN_PUB'" | psql -Aqt $DB
run_audit run_audit
@ -943,42 +943,27 @@ fi
} }
# Test where salt in the deposit table is wrong
# Test where h_wire in the deposit table is wrong
function test_15() { function test_15() {
echo "===========15: deposit wire hash wrong=================" echo "===========15: deposit wire salt wrong================="
# Check wire transfer lag reported (no aggregator!) # Modify wire_salt hash, so it is inconsistent
SALT=`echo "SELECT wire_salt FROM deposits WHERE deposit_serial_id=1;" | psql -Aqt $DB`
echo "UPDATE deposits SET wire_salt='\x1197cd7f7b0e13ab1905fedb36c536a2' WHERE deposit_serial_id=1;" | psql -Aqt $DB
# NOTE: This test is EXPECTED to fail for ~1h after run_audit
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in echo -n "Testing inconsistency detection... "
# taler-helper-auditor-wire.c) OP=`jq -r .bad_sig_losses[0].operation < test-audit-coins.json`
if [ $DATABASE_AGE -gt 3600 ] if test "x$OP" != "xdeposit"
then then
exit_fail "Reported operation wrong: $OP"
# Modify h_wire hash, so it is inconsistent with 'wire'
echo "UPDATE deposits SET h_wire='\x973e52d193a357940be9ef2939c19b0575ee1101f52188c3c01d9005b7d755c397e92624f09cfa709104b3b65605fe5130c90d7e1b7ee30f8fc570f39c16b853' WHERE deposit_serial_id=1" | psql -Aqt $DB
# The auditor checks h_wire consistency only for
# coins where the wire transfer has happened, hence
# run aggregator first to get this test to work.
run_audit aggregator
echo -n "Testing inconsistency detection... "
TABLE=`jq -r .row_inconsistencies[0].table < test-audit-aggregation.json`
if test "x$TABLE" != "xaggregation" -a "x$TABLE" != "xdeposits"
then
exit_fail "Reported table wrong: $TABLE"
fi
echo PASS
# cannot easily undo aggregator, hence full reload
full_reload
else
echo "Test skipped (database too new)"
fi fi
echo PASS
# Restore DB
echo "UPDATE deposits SET wire_salt='$SALT' WHERE deposit_serial_id=1;" | psql -Aqt $DB
} }
@ -1181,14 +1166,14 @@ then
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE reserve_uuid='${RES_UUID}';" | psql $DB -Aqt` OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE reserve_pub='${RES_PUB}';" | psql $DB -Aqt`
VAL_DELTA=1 VAL_DELTA=1
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true` NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true`
echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
echo "UPDATE reserves SET current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}' WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB echo "UPDATE reserves SET current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}' WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
# Need to run with the aggregator so the reserve closure happens # Need to run with the aggregator so the reserve closure happens
run_audit aggregator run_audit aggregator
@ -1219,11 +1204,11 @@ echo "===========20: reserve closure missing ================="
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + 100 || true` NEW_CREDIT=`expr $OLD_VAL + 100 || true`
echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
echo "UPDATE reserves SET current_balance_val=100+current_balance_val WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB echo "UPDATE reserves SET current_balance_val=100+current_balance_val WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
# This time, run without the aggregator so the reserve closure is skipped! # This time, run without the aggregator so the reserve closure is skipped!
run_audit run_audit
@ -1240,7 +1225,7 @@ fi
# Undo # Undo
echo "UPDATE reserves_in SET execution_date='${OLD_TIME}',credit_val=${OLD_VAL} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB echo "UPDATE reserves_in SET execution_date='${OLD_TIME}',credit_val=${OLD_VAL} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
echo "UPDATE reserves SET current_balance_val=current_balance_val-100 WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB echo "UPDATE reserves SET current_balance_val=current_balance_val-100 WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
} }
@ -1259,19 +1244,18 @@ then
OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_TIME=`echo "SELECT execution_date FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` OLD_VAL=`echo "SELECT credit_val FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
RES_UUID=`echo "SELECT reserve_uuid FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt` RES_PUB=`echo "SELECT reserve_pub FROM reserves_in WHERE reserve_in_serial_id=1;" | psql $DB -Aqt`
OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE reserve_uuid='${RES_UUID}';" | psql $DB -Aqt` OLD_EXP=`echo "SELECT expiration_date FROM reserves WHERE reserve_pub='${RES_PUB}';" | psql $DB -Aqt`
VAL_DELTA=1 VAL_DELTA=1
NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks NEW_TIME=`expr $OLD_TIME - 3024000000000 || true` # 5 weeks
NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks NEW_EXP=`expr $OLD_EXP - 3024000000000 || true` # 5 weeks
NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true` NEW_CREDIT=`expr $OLD_VAL + $VAL_DELTA || true`
echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB echo "UPDATE reserves_in SET execution_date='${NEW_TIME}',credit_val=${NEW_CREDIT} WHERE reserve_in_serial_id=1;" | psql -Aqt $DB
echo "UPDATE reserves SET current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}' WHERE reserve_uuid='${RES_UUID}';" | psql -Aqt $DB echo "UPDATE reserves SET current_balance_val=${VAL_DELTA}+current_balance_val,expiration_date='${NEW_EXP}' WHERE reserve_pub='${RES_PUB}';" | psql -Aqt $DB
# Need to first run the aggregator so the transfer is marked as done exists # Need to first run the aggregator so the transfer is marked as done exists
pre_audit aggregator pre_audit aggregator
# remove transaction from bank DB # remove transaction from bank DB
echo "DELETE FROM app_banktransaction WHERE debit_account_id=2 AND amount='TESTKUDOS:${VAL_DELTA}';" | psql -Aqt $DB echo "DELETE FROM app_banktransaction WHERE debit_account_id=2 AND amount='TESTKUDOS:${VAL_DELTA}';" | psql -Aqt $DB
@ -1312,7 +1296,7 @@ S_DENOM=`echo 'SELECT denominations_serial FROM reserves_out LIMIT 1;' | psql $D
OLD_START=`echo "SELECT valid_from FROM denominations WHERE denominations_serial='${S_DENOM}';" | psql $DB -Aqt` OLD_START=`echo "SELECT valid_from FROM denominations WHERE denominations_serial='${S_DENOM}';" | psql $DB -Aqt`
OLD_WEXP=`echo "SELECT expire_withdraw FROM denominations WHERE denominations_serial='${S_DENOM}';" | psql $DB -Aqt` OLD_WEXP=`echo "SELECT expire_withdraw FROM denominations WHERE denominations_serial='${S_DENOM}';" | psql $DB -Aqt`
# Basically expires 'immediately', so that the withdraw must have been 'invalid' # Basically expires 'immediately', so that the withdraw must have been 'invalid'
NEW_WEXP=`expr $OLD_START + 1 || true` NEW_WEXP=$OLD_START
echo "UPDATE denominations SET expire_withdraw=${NEW_WEXP} WHERE denominations_serial='${S_DENOM}';" | psql -Aqt $DB echo "UPDATE denominations SET expire_withdraw=${NEW_WEXP} WHERE denominations_serial='${S_DENOM}';" | psql -Aqt $DB
@ -1320,7 +1304,7 @@ echo "UPDATE denominations SET expire_withdraw=${NEW_WEXP} WHERE denominations_s
run_audit run_audit
echo -n "Testing inconsistency detection... " echo -n "Testing inconsistency detection... "
jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit-reserves.json > /dev/null || exit_fail "Denomination key withdraw inconsistency not detected" jq -e .denomination_key_validity_withdraw_inconsistencies[0] < test-audit-reserves.json > /dev/null || exit_fail "Denomination key withdraw inconsistency for $S_DENOM not detected"
echo PASS echo PASS
@ -1793,6 +1777,50 @@ fi
# Test where h_payto in the wire_targets table is wrong
function test_33() {
echo "===========33: h_payto wrong================="
# Check wire transfer lag reported (no aggregator!)
# NOTE: this test is BRAND NEW and expected
# to fail until we implement the check in the auditor!
# NOTE: This test is EXPECTED to fail for ~1h after
# re-generating the test database as we do not
# report lag of less than 1h (see GRACE_PERIOD in
# taler-helper-auditor-wire.c)
if [ $DATABASE_AGE -gt 3600 ]
then
# Modify h_payto hash, so it is inconsistent with 'wire'
WTSID=`echo "SELECT wire_target_serial_id FROM deposits WHERE deposit_serial_id=1;" | psql -Aqt $DB`
echo "UPDATE wire_targets SET h_payto='\x973e52d193a357940be9ef2939c19b0575ee1101f52188c3c01d9005b7d755c397e92624f09cfa709104b3b65605fe5130c90d7e1b7ee30f8fc570f39c16b853' WHERE wire_target_serial_id=$WTSID" | psql -Aqt $DB
# The auditor checks h_wire consistency only for
# coins where the wire transfer has happened, hence
# run aggregator first to get this test to work.
run_audit aggregator
echo -n "Testing inconsistency detection... "
TABLE=`jq -r .row_inconsistencies[0].table < test-audit-aggregation.json`
if test "x$TABLE" != "xwire_targets"
then
exit_fail "Reported table wrong: $TABLE"
fi
echo PASS
# cannot easily undo aggregator, hence full reload
full_reload
else
echo "Test skipped (database too new)"
fi
}
# *************** Main test loop starts here ************** # *************** Main test loop starts here **************
@ -1840,10 +1868,10 @@ check_with_database()
# ####### Setup globals ###### # ####### Setup globals ######
# Postgres database to use # Postgres database to use
DB=taler-auditor-test DB=auditor-basedb
# Configuration file to use # Configuration file to use
CONF=test-auditor.conf CONF=${DB}.conf
# test required commands exist # test required commands exist
echo "Testing for jq" echo "Testing for jq"

View File

@ -482,11 +482,11 @@ check_with_database()
# *************** Main logic starts here ************** # *************** Main logic starts here **************
# ####### Setup globals ###### # ####### Setup globals ######
# Postgres database to use (must match test-auditor.conf) # Postgres database to use (must match revoke-basedb.conf)
DB=taler-auditor-test DB=taler-auditor-test
# Configuration file to use # Configuration file to use
CONF=test-auditor.conf CONF=revoke-basedb.conf
# test required commands exist # test required commands exist
echo "Testing for jq" echo "Testing for jq"

View File

@ -16,9 +16,10 @@ echo -n "."
psql talercheck-in < auditor-basedb.sql >/dev/null 2> /dev/null psql talercheck-in < auditor-basedb.sql >/dev/null 2> /dev/null
echo -n "." echo -n "."
taler-auditor-sync -s test-sync-in.conf -d test-sync-out.conf -t ~/bin/taler-auditor-sync -s test-sync-in.conf -d test-sync-out.conf -t
for table in denominations denomination_revocations reserves reserves_in reserves_close reserves_out auditors auditor_denom_sigs exchange_sign_keys signkey_revocations known_coins refresh_commitments refresh_revealed_coins refresh_transfer_keys deposits refunds wire_out aggregation_tracking wire_fee recoup recoup_refresh # cs_nonce_locks excluded: no point
for table in denominations denomination_revocations wire_targets reserves reserves_in reserves_close reserves_out auditors auditor_denom_sigs exchange_sign_keys signkey_revocations extensions extension_details known_coins refresh_commitments refresh_revealed_coins refresh_transfer_keys deposits refunds wire_out aggregation_tracking wire_fee recoup recoup_refresh
do do
echo -n "." echo -n "."
CIN=`echo "SELECT COUNT(*) FROM $table" | psql talercheck-in -Aqt` CIN=`echo "SELECT COUNT(*) FROM $table" | psql talercheck-in -Aqt`

View File

@ -2163,7 +2163,7 @@ postgres_get_wire_fee_summary (void *cls,
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_insert_denomination_balance ( postgres_insert_denomination_balance (
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
const struct TALER_Amount *denom_balance, const struct TALER_Amount *denom_balance,
const struct TALER_Amount *denom_loss, const struct TALER_Amount *denom_loss,
const struct TALER_Amount *denom_risk, const struct TALER_Amount *denom_risk,
@ -2203,7 +2203,7 @@ postgres_insert_denomination_balance (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_update_denomination_balance ( postgres_update_denomination_balance (
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
const struct TALER_Amount *denom_balance, const struct TALER_Amount *denom_balance,
const struct TALER_Amount *denom_loss, const struct TALER_Amount *denom_loss,
const struct TALER_Amount *denom_risk, const struct TALER_Amount *denom_risk,
@ -2240,14 +2240,14 @@ postgres_update_denomination_balance (
* @return transaction status code * @return transaction status code
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_get_denomination_balance (void *cls, postgres_get_denomination_balance (
const struct void *cls,
TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_Amount *denom_balance, struct TALER_Amount *denom_balance,
struct TALER_Amount *denom_loss, struct TALER_Amount *denom_loss,
struct TALER_Amount *denom_risk, struct TALER_Amount *denom_risk,
struct TALER_Amount *recoup_loss, struct TALER_Amount *recoup_loss,
uint64_t *num_issued) uint64_t *num_issued)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -2439,7 +2439,7 @@ static enum GNUNET_DB_QueryStatus
postgres_insert_historic_denom_revenue ( postgres_insert_historic_denom_revenue (
void *cls, void *cls,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct GNUNET_TIME_Timestamp revenue_timestamp, struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance, const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *loss_balance) const struct TALER_Amount *loss_balance)
@ -2506,7 +2506,7 @@ historic_denom_revenue_cb (void *cls,
for (unsigned int i = 0; i < num_results; i++) for (unsigned int i = 0; i < num_results; i++)
{ {
struct TALER_DenominationHash denom_pub_hash; struct TALER_DenominationHashP denom_pub_hash;
struct GNUNET_TIME_Timestamp revenue_timestamp; struct GNUNET_TIME_Timestamp revenue_timestamp;
struct TALER_Amount revenue_balance; struct TALER_Amount revenue_balance;
struct TALER_Amount loss; struct TALER_Amount loss;

View File

@ -130,10 +130,10 @@ run (void *cls)
struct TALER_MasterPublicKeyP master_pub; struct TALER_MasterPublicKeyP master_pub;
struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_DenominationHash rnd_hash; struct TALER_DenominationHashP rnd_hash;
struct TALER_DenominationPrivateKey denom_priv; struct TALER_DenominationPrivateKey denom_priv;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct TALER_DenominationHash denom_pub_hash; struct TALER_DenominationHashP denom_pub_hash;
struct GNUNET_TIME_Timestamp now; struct GNUNET_TIME_Timestamp now;
struct GNUNET_TIME_Timestamp past; struct GNUNET_TIME_Timestamp past;
struct GNUNET_TIME_Timestamp future; struct GNUNET_TIME_Timestamp future;
@ -488,7 +488,7 @@ run (void *cls)
int int
select_historic_denom_revenue_result ( select_historic_denom_revenue_result (
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash2, const struct TALER_DenominationHashP *denom_pub_hash2,
struct GNUNET_TIME_Timestamp revenue_timestamp2, struct GNUNET_TIME_Timestamp revenue_timestamp2,
const struct TALER_Amount *revenue_balance2, const struct TALER_Amount *revenue_balance2,
const struct TALER_Amount *loss2) const struct TALER_Amount *loss2)

View File

@ -23,11 +23,11 @@
#include "bank_api_common.h" #include "bank_api_common.h"
int enum GNUNET_GenericReturnValue
TALER_BANK_setup_auth_ (CURL *easy, TALER_BANK_setup_auth_ (CURL *easy,
const struct TALER_BANK_AuthenticationData *auth) const struct TALER_BANK_AuthenticationData *auth)
{ {
int ret; enum GNUNET_GenericReturnValue ret;
ret = GNUNET_OK; ret = GNUNET_OK;
switch (auth->method) switch (auth->method)

View File

@ -101,7 +101,7 @@ run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg) const struct GNUNET_CONFIGURATION_Handle *cfg)
{ {
unsigned long long port = 8082; unsigned long long port = 8082;
unsigned long long ram = 1024 * 1024 * 128; /* 128 M entries */ unsigned long long ram = 1024 * 128; /* 128 k entries */
char *currency_string; char *currency_string;
(void) cls; (void) cls;

View File

@ -37,6 +37,7 @@ taler_bank_benchmark_LDADD = \
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \ $(top_builddir)/src/exchangedb/libtalerexchangedb.la \
$(top_builddir)/src/json/libtalerjson.la \ $(top_builddir)/src/json/libtalerjson.la \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/extensions/libtalerextensions.la \
-lgnunetjson \ -lgnunetjson \
-lgnunetcurl \ -lgnunetcurl \
-lgnunetutil \ -lgnunetutil \

View File

@ -76,7 +76,7 @@ static struct GNUNET_SCHEDULER_Task *task;
/** /**
* Hash of the denomination. * Hash of the denomination.
*/ */
static struct TALER_DenominationHash h_denom_pub; static struct TALER_DenominationHashP h_denom_pub;
/** /**
* "signature" to use for the coin(s). * "signature" to use for the coin(s).
@ -223,7 +223,7 @@ struct Merchant
* the exchange from the detailed wire data provided by the * the exchange from the detailed wire data provided by the
* merchant. * merchant.
*/ */
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
/** /**
* Salt used when computing @e h_wire. * Salt used when computing @e h_wire.
@ -249,7 +249,7 @@ struct Deposit
* Hash over the proposal data between merchant and customer * Hash over the proposal data between merchant and customer
* (remains unknown to the Exchange). * (remains unknown to the Exchange).
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
}; };
@ -299,7 +299,7 @@ add_deposit (const struct Merchant *m)
struct Deposit d; struct Deposit d;
struct TALER_EXCHANGEDB_Deposit deposit; struct TALER_EXCHANGEDB_Deposit deposit;
uint64_t known_coin_id; uint64_t known_coin_id;
struct TALER_DenominationHash dph; struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh; struct TALER_AgeCommitmentHash agh;
RANDOMIZE (&d.coin.coin_pub); RANDOMIZE (&d.coin.coin_pub);
@ -487,7 +487,7 @@ run (void *cls,
{ {
struct TALER_DenominationPrivateKey pk; struct TALER_DenominationPrivateKey pk;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct TALER_CoinPubHash c_hash; struct TALER_CoinPubHashP c_hash;
struct TALER_PlanchetDetail pd; struct TALER_PlanchetDetail pd;
struct TALER_BlindedDenominationSignature bds; struct TALER_BlindedDenominationSignature bds;
struct TALER_PlanchetMasterSecretP ps; struct TALER_PlanchetMasterSecretP ps;
@ -528,23 +528,23 @@ run (void *cls,
&bks); &bks);
{ {
uint32_t seed; uint64_t seed;
struct TALER_AgeMask mask = { struct TALER_AgeMask mask = {
.mask = 1 || 1 << 8 || 1 << 12 || 1 << 16 || 1 << 18 .bits = 1 || 1 << 8 || 1 << 12 || 1 << 16 || 1 << 18
}; };
struct TALER_AgeCommitment ac = {0}; struct TALER_AgeCommitmentProof acp = {0};
seed = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, seed = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
UINT32_MAX); UINT64_MAX);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_age_restriction_commit ( TALER_age_restriction_commit (
&mask, &mask,
13, 13,
seed, seed,
&ac)); &acp));
TALER_age_commitment_hash (&ac, &hac); TALER_age_commitment_hash (&acp.commitment, &hac);
} }
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
@ -558,6 +558,7 @@ run (void *cls,
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_denom_sign_blinded (&bds, TALER_denom_sign_blinded (&bds,
&pk, &pk,
false,
&pd.blinded_planchet)); &pd.blinded_planchet));
TALER_blinded_planchet_free (&pd.blinded_planchet); TALER_blinded_planchet_free (&pd.blinded_planchet);
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==

View File

@ -39,6 +39,7 @@ taler_auditor_offline_LDADD = \
$(top_builddir)/src/lib/libtalerexchange.la \ $(top_builddir)/src/lib/libtalerexchange.la \
$(top_builddir)/src/json/libtalerjson.la \ $(top_builddir)/src/json/libtalerjson.la \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/extensions/libtalerextensions.la \
-lgnunetjson \ -lgnunetjson \
-lgnunetcurl \ -lgnunetcurl \
-ljansson \ -ljansson \

View File

@ -430,7 +430,7 @@ upload_denomination_add (const char *exchange_url,
const json_t *value) const json_t *value)
{ {
struct TALER_AuditorSignatureP auditor_sig; struct TALER_AuditorSignatureP auditor_sig;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct DenominationAddRequest *dar; struct DenominationAddRequest *dar;
const char *err_name; const char *err_name;
unsigned int err_line; unsigned int err_line;
@ -781,7 +781,7 @@ show_denomkeys (const json_t *denomkeys)
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
struct GNUNET_TIME_Relative duration; struct GNUNET_TIME_Relative duration;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (value, GNUNET_JSON_parse (value,
@ -1066,7 +1066,7 @@ sign_denomkeys (const json_t *denomkeys)
&master_sig), &master_sig),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (value, GNUNET_JSON_parse (value,

View File

@ -914,7 +914,7 @@ upload_denom_revocation (const char *exchange_url,
const json_t *value) const json_t *value)
{ {
struct TALER_MasterSignatureP master_sig; struct TALER_MasterSignatureP master_sig;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct DenomRevocationRequest *drr; struct DenomRevocationRequest *drr;
const char *err_name; const char *err_name;
unsigned int err_line; unsigned int err_line;
@ -1800,7 +1800,7 @@ upload_extensions (const char *exchange_url,
/* 2. Verify the signature */ /* 2. Verify the signature */
{ {
struct TALER_ExtensionConfigHash h_config; struct TALER_ExtensionConfigHashP h_config;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_JSON_extensions_config_hash (extensions, &h_config)) TALER_JSON_extensions_config_hash (extensions, &h_config))
@ -2023,7 +2023,7 @@ do_upload (char *const *args)
static void static void
do_revoke_denomination_key (char *const *args) do_revoke_denomination_key (char *const *args)
{ {
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct TALER_MasterSignatureP master_sig; struct TALER_MasterSignatureP master_sig;
if (NULL != in) if (NULL != in)
@ -2857,7 +2857,7 @@ show_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa,
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
struct GNUNET_TIME_Relative duration; struct GNUNET_TIME_Relative duration;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
enum GNUNET_GenericReturnValue ok; enum GNUNET_GenericReturnValue ok;
if (GNUNET_OK != if (GNUNET_OK !=
@ -3260,7 +3260,7 @@ load_age_mask (const char*section_name)
static const struct TALER_AgeMask null_mask = {0}; static const struct TALER_AgeMask null_mask = {0};
enum GNUNET_GenericReturnValue ret; enum GNUNET_GenericReturnValue ret;
if (age_mask.mask == 0) if (age_mask.bits == 0)
return null_mask; return null_mask;
if (GNUNET_OK != (GNUNET_CONFIGURATION_have_value ( if (GNUNET_OK != (GNUNET_CONFIGURATION_have_value (
@ -3338,7 +3338,7 @@ sign_denomkeys (const struct TALER_SecurityModulePublicKeyP *secm_pub_rsa,
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
struct GNUNET_TIME_Relative duration; struct GNUNET_TIME_Relative duration;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (value, GNUNET_JSON_parse (value,
@ -3645,7 +3645,7 @@ do_extensions_sign (char *const *args)
{ {
json_t *obj = json_object (); json_t *obj = json_object ();
json_t *extensions = json_object (); json_t *extensions = json_object ();
struct TALER_ExtensionConfigHash h_config; struct TALER_ExtensionConfigHashP h_config;
struct TALER_MasterSignatureP sig; struct TALER_MasterSignatureP sig;
const struct TALER_Extension *it; const struct TALER_Extension *it;

View File

@ -370,7 +370,7 @@ deposit_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
uint64_t wire_target, uint64_t wire_target,
const char *payto_uri) const char *payto_uri)
{ {
@ -516,7 +516,7 @@ aggregate_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_PrivateContractHash *h_contract_terms) const struct TALER_PrivateContractHashP *h_contract_terms)
{ {
struct AggregationUnit *au = cls; struct AggregationUnit *au = cls;
struct TALER_Amount old; struct TALER_Amount old;

View File

@ -647,7 +647,7 @@ handle_post_management (struct TEH_RequestContext *rc,
if (0 == strcmp (args[0], if (0 == strcmp (args[0],
"denominations")) "denominations"))
{ {
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
if ( (NULL == args[0]) || if ( (NULL == args[0]) ||
(NULL == args[1]) || (NULL == args[1]) ||
@ -794,7 +794,7 @@ handle_post_auditors (struct TEH_RequestContext *rc,
const char *const args[]) const char *const args[])
{ {
struct TALER_AuditorPublicKeyP auditor_pub; struct TALER_AuditorPublicKeyP auditor_pub;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
if ( (NULL == args[0]) || if ( (NULL == args[0]) ||
(NULL == args[1]) || (NULL == args[1]) ||

View File

@ -45,7 +45,7 @@ struct AddAuditorDenomContext
/** /**
* Denomination this is about. * Denomination this is about.
*/ */
const struct TALER_DenominationHash *h_denom_pub; const struct TALER_DenominationHashP *h_denom_pub;
/** /**
* Auditor this is about. * Auditor this is about.
@ -189,7 +189,7 @@ MHD_RESULT
TEH_handler_auditors ( TEH_handler_auditors (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const json_t *root) const json_t *root)
{ {
struct AddAuditorDenomContext awc = { struct AddAuditorDenomContext awc = {

View File

@ -39,7 +39,7 @@ MHD_RESULT
TEH_handler_auditors ( TEH_handler_auditors (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const json_t *root); const json_t *root);

View File

@ -78,12 +78,12 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
{ {
struct TALER_CsNonce nonces[csr_requests_num]; struct TALER_CsNonce nonces[csr_requests_num];
struct TALER_DenominationHash denom_pub_hashes[csr_requests_num]; struct TALER_DenominationHashP denom_pub_hashes[csr_requests_num];
for (unsigned int i = 0; i < csr_requests_num; i++) for (unsigned int i = 0; i < csr_requests_num; i++)
{ {
uint32_t coin_off; uint32_t coin_off;
struct TALER_DenominationHash *denom_pub_hash = &denom_pub_hashes[i]; struct TALER_DenominationHashP *denom_pub_hash = &denom_pub_hashes[i];
struct GNUNET_JSON_Specification csr_spec[] = { struct GNUNET_JSON_Specification csr_spec[] = {
GNUNET_JSON_spec_uint32 ("coin_offset", GNUNET_JSON_spec_uint32 ("coin_offset",
&coin_off), &coin_off),
@ -112,7 +112,7 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
for (unsigned int i = 0; i < csr_requests_num; i++) for (unsigned int i = 0; i < csr_requests_num; i++)
{ {
const struct TALER_CsNonce *nonce = &nonces[i]; const struct TALER_CsNonce *nonce = &nonces[i];
const struct TALER_DenominationHash *denom_pub_hash = const struct TALER_DenominationHashP *denom_pub_hash =
&denom_pub_hashes[i]; &denom_pub_hashes[i];
struct TALER_DenominationCSPublicRPairP *r_pub struct TALER_DenominationCSPublicRPairP *r_pub
= &ewvs[i].details.cs_values; = &ewvs[i].details.cs_values;
@ -179,9 +179,9 @@ TEH_handler_csr_melt (struct TEH_RequestContext *rc,
/* derive r_pub */ /* derive r_pub */
// FIXME: bundle all requests into one derivation request (TEH_keys_..., crypto helper, security module) // FIXME: bundle all requests into one derivation request (TEH_keys_..., crypto helper, security module)
ec = TEH_keys_denomination_cs_r_pub (denom_pub_hash, ec = TEH_keys_denomination_cs_r_pub_melt (denom_pub_hash,
nonce, nonce,
r_pub); r_pub);
if (TALER_EC_NONE != ec) if (TALER_EC_NONE != ec)
{ {
GNUNET_break (0); GNUNET_break (0);
@ -228,7 +228,7 @@ TEH_handler_csr_withdraw (struct TEH_RequestContext *rc,
const char *const args[]) const char *const args[])
{ {
struct TALER_CsNonce nonce; struct TALER_CsNonce nonce;
struct TALER_DenominationHash denom_pub_hash; struct TALER_DenominationHashP denom_pub_hash;
struct TALER_ExchangeWithdrawValues ewv = { struct TALER_ExchangeWithdrawValues ewv = {
.cipher = TALER_DENOMINATION_CS .cipher = TALER_DENOMINATION_CS
}; };
@ -238,7 +238,7 @@ TEH_handler_csr_withdraw (struct TEH_RequestContext *rc,
sizeof (struct TALER_CsNonce)), sizeof (struct TALER_CsNonce)),
GNUNET_JSON_spec_fixed ("denom_pub_hash", GNUNET_JSON_spec_fixed ("denom_pub_hash",
&denom_pub_hash, &denom_pub_hash,
sizeof (struct TALER_DenominationHash)), sizeof (struct TALER_DenominationHashP)),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
struct TEH_DenominationKey *dk; struct TEH_DenominationKey *dk;
@ -316,9 +316,9 @@ TEH_handler_csr_withdraw (struct TEH_RequestContext *rc,
{ {
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
ec = TEH_keys_denomination_cs_r_pub (&denom_pub_hash, ec = TEH_keys_denomination_cs_r_pub_withdraw (&denom_pub_hash,
&nonce, &nonce,
&ewv.details.cs_values); &ewv.details.cs_values);
if (TALER_EC_NONE != ec) if (TALER_EC_NONE != ec)
{ {
GNUNET_break (0); GNUNET_break (0);

View File

@ -29,19 +29,6 @@
#include "taler-exchange-httpd_responses.h" #include "taler-exchange-httpd_responses.h"
/**
* How often should we retry a transaction before giving up
* (for transactions resulting in serialization/dead locks only).
*
* The current value is likely too high for production. We might want to
* benchmark good values once we have a good database setup. The code is
* expected to work correctly with any positive value, albeit inefficiently if
* we too aggressively force clients to retry the HTTP request merely because
* we have database serialization issues.
*/
#define MAX_TRANSACTION_COMMIT_RETRIES 100
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin, TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin,
struct MHD_Connection *connection, struct MHD_Connection *connection,
@ -49,7 +36,7 @@ TEH_make_coin_known (const struct TALER_CoinPublicInfo *coin,
MHD_RESULT *mhd_ret) MHD_RESULT *mhd_ret)
{ {
enum TALER_EXCHANGEDB_CoinKnownStatus cks; enum TALER_EXCHANGEDB_CoinKnownStatus cks;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct TALER_AgeCommitmentHash age_hash; struct TALER_AgeCommitmentHash age_hash;
/* make sure coin is 'known' in database */ /* make sure coin is 'known' in database */

View File

@ -27,6 +27,19 @@
#include <gnunet/gnunet_mhd_compat.h> #include <gnunet/gnunet_mhd_compat.h>
/**
* How often should we retry a transaction before giving up
* (for transactions resulting in serialization/dead locks only).
*
* The current value is likely too high for production. We might want to
* benchmark good values once we have a good database setup. The code is
* expected to work correctly with any positive value, albeit inefficiently if
* we too aggressively force clients to retry the HTTP request merely because
* we have database serialization issues.
*/
#define MAX_TRANSACTION_COMMIT_RETRIES 100
/** /**
* Ensure coin is known in the database, and handle conflicts and errors. * Ensure coin is known in the database, and handle conflicts and errors.
* *

View File

@ -59,9 +59,10 @@
static MHD_RESULT static MHD_RESULT
reply_deposit_success (struct MHD_Connection *connection, reply_deposit_success (struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms, const struct
TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp exchange_timestamp, struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,
struct GNUNET_TIME_Timestamp wire_deadline, struct GNUNET_TIME_Timestamp wire_deadline,
@ -128,7 +129,7 @@ struct DepositContext
/** /**
* Hash of the payto URI. * Hash of the payto URI.
*/ */
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
/** /**
* Row of of the coin in the known_coins table. * Row of of the coin in the known_coins table.
@ -254,7 +255,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
&deposit.wire_deadline), &deposit.wire_deadline),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
memset (&deposit, memset (&deposit,
0, 0,
@ -307,6 +308,15 @@ TEH_handler_deposit (struct MHD_Connection *connection,
TALER_EC_EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE, TALER_EC_EXCHANGE_DEPOSIT_REFUND_DEADLINE_AFTER_WIRE_DEADLINE,
NULL); NULL);
} }
if (GNUNET_TIME_absolute_is_never (deposit.wire_deadline.abs_time))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_EXCHANGE_DEPOSIT_WIRE_DEADLINE_IS_NEVER,
NULL);
}
deposit.receiver_wire_account = (char *) payto_uri; deposit.receiver_wire_account = (char *) payto_uri;
TALER_payto_hash (payto_uri, TALER_payto_hash (payto_uri,
&dc.h_payto); &dc.h_payto);
@ -432,12 +442,24 @@ TEH_handler_deposit (struct MHD_Connection *connection,
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
/* make sure coin is 'known' in database */ /* make sure coin is 'known' in database */
qs = TEH_make_coin_known (&deposit.coin, for (unsigned int tries = 0; tries<MAX_TRANSACTION_COMMIT_RETRIES; tries++)
connection, {
&dc.known_coin_id, qs = TEH_make_coin_known (&deposit.coin,
&mhd_ret); connection,
/* no transaction => no serialization failures should be possible */ &dc.known_coin_id,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs); &mhd_ret);
/* no transaction => no serialization failures should be possible */
if (GNUNET_DB_STATUS_SOFT_ERROR != qs)
break;
}
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{
GNUNET_break (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_DB_COMMIT_FAILED,
"make_coin_known");
}
if (qs < 0) if (qs < 0)
return mhd_ret; return mhd_ret;
} }

View File

@ -47,8 +47,9 @@
*/ */
static MHD_RESULT static MHD_RESULT
reply_deposit_details (struct MHD_Connection *connection, reply_deposit_details (struct MHD_Connection *connection,
const struct TALER_PrivateContractHash *h_contract_terms, const struct
const struct TALER_MerchantWireHash *h_wire, TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *coin_contribution, const struct TALER_Amount *coin_contribution,
const struct TALER_WireTransferIdentifierRawP *wtid, const struct TALER_WireTransferIdentifierRawP *wtid,

View File

@ -131,7 +131,7 @@ extension_update_event_cb (void *cls,
/* Special case age restriction: Update global flag and mask */ /* Special case age restriction: Update global flag and mask */
if (TALER_Extension_AgeRestriction == type) if (TALER_Extension_AgeRestriction == type)
{ {
TEH_age_mask.mask = 0; TEH_age_mask.bits = 0;
TEH_age_restriction_enabled = TEH_age_restriction_enabled =
TALER_extensions_age_restriction_is_enabled (); TALER_extensions_age_restriction_is_enabled ();
if (TEH_age_restriction_enabled) if (TEH_age_restriction_enabled)

View File

@ -80,7 +80,7 @@ struct HelperDenomination
/** /**
* Hash of the full denomination key. * Hash of the full denomination key.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Signature over this key from the security module's key. * Signature over this key from the security module's key.
@ -797,7 +797,7 @@ load_age_mask (const char*section_name)
static const struct TALER_AgeMask null_mask = {0}; static const struct TALER_AgeMask null_mask = {0};
struct TALER_AgeMask age_mask = TALER_extensions_age_restriction_ageMask (); struct TALER_AgeMask age_mask = TALER_extensions_age_restriction_ageMask ();
if (age_mask.mask == 0) if (age_mask.bits == 0)
return null_mask; return null_mask;
if (GNUNET_OK != (GNUNET_CONFIGURATION_have_value ( if (GNUNET_OK != (GNUNET_CONFIGURATION_have_value (
@ -1295,7 +1295,7 @@ static void
denomination_info_cb ( denomination_info_cb (
void *cls, void *cls,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta, const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta,
const struct TALER_MasterSignatureP *master_sig, const struct TALER_MasterSignatureP *master_sig,
bool recoup_possible) bool recoup_possible)
@ -1472,7 +1472,7 @@ static void
auditor_denom_cb ( auditor_denom_cb (
void *cls, void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AuditorSignatureP *auditor_sig) const struct TALER_AuditorSignatureP *auditor_sig)
{ {
struct TEH_KeyStateHandle *ksh = cls; struct TEH_KeyStateHandle *ksh = cls;
@ -2120,7 +2120,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
* the properties of the denomination. Also, we build up the right * the properties of the denomination. Also, we build up the right
* hash for the corresponding array. */ * hash for the corresponding array. */
if (TEH_age_restriction_enabled && if (TEH_age_restriction_enabled &&
(0 != dk->denom_pub.age_mask.mask)) (0 != dk->denom_pub.age_mask.bits))
{ {
have_age_restricted_denoms = true; have_age_restricted_denoms = true;
array = age_restricted_denoms; array = age_restricted_denoms;
@ -2386,7 +2386,8 @@ TEH_keys_get_state (void)
struct TEH_DenominationKey * struct TEH_DenominationKey *
TEH_keys_denomination_by_hash (const struct TALER_DenominationHash *h_denom_pub, TEH_keys_denomination_by_hash (const struct
TALER_DenominationHashP *h_denom_pub,
struct MHD_Connection *conn, struct MHD_Connection *conn,
MHD_RESULT *mret) MHD_RESULT *mret)
{ {
@ -2411,7 +2412,7 @@ TEH_keys_denomination_by_hash (const struct TALER_DenominationHash *h_denom_pub,
struct TEH_DenominationKey * struct TEH_DenominationKey *
TEH_keys_denomination_by_hash2 ( TEH_keys_denomination_by_hash2 (
struct TEH_KeyStateHandle *ksh, struct TEH_KeyStateHandle *ksh,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
struct MHD_Connection *conn, struct MHD_Connection *conn,
MHD_RESULT *mret) MHD_RESULT *mret)
{ {
@ -2432,9 +2433,10 @@ TEH_keys_denomination_by_hash2 (
enum TALER_ErrorCode enum TALER_ErrorCode
TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub, TEH_keys_denomination_sign_withdraw (
const struct TALER_BlindedPlanchet *bp, const struct TALER_DenominationHashP *h_denom_pub,
struct TALER_BlindedDenominationSignature *bs) const struct TALER_BlindedPlanchet *bp,
struct TALER_BlindedDenominationSignature *bs)
{ {
struct TEH_KeyStateHandle *ksh; struct TEH_KeyStateHandle *ksh;
struct HelperDenomination *hd; struct HelperDenomination *hd;
@ -2458,7 +2460,7 @@ TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
bp->details.rsa_blinded_planchet.blinded_msg_size, bp->details.rsa_blinded_planchet.blinded_msg_size,
bs); bs);
case TALER_DENOMINATION_CS: case TALER_DENOMINATION_CS:
return TALER_CRYPTO_helper_cs_sign ( return TALER_CRYPTO_helper_cs_sign_withdraw (
ksh->helpers->csdh, ksh->helpers->csdh,
&hd->h_details.h_cs, &hd->h_details.h_cs,
&bp->details.cs_blinded_planchet, &bp->details.cs_blinded_planchet,
@ -2470,10 +2472,49 @@ TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
enum TALER_ErrorCode enum TALER_ErrorCode
TEH_keys_denomination_cs_r_pub (const struct TEH_keys_denomination_sign_melt (
TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_CsNonce *nonce, const struct TALER_BlindedPlanchet *bp,
struct TALER_DenominationCSPublicRPairP *r_pub) struct TALER_BlindedDenominationSignature *bs)
{
struct TEH_KeyStateHandle *ksh;
struct HelperDenomination *hd;
ksh = TEH_keys_get_state ();
if (NULL == ksh)
return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
hd = GNUNET_CONTAINER_multihashmap_get (ksh->helpers->denom_keys,
&h_denom_pub->hash);
if (NULL == hd)
return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
if (bp->cipher != hd->denom_pub.cipher)
return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
switch (hd->denom_pub.cipher)
{
case TALER_DENOMINATION_RSA:
return TALER_CRYPTO_helper_rsa_sign (
ksh->helpers->rsadh,
&hd->h_details.h_rsa,
bp->details.rsa_blinded_planchet.blinded_msg,
bp->details.rsa_blinded_planchet.blinded_msg_size,
bs);
case TALER_DENOMINATION_CS:
return TALER_CRYPTO_helper_cs_sign_melt (
ksh->helpers->csdh,
&hd->h_details.h_cs,
&bp->details.cs_blinded_planchet,
bs);
default:
return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
}
enum TALER_ErrorCode
TEH_keys_denomination_cs_r_pub_melt (
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_CsNonce *nonce,
struct TALER_DenominationCSPublicRPairP *r_pub)
{ {
struct TEH_KeyStateHandle *ksh; struct TEH_KeyStateHandle *ksh;
struct HelperDenomination *hd; struct HelperDenomination *hd;
@ -2494,15 +2535,47 @@ TEH_keys_denomination_cs_r_pub (const struct
return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE; return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
} }
return TALER_CRYPTO_helper_cs_r_derive (ksh->helpers->csdh, return TALER_CRYPTO_helper_cs_r_derive_melt (ksh->helpers->csdh,
&hd->h_details.h_cs, &hd->h_details.h_cs,
nonce, nonce,
r_pub); r_pub);
}
enum TALER_ErrorCode
TEH_keys_denomination_cs_r_pub_withdraw (
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_CsNonce *nonce,
struct TALER_DenominationCSPublicRPairP *r_pub)
{
struct TEH_KeyStateHandle *ksh;
struct HelperDenomination *hd;
ksh = TEH_keys_get_state ();
if (NULL == ksh)
{
return TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING;
}
hd = GNUNET_CONTAINER_multihashmap_get (ksh->helpers->denom_keys,
&h_denom_pub->hash);
if (NULL == hd)
{
return TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN;
}
if (TALER_DENOMINATION_CS != hd->denom_pub.cipher)
{
return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
return TALER_CRYPTO_helper_cs_r_derive_withdraw (ksh->helpers->csdh,
&hd->h_details.h_cs,
nonce,
r_pub);
} }
void void
TEH_keys_denomination_revoke (const struct TALER_DenominationHash *h_denom_pub) TEH_keys_denomination_revoke (const struct TALER_DenominationHashP *h_denom_pub)
{ {
struct TEH_KeyStateHandle *ksh; struct TEH_KeyStateHandle *ksh;
struct HelperDenomination *hd; struct HelperDenomination *hd;
@ -2825,7 +2898,7 @@ load_extension_data (const char *section_name,
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TEH_keys_load_fees (const struct TALER_DenominationHash *h_denom_pub, TEH_keys_load_fees (const struct TALER_DenominationHashP *h_denom_pub,
struct TALER_DenominationPublicKey *denom_pub, struct TALER_DenominationPublicKey *denom_pub,
struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta) struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta)
{ {

View File

@ -49,7 +49,7 @@ struct TEH_DenominationKey
/** /**
* Hash code of the denomination public key. * Hash code of the denomination public key.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Meta data about the type of the denomination, such as fees and validity * Meta data about the type of the denomination, such as fees and validity
@ -141,7 +141,8 @@ TEH_keys_update_states (void);
* or NULL if @a h_denom_pub could not be found * or NULL if @a h_denom_pub could not be found
*/ */
struct TEH_DenominationKey * struct TEH_DenominationKey *
TEH_keys_denomination_by_hash (const struct TALER_DenominationHash *h_denom_pub, TEH_keys_denomination_by_hash (const struct
TALER_DenominationHashP *h_denom_pub,
struct MHD_Connection *conn, struct MHD_Connection *conn,
MHD_RESULT *mret); MHD_RESULT *mret);
@ -162,29 +163,48 @@ TEH_keys_denomination_by_hash (const struct TALER_DenominationHash *h_denom_pub,
struct TEH_DenominationKey * struct TEH_DenominationKey *
TEH_keys_denomination_by_hash2 ( TEH_keys_denomination_by_hash2 (
struct TEH_KeyStateHandle *ksh, struct TEH_KeyStateHandle *ksh,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
struct MHD_Connection *conn, struct MHD_Connection *conn,
MHD_RESULT *mret); MHD_RESULT *mret);
/** /**
* Request to sign @a msg using the public key corresponding to * Request to sign @a msg using the public key corresponding to
* @a h_denom_pub. * @a h_denom_pub during a withdraw operation.
* *
* @param h_denom_pub hash of the public key to use to sign * @param h_denom_pub hash of the public key to use to sign
* @param bp blinded planchet to sign * @param bp blinded planchet to sign
* @param is_melt should we use the KDF for melting?
* @param[out] bs set to the blind signature on success * @param[out] bs set to the blind signature on success
* @return #TALER_EC_NONE on success * @return #TALER_EC_NONE on success
*/ */
enum TALER_ErrorCode enum TALER_ErrorCode
TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub, TEH_keys_denomination_sign_withdraw (
const struct TALER_BlindedPlanchet *bp, const struct TALER_DenominationHashP *h_denom_pub,
struct TALER_BlindedDenominationSignature *bs); const struct TALER_BlindedPlanchet *bp,
struct TALER_BlindedDenominationSignature *bs);
/**
* Request to sign @a msg using the public key corresponding to
* @a h_denom_pub during a refresh operation.
*
* @param h_denom_pub hash of the public key to use to sign
* @param bp blinded planchet to sign
* @param is_melt should we use the KDF for melting?
* @param[out] bs set to the blind signature on success
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
TEH_keys_denomination_sign_melt (
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_BlindedPlanchet *bp,
struct TALER_BlindedDenominationSignature *bs);
/** /**
* Request to derive CS @a r_pub using the denomination corresponding to @a h_denom_pub * Request to derive CS @a r_pub using the denomination corresponding to @a h_denom_pub
* and @a nonce. * and @a nonce for withdrawing.
* *
* @param h_denom_pub hash of the public key to use to derive r_pub * @param h_denom_pub hash of the public key to use to derive r_pub
* @param nonce withdraw/refresh nonce * @param nonce withdraw/refresh nonce
@ -192,8 +212,24 @@ TEH_keys_denomination_sign (const struct TALER_DenominationHash *h_denom_pub,
* @return #TALER_EC_NONE on success * @return #TALER_EC_NONE on success
*/ */
enum TALER_ErrorCode enum TALER_ErrorCode
TEH_keys_denomination_cs_r_pub ( TEH_keys_denomination_cs_r_pub_withdraw (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_CsNonce *nonce,
struct TALER_DenominationCSPublicRPairP *r_pub);
/**
* Request to derive CS @a r_pub using the denomination corresponding to @a h_denom_pub
* and @a nonce for melting.
*
* @param h_denom_pub hash of the public key to use to derive r_pub
* @param nonce withdraw/refresh nonce
* @param[out] r_pub where to write the result
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
TEH_keys_denomination_cs_r_pub_melt (
const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_CsNonce *nonce, const struct TALER_CsNonce *nonce,
struct TALER_DenominationCSPublicRPairP *r_pub); struct TALER_DenominationCSPublicRPairP *r_pub);
@ -210,7 +246,8 @@ TEH_keys_denomination_cs_r_pub (
* @param h_denom_pub hash of the public key to revoke * @param h_denom_pub hash of the public key to revoke
*/ */
void void
TEH_keys_denomination_revoke (const struct TALER_DenominationHash *h_denom_pub); TEH_keys_denomination_revoke (const struct
TALER_DenominationHashP *h_denom_pub);
/** /**
@ -387,7 +424,7 @@ TEH_keys_management_get_keys_handler (const struct TEH_RequestHandler *rh,
* #GNUNET_SYSERR on hard errors * #GNUNET_SYSERR on hard errors
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TEH_keys_load_fees (const struct TALER_DenominationHash *h_denom_pub, TEH_keys_load_fees (const struct TALER_DenominationHashP *h_denom_pub,
struct TALER_DenominationPublicKey *denom_pub, struct TALER_DenominationPublicKey *denom_pub,
struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta); struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta);

View File

@ -73,12 +73,12 @@ struct KycPoller
* Hash of the payto:// URI we are confirming to * Hash of the payto:// URI we are confirming to
* have finished the KYC for. * have finished the KYC for.
*/ */
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
/** /**
* Hash of the payto:// URI that was given to us for auth. * Hash of the payto:// URI that was given to us for auth.
*/ */
struct TALER_PaytoHash auth_h_payto; struct TALER_PaytoHashP auth_h_payto;
/** /**
* When will this request time out? * When will this request time out?

View File

@ -64,7 +64,7 @@ TEH_handler_management_auditors_AP_disable (
MHD_RESULT MHD_RESULT
TEH_handler_management_denominations_HDP_revoke ( TEH_handler_management_denominations_HDP_revoke (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const json_t *root); const json_t *root);

View File

@ -34,7 +34,7 @@
MHD_RESULT MHD_RESULT
TEH_handler_management_denominations_HDP_revoke ( TEH_handler_management_denominations_HDP_revoke (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const json_t *root) const json_t *root)
{ {
struct TALER_MasterSignatureP master_sig; struct TALER_MasterSignatureP master_sig;

View File

@ -234,7 +234,7 @@ TEH_handler_management_post_extensions (
/* Verify the signature */ /* Verify the signature */
{ {
struct TALER_ExtensionConfigHash h_config; struct TALER_ExtensionConfigHashP h_config;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_JSON_extensions_config_hash (extensions, &h_config) || TALER_JSON_extensions_config_hash (extensions, &h_config) ||

View File

@ -40,7 +40,7 @@ struct DenomSig
/** /**
* Hash of a denomination public key. * Hash of a denomination public key.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Master signature for the @e h_denom_pub. * Master signature for the @e h_denom_pub.

View File

@ -237,12 +237,23 @@ database_melt (struct MHD_Connection *connection,
MHD_RESULT mhd_ret = MHD_NO; MHD_RESULT mhd_ret = MHD_NO;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
qs = TEH_make_coin_known (&rmc->refresh_session.coin, for (unsigned int tries = 0; tries<MAX_TRANSACTION_COMMIT_RETRIES; tries++)
connection, {
&rmc->known_coin_id, qs = TEH_make_coin_known (&rmc->refresh_session.coin,
&mhd_ret); connection,
/* no transaction => no serialization failures should be possible */ &rmc->known_coin_id,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs); &mhd_ret);
if (GNUNET_DB_STATUS_SOFT_ERROR != qs)
break;
}
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{
GNUNET_break (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_DB_COMMIT_FAILED,
"make_coin_known");
}
if (qs < 0) if (qs < 0)
return mhd_ret; return mhd_ret;
} }
@ -362,7 +373,7 @@ check_melt_valid (struct MHD_Connection *connection,
if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit.abs_time)) if (GNUNET_TIME_absolute_is_past (dk->meta.expire_deposit.abs_time))
{ {
/* We are past deposit expiration time, but maybe this is a zombie? */ /* We are past deposit expiration time, but maybe this is a zombie? */
struct TALER_DenominationHash denom_hash; struct TALER_DenominationHashP denom_hash;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
/* Check that the coin is dirty (we have seen it before), as we will /* Check that the coin is dirty (we have seen it before), as we will
@ -425,7 +436,7 @@ TEH_handler_melt (struct MHD_Connection *connection,
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash", GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
&rmc.refresh_session.coin.denom_pub_hash), &rmc.refresh_session.coin.denom_pub_hash),
GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment", GNUNET_JSON_spec_fixed_auto ("age_commitment_hash",
&rmc.refresh_session.coin.h_age_commitment)), &rmc.refresh_session.coin.h_age_commitment)),
GNUNET_JSON_spec_fixed_auto ("confirm_sig", GNUNET_JSON_spec_fixed_auto ("confirm_sig",
&rmc.refresh_session.coin_sig), &rmc.refresh_session.coin_sig),
@ -440,10 +451,9 @@ TEH_handler_melt (struct MHD_Connection *connection,
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
memset (&rmc, memset (&rmc, 0, sizeof (rmc));
0,
sizeof (rmc));
rmc.refresh_session.coin.coin_pub = *coin_pub; rmc.refresh_session.coin.coin_pub = *coin_pub;
{ {
enum GNUNET_GenericReturnValue ret; enum GNUNET_GenericReturnValue ret;
ret = TALER_MHD_parse_json_data (connection, ret = TALER_MHD_parse_json_data (connection,
@ -452,8 +462,10 @@ TEH_handler_melt (struct MHD_Connection *connection,
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
return (GNUNET_SYSERR == ret) ? MHD_NO : MHD_YES; return (GNUNET_SYSERR == ret) ? MHD_NO : MHD_YES;
} }
rmc.have_rms = (NULL != json_object_get (root, rmc.have_rms = (NULL != json_object_get (root,
"rms")); "rms"));
{ {
MHD_RESULT res; MHD_RESULT res;

View File

@ -180,7 +180,7 @@ verify_and_execute_recoup_refresh (
struct RecoupContext pc; struct RecoupContext pc;
const struct TEH_DenominationKey *dk; const struct TEH_DenominationKey *dk;
MHD_RESULT mret; MHD_RESULT mret;
struct TALER_BlindedCoinHash h_blind; struct TALER_BlindedCoinHashP h_blind;
/* check denomination exists and is in recoup mode */ /* check denomination exists and is in recoup mode */
dk = TEH_keys_denomination_by_hash (&coin->denom_pub_hash, dk = TEH_keys_denomination_by_hash (&coin->denom_pub_hash,
@ -245,7 +245,7 @@ verify_and_execute_recoup_refresh (
} }
{ {
struct TALER_CoinPubHash c_hash; struct TALER_CoinPubHashP c_hash;
struct TALER_BlindedPlanchet blinded_planchet; struct TALER_BlindedPlanchet blinded_planchet;
if (GNUNET_OK != if (GNUNET_OK !=

View File

@ -42,7 +42,7 @@ struct RecoupContext
/** /**
* Hash identifying the withdraw request. * Hash identifying the withdraw request.
*/ */
struct TALER_BlindedCoinHash h_coin_ev; struct TALER_BlindedCoinHashP h_coin_ev;
/** /**
* Set by #recoup_transaction() to the reserve that will * Set by #recoup_transaction() to the reserve that will
@ -250,7 +250,7 @@ verify_and_execute_recoup (
(a bit later) check that this coin was indeed (a bit later) check that this coin was indeed
signed by us. */ signed by us. */
{ {
struct TALER_CoinPubHash c_hash; struct TALER_CoinPubHashP c_hash;
struct TALER_BlindedPlanchet blinded_planchet; struct TALER_BlindedPlanchet blinded_planchet;
if (GNUNET_OK != if (GNUNET_OK !=

View File

@ -216,7 +216,7 @@ check_commitment (struct RevealContext *rctx,
{ {
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
ec = TEH_keys_denomination_cs_r_pub ( ec = TEH_keys_denomination_cs_r_pub_melt (
&rctx->rrcs[j].h_denom_pub, &rctx->rrcs[j].h_denom_pub,
&nonces[aoff], &nonces[aoff],
&alg_values->details.cs_values); &alg_values->details.cs_values);
@ -277,9 +277,9 @@ check_commitment (struct RevealContext *rctx,
union TALER_DenominationBlindingKeyP bks; union TALER_DenominationBlindingKeyP bks;
const struct TALER_ExchangeWithdrawValues *alg_value const struct TALER_ExchangeWithdrawValues *alg_value
= &rctx->rrcs[j].exchange_vals; = &rctx->rrcs[j].exchange_vals;
struct TALER_PlanchetDetail pd; struct TALER_PlanchetDetail pd = {0};
struct TALER_AgeCommitmentHash *hac = NULL; struct TALER_AgeCommitmentHash *hac = NULL;
struct TALER_CoinPubHash c_hash; struct TALER_CoinPubHashP c_hash;
struct TALER_PlanchetMasterSecretP ps; struct TALER_PlanchetMasterSecretP ps;
rcd->dk = &rctx->dks[j]->denom_pub; rcd->dk = &rctx->dks[j]->denom_pub;
@ -296,17 +296,23 @@ check_commitment (struct RevealContext *rctx,
* the transfer_secret and the old age commitment. */ * the transfer_secret and the old age commitment. */
if (NULL != rctx->old_age_commitment) if (NULL != rctx->old_age_commitment)
{ {
struct TALER_AgeCommitment ac = {0}; uint64_t seed = (uint64_t) ts.key.bits[0]
| (uint64_t) ts.key.bits[1] << 32;
struct TALER_AgeCommitmentProof acp = {
/* we only need the commitment, not the proof, for the call to
* TALER_age_commitment_derive. */
.commitment = *(rctx->old_age_commitment)
};
struct TALER_AgeCommitmentProof nacp = {0};
struct TALER_AgeCommitmentHash h = {0}; struct TALER_AgeCommitmentHash h = {0};
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_age_commitment_derive ( TALER_age_commitment_derive (
rctx->old_age_commitment, &acp,
ts.key.bits[0], seed,
&ac)); &nacp));
TALER_age_commitment_hash (&ac, &h);
TALER_age_commitment_hash (&nacp.commitment, &h);
hac = &h; hac = &h;
} }
@ -590,7 +596,7 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
if (TEH_age_restriction_enabled && if (TEH_age_restriction_enabled &&
((NULL == old_age_commitment_json) != ((NULL == old_age_commitment_json) !=
TALER_AgeCommitmentHash_isNullOrZero ( TALER_AgeCommitmentHash_isNullOrZero (
&rctx->melt.session.h_age_commitment))) &rctx->melt.session.coin.h_age_commitment)))
{ {
GNUNET_break (0); GNUNET_break (0);
return MHD_NO; return MHD_NO;
@ -602,7 +608,7 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
(NULL != old_age_commitment_json)) (NULL != old_age_commitment_json))
{ {
enum GNUNET_GenericReturnValue res; enum GNUNET_GenericReturnValue res;
struct TALER_AgeCommitment *oac = rctx->old_age_commitment; struct TALER_AgeCommitment *oac;
size_t ng = json_array_size (old_age_commitment_json); size_t ng = json_array_size (old_age_commitment_json);
bool failed = true; bool failed = true;
@ -610,10 +616,10 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
GNUNET_assert (ng == GNUNET_assert (ng ==
TALER_extensions_age_restriction_num_groups ()); TALER_extensions_age_restriction_num_groups ());
oac = GNUNET_new (struct TALER_AgeCommitment); rctx->old_age_commitment = GNUNET_new (struct TALER_AgeCommitment);
oac = rctx->old_age_commitment;
oac->mask = TEH_age_mask; oac->mask = TEH_age_mask;
oac->num_pub = ng; oac->num = ng;
oac->num_priv = 0; /* no private keys are needed for the reveal phase */
oac->pub = GNUNET_new_array (ng, struct TALER_AgeCommitmentPublicKeyP); oac->pub = GNUNET_new_array (ng, struct TALER_AgeCommitmentPublicKeyP);
/* Extract old age commitment */ /* Extract old age commitment */
@ -630,7 +636,8 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
ac_spec, ac_spec,
i, i,
-1); -1);
GNUNET_break (GNUNET_OK != res);
GNUNET_break_op (GNUNET_OK == res);
if (GNUNET_OK != res) if (GNUNET_OK != res)
goto clean_age; goto clean_age;
} }
@ -640,12 +647,9 @@ resolve_refreshes_reveal_denominations (struct MHD_Connection *connection,
struct TALER_AgeCommitmentHash hac = {0}; struct TALER_AgeCommitmentHash hac = {0};
TALER_age_commitment_hash (oac, &hac); TALER_age_commitment_hash (oac, &hac);
if (0 != memcmp (&hac, if (0 != memcmp (&hac,
&rctx->melt.session.h_age_commitment, &rctx->melt.session.coin.h_age_commitment,
sizeof(struct TALER_AgeCommitmentHash))) sizeof(struct TALER_AgeCommitmentHash)))
{
GNUNET_break (0);
goto clean_age; goto clean_age;
}
} }
failed = false; failed = false;
@ -654,7 +658,10 @@ clean_age:
if (failed) if (failed)
{ {
TALER_age_commitment_free (oac); TALER_age_commitment_free (oac);
return (GNUNET_NO == res) ? MHD_YES : MHD_NO; return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_EXCHANGE_REFRESHES_REVEAL_AGE_RESTRICTION_COMMITMENT_INVALID,
"old_age_commitment");
} }
} }
@ -733,7 +740,9 @@ clean_age:
{ {
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
ec = TEH_keys_denomination_sign ( // FIXME: replace with a batch call that
// passes all coins in once go!
ec = TEH_keys_denomination_sign_melt (
&rrcs[i].h_denom_pub, &rrcs[i].h_denom_pub,
&rcds[i].blinded_planchet, &rcds[i].blinded_planchet,
&rrcs[i].coin_sig); &rrcs[i].coin_sig);
@ -911,7 +920,7 @@ TEH_handler_reveal (struct TEH_RequestContext *rc,
json_t *transfer_privs; json_t *transfer_privs;
json_t *link_sigs; json_t *link_sigs;
json_t *new_denoms_h; json_t *new_denoms_h;
json_t *old_age_commitment = NULL; json_t *old_age_commitment;
struct RevealContext rctx; struct RevealContext rctx;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("transfer_pub", GNUNET_JSON_spec_fixed_auto ("transfer_pub",

View File

@ -204,7 +204,7 @@ static MHD_RESULT
verify_and_execute_refund (struct MHD_Connection *connection, verify_and_execute_refund (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_Refund *refund) struct TALER_EXCHANGEDB_Refund *refund)
{ {
struct TALER_DenominationHash denom_hash; struct TALER_DenominationHashP denom_hash;
struct RefundContext rctx = { struct RefundContext rctx = {
.refund = refund .refund = refund
}; };

View File

@ -61,7 +61,7 @@ TEH_RESPONSE_compile_transaction_history (
{ {
const struct TALER_EXCHANGEDB_DepositListEntry *deposit = const struct TALER_EXCHANGEDB_DepositListEntry *deposit =
pos->details.deposit; pos->details.deposit;
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
TALER_merchant_wire_signature_hash (deposit->receiver_wire_account, TALER_merchant_wire_signature_hash (deposit->receiver_wire_account,
&deposit->wire_salt, &deposit->wire_salt,
@ -111,6 +111,9 @@ TEH_RESPONSE_compile_transaction_history (
GNUNET_JSON_pack_data_auto ("h_denom_pub", GNUNET_JSON_pack_data_auto ("h_denom_pub",
&deposit->h_denom_pub), &deposit->h_denom_pub),
GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_allow_null (
deposit->no_age_commitment ?
GNUNET_JSON_pack_string (
"h_age_commitment", NULL) :
GNUNET_JSON_pack_data_auto ("h_age_commitment", GNUNET_JSON_pack_data_auto ("h_age_commitment",
&deposit->h_age_commitment)), &deposit->h_age_commitment)),
GNUNET_JSON_pack_data_auto ("coin_sig", GNUNET_JSON_pack_data_auto ("coin_sig",
@ -146,7 +149,7 @@ TEH_RESPONSE_compile_transaction_history (
/* Age restriction is optional. We communicate a NULL value to /* Age restriction is optional. We communicate a NULL value to
* JSON_PACK below */ * JSON_PACK below */
if (! TALER_AgeCommitmentHash_isNullOrZero (&melt->h_age_commitment)) if (! melt->no_age_commitment)
phac = &melt->h_age_commitment; phac = &melt->h_age_commitment;
if (0 != if (0 !=
@ -410,7 +413,7 @@ TEH_RESPONSE_compile_transaction_history (
MHD_RESULT MHD_RESULT
TEH_RESPONSE_reply_unknown_denom_pub_hash ( TEH_RESPONSE_reply_unknown_denom_pub_hash (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph) const struct TALER_DenominationHashP *dph)
{ {
struct TALER_ExchangePublicKeyP epub; struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig; struct TALER_ExchangeSignatureP esig;
@ -456,7 +459,7 @@ TEH_RESPONSE_reply_unknown_denom_pub_hash (
MHD_RESULT MHD_RESULT
TEH_RESPONSE_reply_expired_denom_pub_hash ( TEH_RESPONSE_reply_expired_denom_pub_hash (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph, const struct TALER_DenominationHashP *dph,
enum TALER_ErrorCode ec, enum TALER_ErrorCode ec,
const char *oper) const char *oper)
{ {
@ -509,7 +512,7 @@ TEH_RESPONSE_reply_expired_denom_pub_hash (
MHD_RESULT MHD_RESULT
TEH_RESPONSE_reply_invalid_denom_cipher_for_operation ( TEH_RESPONSE_reply_invalid_denom_cipher_for_operation (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph) const struct TALER_DenominationHashP *dph)
{ {
struct TALER_ExchangePublicKeyP epub; struct TALER_ExchangePublicKeyP epub;
struct TALER_ExchangeSignatureP esig; struct TALER_ExchangeSignatureP esig;

View File

@ -58,7 +58,7 @@ TEH_RESPONSE_compile_reserve_history (
MHD_RESULT MHD_RESULT
TEH_RESPONSE_reply_unknown_denom_pub_hash ( TEH_RESPONSE_reply_unknown_denom_pub_hash (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph); const struct TALER_DenominationHashP *dph);
/** /**
@ -74,7 +74,7 @@ TEH_RESPONSE_reply_unknown_denom_pub_hash (
MHD_RESULT MHD_RESULT
TEH_RESPONSE_reply_expired_denom_pub_hash ( TEH_RESPONSE_reply_expired_denom_pub_hash (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph, const struct TALER_DenominationHashP *dph,
enum TALER_ErrorCode ec, enum TALER_ErrorCode ec,
const char *oper); const char *oper);
@ -89,7 +89,7 @@ TEH_RESPONSE_reply_expired_denom_pub_hash (
MHD_RESULT MHD_RESULT
TEH_RESPONSE_reply_invalid_denom_cipher_for_operation ( TEH_RESPONSE_reply_invalid_denom_cipher_for_operation (
struct MHD_Connection *connection, struct MHD_Connection *connection,
const struct TALER_DenominationHash *dph); const struct TALER_DenominationHashP *dph);
/** /**

View File

@ -51,7 +51,7 @@ struct AggregatedDepositDetail
/** /**
* Hash of the contract terms. * Hash of the contract terms.
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
/** /**
* Coin's public key of the deposited coin. * Coin's public key of the deposited coin.
@ -260,6 +260,7 @@ struct WtidTransactionContext
* @param rowid which row in the DB is the information from (for diagnostics), ignored * @param rowid which row in the DB is the information from (for diagnostics), ignored
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
* @param account_payto_uri where the funds were sent * @param account_payto_uri where the funds were sent
* @param h_payto hash over @a account_payto_uri as it is in the DB
* @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
* @param h_contract_terms which proposal was this payment about * @param h_contract_terms which proposal was this payment about
* @param denom_pub denomination public key of the @a coin_pub (ignored) * @param denom_pub denomination public key of the @a coin_pub (ignored)
@ -272,8 +273,9 @@ handle_deposit_data (void *cls,
uint64_t rowid, uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri, const char *account_payto_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *deposit_value, const struct TALER_Amount *deposit_value,

View File

@ -94,7 +94,7 @@ struct WithdrawContext
/** /**
* Hash of the (blinded) message to be signed by the Exchange. * Hash of the (blinded) message to be signed by the Exchange.
*/ */
struct TALER_BlindedCoinHash h_coin_envelope; struct TALER_BlindedCoinHashP h_coin_envelope;
/** /**
* Value of the coin being exchanged (matching the denomination key) * Value of the coin being exchanged (matching the denomination key)
@ -505,7 +505,7 @@ TEH_handler_withdraw (struct TEH_RequestContext *rc,
} }
/* Sign before transaction! */ /* Sign before transaction! */
ec = TEH_keys_denomination_sign ( ec = TEH_keys_denomination_sign_withdraw (
&wc.collectable.denom_pub_hash, &wc.collectable.denom_pub_hash,
&wc.blinded_planchet, &wc.blinded_planchet,
&wc.collectable.sig); &wc.collectable.sig);

View File

@ -55,6 +55,7 @@ DROP TABLE IF EXISTS reserves CASCADE;
DROP TABLE IF EXISTS denomination_revocations CASCADE; DROP TABLE IF EXISTS denomination_revocations CASCADE;
DROP TABLE IF EXISTS denominations CASCADE; DROP TABLE IF EXISTS denominations CASCADE;
DROP FUNCTION IF EXISTS exchange_do_withdraw(bigint,int,bytea,bytea,bytea,bytea,bytea,bigint,bigint) ; DROP FUNCTION IF EXISTS exchange_do_withdraw(bigint,int,bytea,bytea,bytea,bytea,bytea,bigint,bigint) ;
DROP FUNCTION IF EXISTS exchange_do_withdraw_limit_check(bytea,bigint,bigint,int) ; DROP FUNCTION IF EXISTS exchange_do_withdraw_limit_check(bytea,bigint,bigint,int) ;
@ -72,4 +73,5 @@ DROP FUNCTION IF EXISTS exchange_do_recoup_to_reserve;
-- FIXME: drop other stored functions! -- FIXME: drop other stored functions!
-- And we're out of here... -- And we're out of here...
COMMIT; COMMIT;

View File

@ -88,6 +88,14 @@ CREATE TABLE IF NOT EXISTS wire_targets_default
PARTITION OF wire_targets PARTITION OF wire_targets
FOR VALUES WITH (MODULUS 1, REMAINDER 0); FOR VALUES WITH (MODULUS 1, REMAINDER 0);
-- FIXME partition by serial_id rather than h_payto,
-- it is used more in join conditions - crucial for sharding to select this.
-- Author: (Boss Marco)
CREATE INDEX IF NOT EXISTS wire_targets_serial_id_index
ON wire_targets
(wire_target_serial_id
);
CREATE TABLE IF NOT EXISTS reserves CREATE TABLE IF NOT EXISTS reserves
(reserve_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY (reserve_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY
,reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32) ,reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)
@ -196,7 +204,7 @@ CREATE INDEX IF NOT EXISTS reserves_close_by_reserve_pub_index
CREATE TABLE IF NOT EXISTS reserves_out CREATE TABLE IF NOT EXISTS reserves_out
(reserve_out_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY -- UNIQUE (reserve_out_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY -- UNIQUE
,h_blind_ev BYTEA CHECK (LENGTH(h_blind_ev)=64) -- UNIQUE ,h_blind_ev BYTEA CHECK (LENGTH(h_blind_ev)=64) UNIQUE
,denominations_serial INT8 NOT NULL REFERENCES denominations (denominations_serial) ,denominations_serial INT8 NOT NULL REFERENCES denominations (denominations_serial)
,denom_sig BYTEA NOT NULL ,denom_sig BYTEA NOT NULL
,reserve_uuid INT8 NOT NULL -- REFERENCES reserves (reserve_uuid) ON DELETE CASCADE ,reserve_uuid INT8 NOT NULL -- REFERENCES reserves (reserve_uuid) ON DELETE CASCADE
@ -311,7 +319,7 @@ CREATE TABLE IF NOT EXISTS known_coins
(known_coin_id BIGINT GENERATED BY DEFAULT AS IDENTITY -- UNIQUE (known_coin_id BIGINT GENERATED BY DEFAULT AS IDENTITY -- UNIQUE
,denominations_serial INT8 NOT NULL REFERENCES denominations (denominations_serial) ON DELETE CASCADE ,denominations_serial INT8 NOT NULL REFERENCES denominations (denominations_serial) ON DELETE CASCADE
,coin_pub BYTEA NOT NULL PRIMARY KEY CHECK (LENGTH(coin_pub)=32) ,coin_pub BYTEA NOT NULL PRIMARY KEY CHECK (LENGTH(coin_pub)=32)
,age_hash BYTEA CHECK (LENGTH(age_hash)=32) ,age_commitment_hash BYTEA CHECK (LENGTH(age_commitment_hash)=32)
,denom_sig BYTEA NOT NULL ,denom_sig BYTEA NOT NULL
,remaining_val INT8 NOT NULL ,remaining_val INT8 NOT NULL
,remaining_frac INT4 NOT NULL ,remaining_frac INT4 NOT NULL
@ -325,8 +333,8 @@ COMMENT ON COLUMN known_coins.coin_pub
IS 'EdDSA public key of the coin'; IS 'EdDSA public key of the coin';
COMMENT ON COLUMN known_coins.remaining_val COMMENT ON COLUMN known_coins.remaining_val
IS 'Value of the coin that remains to be spent'; IS 'Value of the coin that remains to be spent';
COMMENT ON COLUMN known_coins.age_hash COMMENT ON COLUMN known_coins.age_commitment_hash
IS 'Optional hash for age restrictions as per DD 24 (active if denom_type has the respective bit set)'; IS 'Optional hash of the age commitment for age restrictions as per DD 24 (active if denom_type has the respective bit set)';
COMMENT ON COLUMN known_coins.denom_sig COMMENT ON COLUMN known_coins.denom_sig
IS 'This is the signature of the exchange that affirms that the coin is a valid coin. The specific signature type depends on denom_type of the denomination.'; IS 'This is the signature of the exchange that affirms that the coin is a valid coin. The specific signature type depends on denom_type of the denomination.';
CREATE TABLE IF NOT EXISTS known_coins_default CREATE TABLE IF NOT EXISTS known_coins_default
@ -358,7 +366,7 @@ COMMENT ON COLUMN refresh_commitments.rc
COMMENT ON COLUMN refresh_commitments.old_coin_pub COMMENT ON COLUMN refresh_commitments.old_coin_pub
IS 'Coin being melted in the refresh process.'; IS 'Coin being melted in the refresh process.';
COMMENT ON COLUMN refresh_commitments.h_age_commitment COMMENT ON COLUMN refresh_commitments.h_age_commitment
IS '(optional) age commitment that was involved in the minting process of the coin, may be NULL.'; IS 'The (optional) age commitment that was involved in the minting process of the coin, may be NULL.';
CREATE TABLE IF NOT EXISTS refresh_commitments_default CREATE TABLE IF NOT EXISTS refresh_commitments_default
PARTITION OF refresh_commitments PARTITION OF refresh_commitments
FOR VALUES WITH (MODULUS 1, REMAINDER 0); FOR VALUES WITH (MODULUS 1, REMAINDER 0);
@ -581,7 +589,7 @@ CREATE INDEX IF NOT EXISTS wire_out_by_wire_target_serial_id_index
CREATE TABLE IF NOT EXISTS aggregation_tracking CREATE TABLE IF NOT EXISTS aggregation_tracking
(aggregation_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY -- UNIQUE (aggregation_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY -- UNIQUE
,deposit_serial_id INT8 PRIMARY KEY -- REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE ,deposit_serial_id INT8 PRIMARY KEY -- REFERENCES deposits (deposit_serial_id) ON DELETE CASCADE
,wtid_raw BYTEA CONSTRAINT wire_out_ref REFERENCES wire_out(wtid_raw) ON DELETE CASCADE DEFERRABLE ,wtid_raw BYTEA NOT NULL CONSTRAINT wire_out_ref REFERENCES wire_out(wtid_raw) ON DELETE CASCADE DEFERRABLE
) )
PARTITION BY HASH (deposit_serial_id); PARTITION BY HASH (deposit_serial_id);
COMMENT ON TABLE aggregation_tracking COMMENT ON TABLE aggregation_tracking
@ -634,7 +642,7 @@ CREATE TABLE IF NOT EXISTS recoup
,recoup_timestamp INT8 NOT NULL ,recoup_timestamp INT8 NOT NULL
,reserve_out_serial_id INT8 NOT NULL -- REFERENCES reserves_out (reserve_out_serial_id) ON DELETE CASCADE ,reserve_out_serial_id INT8 NOT NULL -- REFERENCES reserves_out (reserve_out_serial_id) ON DELETE CASCADE
) )
PARTITION BY RANGE (known_coin_id); PARTITION BY HASH (known_coin_id);
COMMENT ON TABLE recoup COMMENT ON TABLE recoup
IS 'Information about recoups that were executed between a coin and a reserve. In this type of recoup, the amount is credited back to the reserve from which the coin originated.'; IS 'Information about recoups that were executed between a coin and a reserve. In this type of recoup, the amount is credited back to the reserve from which the coin originated.';
COMMENT ON COLUMN recoup.known_coin_id COMMENT ON COLUMN recoup.known_coin_id
@ -647,7 +655,7 @@ COMMENT ON COLUMN recoup.coin_blind
IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the withdraw operation.'; IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the withdraw operation.';
CREATE TABLE IF NOT EXISTS recoup_default CREATE TABLE IF NOT EXISTS recoup_default
PARTITION OF recoup PARTITION OF recoup
DEFAULT; FOR VALUES WITH (MODULUS 1, REMAINDER 0);
CREATE INDEX IF NOT EXISTS recoup_by_recoup_uuid_index CREATE INDEX IF NOT EXISTS recoup_by_recoup_uuid_index
ON recoup ON recoup
@ -670,7 +678,7 @@ CREATE TABLE IF NOT EXISTS recoup_refresh
,recoup_timestamp INT8 NOT NULL ,recoup_timestamp INT8 NOT NULL
,rrc_serial INT8 NOT NULL -- REFERENCES refresh_revealed_coins (rrc_serial) ON DELETE CASCADE -- UNIQUE ,rrc_serial INT8 NOT NULL -- REFERENCES refresh_revealed_coins (rrc_serial) ON DELETE CASCADE -- UNIQUE
) )
PARTITION BY RANGE (known_coin_id); PARTITION BY HASH (known_coin_id);
COMMENT ON TABLE recoup_refresh COMMENT ON TABLE recoup_refresh
IS 'Table of coins that originated from a refresh operation and that were recouped. Links the (fresh) coin to the melted operation (and thus the old coin). A recoup on a refreshed coin credits the old coin and debits the fresh coin.'; IS 'Table of coins that originated from a refresh operation and that were recouped. Links the (fresh) coin to the melted operation (and thus the old coin). A recoup on a refreshed coin credits the old coin and debits the fresh coin.';
COMMENT ON COLUMN recoup_refresh.known_coin_id COMMENT ON COLUMN recoup_refresh.known_coin_id
@ -681,7 +689,7 @@ COMMENT ON COLUMN recoup_refresh.coin_blind
IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the refresh operation.'; IS 'Denomination blinding key used when creating the blinded coin from the planchet. Secret revealed during the recoup to provide the linkage between the coin and the refresh operation.';
CREATE TABLE IF NOT EXISTS recoup_refresh_default CREATE TABLE IF NOT EXISTS recoup_refresh_default
PARTITION OF recoup_refresh PARTITION OF recoup_refresh
DEFAULT; FOR VALUES WITH (MODULUS 1, REMAINDER 0);
CREATE INDEX IF NOT EXISTS recoup_refresh_by_recoup_refresh_uuid_index CREATE INDEX IF NOT EXISTS recoup_refresh_by_recoup_refresh_uuid_index
ON recoup_refresh ON recoup_refresh
@ -701,7 +709,7 @@ CREATE TABLE IF NOT EXISTS prewire
,failed BOOLEAN NOT NULL DEFAULT false ,failed BOOLEAN NOT NULL DEFAULT false
,buf BYTEA NOT NULL ,buf BYTEA NOT NULL
) )
PARTITION BY RANGE (prewire_uuid); PARTITION BY HASH (prewire_uuid);
COMMENT ON TABLE prewire COMMENT ON TABLE prewire
IS 'pre-commit data for wire transfers we are about to execute'; IS 'pre-commit data for wire transfers we are about to execute';
COMMENT ON COLUMN prewire.failed COMMENT ON COLUMN prewire.failed
@ -712,7 +720,7 @@ COMMENT ON COLUMN prewire.buf
IS 'serialized data to send to the bank to execute the wire transfer'; IS 'serialized data to send to the bank to execute the wire transfer';
CREATE TABLE IF NOT EXISTS prewire_default CREATE TABLE IF NOT EXISTS prewire_default
PARTITION OF prewire PARTITION OF prewire
DEFAULT; FOR VALUES WITH (MODULUS 1, REMAINDER 0);
CREATE INDEX IF NOT EXISTS prewire_by_finished_index CREATE INDEX IF NOT EXISTS prewire_by_finished_index
ON prewire ON prewire
@ -762,6 +770,9 @@ COMMENT ON COLUMN cs_nonce_locks.op_hash
IS 'hash (RC for refresh, blind coin hash for withdraw) the nonce may be used with'; IS 'hash (RC for refresh, blind coin hash for withdraw) the nonce may be used with';
COMMENT ON COLUMN cs_nonce_locks.max_denomination_serial COMMENT ON COLUMN cs_nonce_locks.max_denomination_serial
IS 'Maximum number of a CS denomination serial the nonce could be used with, for GC'; IS 'Maximum number of a CS denomination serial the nonce could be used with, for GC';
CREATE TABLE IF NOT EXISTS cs_nonce_locks_default
PARTITION OF cs_nonce_locks
FOR VALUES WITH (MODULUS 1, REMAINDER 0);
CREATE TABLE IF NOT EXISTS work_shards CREATE TABLE IF NOT EXISTS work_shards
@ -828,6 +839,225 @@ CREATE INDEX IF NOT EXISTS revolving_work_shards_by_job_name_active_last_attempt
); );
-- Partitions
CREATE OR REPLACE FUNCTION create_table_partition(
source_table_name VARCHAR
,modulus INTEGER
,num_partitions INTEGER
)
RETURNS VOID
LANGUAGE plpgsql
AS $$
BEGIN
RAISE NOTICE 'Creating partition %_%', source_table_name, num_partitions;
EXECUTE FORMAT(
'CREATE TABLE IF NOT EXISTS %I '
'PARTITION OF %I '
'FOR VALUES WITH (MODULUS %s, REMAINDER %s)'
,source_table_name || '_' || num_partitions
,source_table_name
,modulus
,num_partitions-1
);
END
$$;
CREATE OR REPLACE FUNCTION detach_default_partitions()
RETURNS VOID
LANGUAGE plpgsql
AS $$
BEGIN
RAISE NOTICE 'Detaching all default table partitions';
ALTER TABLE IF EXISTS wire_targets
DETACH PARTITION wire_targets_default;
ALTER TABLE IF EXISTS reserves
DETACH PARTITION reserves_default;
ALTER TABLE IF EXISTS reserves_in
DETACH PARTITION reserves_in_default;
ALTER TABLE IF EXISTS reserves_close
DETACH PARTITION reserves_close_default;
ALTER TABLE IF EXISTS reserves_out
DETACH PARTITION reserves_out_default;
ALTER TABLE IF EXISTS known_coins
DETACH PARTITION known_coins_default;
ALTER TABLE IF EXISTS refresh_commitments
DETACH PARTITION refresh_commitments_default;
ALTER TABLE IF EXISTS refresh_revealed_coins
DETACH PARTITION refresh_revealed_coins_default;
ALTER TABLE IF EXISTS refresh_transfer_keys
DETACH PARTITION refresh_transfer_keys_default;
ALTER TABLE IF EXISTS deposits
DETACH PARTITION deposits_default;
ALTER TABLE IF EXISTS refunds
DETACH PARTITION refunds_default;
ALTER TABLE IF EXISTS wire_out
DETACH PARTITION wire_out_default;
ALTER TABLE IF EXISTS aggregation_tracking
DETACH PARTITION aggregation_tracking_default;
ALTER TABLE IF EXISTS recoup
DETACH PARTITION recoup_default;
ALTER TABLE IF EXISTS recoup_refresh
DETACH PARTITION recoup_refresh_default;
ALTER TABLE IF EXISTS prewire
DETACH PARTITION prewire_default;
ALTER TABLE IF EXISTS cs_nonce_locks
DETACH partition cs_nonce_locks_default;
END
$$;
COMMENT ON FUNCTION detach_default_partitions
IS 'We need to drop default and create new one before deleting the default partitions
otherwise constraints get lost too';
CREATE OR REPLACE FUNCTION drop_default_partitions()
RETURNS VOID
LANGUAGE plpgsql
AS $$
BEGIN
RAISE NOTICE 'Dropping default table partitions';
DROP TABLE IF EXISTS wire_targets_default;
DROP TABLE IF EXISTS reserves_default;
DROP TABLE IF EXISTS reserves_in_default;
DROP TABLE IF EXISTS reserves_close_default;
DROP TABLE IF EXISTS reserves_out_default;
DROP TABLE IF EXISTS known_coins_default;
DROP TABLE IF EXISTS refresh_commitments_default;
DROP TABLE IF EXISTS refresh_revealed_coins_default;
DROP TABLE IF EXISTS refresh_transfer_keys_default;
DROP TABLE IF EXISTS deposits_default;
DROP TABLE IF EXISTS refunds_default;
DROP TABLE IF EXISTS wire_out_default;
DROP TABLE IF EXISTS aggregation_tracking_default;
DROP TABLE IF EXISTS recoup_default;
DROP TABLE IF EXISTS recoup_refresh_default;
DROP TABLE IF EXISTS prewire_default;
DROP TABLE IF EXISTS cs_nonce_locks_default;
END
$$;
CREATE OR REPLACE FUNCTION create_partitions(
num_partitions INTEGER
)
RETURNS VOID
LANGUAGE plpgsql
AS $$
DECLARE
modulus INTEGER;
BEGIN
modulus := num_partitions;
PERFORM detach_default_partitions();
LOOP
PERFORM create_table_partition(
'wire_targets'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'reserves'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'reserves_in'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'reserves_close'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'reserves_out'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'known_coins'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'refresh_commitments'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'refresh_revealed_coins'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'refresh_transfer_keys'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'deposits'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'refunds'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'wire_out'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'aggregation_tracking'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'recoup'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'recoup_refresh'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'prewire'
,modulus
,num_partitions
);
PERFORM create_table_partition(
'cs_nonce_locks'
,modulus
,num_partitions
);
num_partitions=num_partitions-1;
EXIT WHEN num_partitions=0;
END LOOP;
PERFORM drop_default_partitions();
END
$$;
-- Stored procedures -- Stored procedures
@ -1078,6 +1308,23 @@ COMMENT ON FUNCTION exchange_do_withdraw_limit_check(INT8, INT8, INT8, INT4)
IS 'Check whether the withdrawals from the given reserve since the given time are below the given threshold'; IS 'Check whether the withdrawals from the given reserve since the given time are below the given threshold';
-- NOTE: experiment, currently dead, see postgres_Start_deferred_wire_out;
-- now done inline. FIXME: Remove code here once inline version is confirmed working nicely!
CREATE OR REPLACE PROCEDURE defer_wire_out()
LANGUAGE plpgsql
AS $$
BEGIN
IF EXISTS (
SELECT 1
FROM information_Schema.constraint_column_usage
WHERE table_name='wire_out'
AND constraint_name='wire_out_ref')
THEN
SET CONSTRAINTS wire_out_ref DEFERRED;
END IF;
END $$;
CREATE OR REPLACE FUNCTION exchange_do_deposit( CREATE OR REPLACE FUNCTION exchange_do_deposit(
@ -1131,7 +1378,7 @@ INSERT INTO wire_targets
VALUES VALUES
(in_h_payto (in_h_payto
,in_receiver_wire_account) ,in_receiver_wire_account)
ON CONFLICT (h_payto) DO NOTHING ON CONFLICT DO NOTHING -- for CONFLICT ON (h_payto)
RETURNING wire_target_serial_id INTO wtsi; RETURNING wire_target_serial_id INTO wtsi;
IF NOT FOUND IF NOT FOUND
@ -1259,6 +1506,7 @@ CREATE OR REPLACE FUNCTION exchange_do_melt(
IN in_old_coin_pub BYTEA, IN in_old_coin_pub BYTEA,
IN in_old_coin_sig BYTEA, IN in_old_coin_sig BYTEA,
IN in_known_coin_id INT8, -- not used, but that's OK IN in_known_coin_id INT8, -- not used, but that's OK
IN in_h_age_commitment BYTEA,
IN in_noreveal_index INT4, IN in_noreveal_index INT4,
IN in_zombie_required BOOLEAN, IN in_zombie_required BOOLEAN,
OUT out_balance_ok BOOLEAN, OUT out_balance_ok BOOLEAN,
@ -1281,6 +1529,7 @@ INSERT INTO refresh_commitments
,old_coin_sig ,old_coin_sig
,amount_with_fee_val ,amount_with_fee_val
,amount_with_fee_frac ,amount_with_fee_frac
,h_age_commitment
,noreveal_index ,noreveal_index
) )
VALUES VALUES
@ -1289,6 +1538,7 @@ INSERT INTO refresh_commitments
,in_old_coin_sig ,in_old_coin_sig
,in_amount_with_fee_val ,in_amount_with_fee_val
,in_amount_with_fee_frac ,in_amount_with_fee_frac
,in_h_age_commitment
,in_noreveal_index) ,in_noreveal_index)
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;

View File

@ -35,10 +35,14 @@ static enum GNUNET_DB_QueryStatus
irbt_cb_table_denominations (struct PostgresClosure *pg, irbt_cb_table_denominations (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td) const struct TALER_EXCHANGEDB_TableData *td)
{ {
struct TALER_DenominationHash denom_hash; struct TALER_DenominationHashP denom_hash;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial), GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&denom_hash), GNUNET_PQ_query_param_auto_from_type (&denom_hash),
GNUNET_PQ_query_param_uint32 (
&td->details.denominations.denom_type),
GNUNET_PQ_query_param_uint32 (
&td->details.denominations.age_mask),
TALER_PQ_query_param_denom_pub ( TALER_PQ_query_param_denom_pub (
&td->details.denominations.denom_pub), &td->details.denominations.denom_pub),
GNUNET_PQ_query_param_auto_from_type ( GNUNET_PQ_query_param_auto_from_type (
@ -109,14 +113,17 @@ static enum GNUNET_DB_QueryStatus
irbt_cb_table_wire_targets (struct PostgresClosure *pg, irbt_cb_table_wire_targets (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td) const struct TALER_EXCHANGEDB_TableData *td)
{ {
struct TALER_PaytoHash payto_hash; struct TALER_PaytoHashP payto_hash;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&payto_hash), GNUNET_PQ_query_param_auto_from_type (&payto_hash),
GNUNET_PQ_query_param_string ( GNUNET_PQ_query_param_string (
td->details.wire_targets.payto_uri), td->details.wire_targets.payto_uri),
GNUNET_PQ_query_param_auto_from_type ( GNUNET_PQ_query_param_auto_from_type (
&td->details.wire_targets.kyc_ok), &td->details.wire_targets.kyc_ok),
GNUNET_PQ_query_param_string ( NULL == td->details.wire_targets.external_id
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_string (
td->details.wire_targets.external_id), td->details.wire_targets.external_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -260,13 +267,12 @@ static enum GNUNET_DB_QueryStatus
irbt_cb_table_auditors (struct PostgresClosure *pg, irbt_cb_table_auditors (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td) const struct TALER_EXCHANGEDB_TableData *td)
{ {
uint8_t is_active = td->details.auditors.is_active ? 1 : 0;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial), GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_auto_from_type (&td->details.auditors.auditor_pub), GNUNET_PQ_query_param_auto_from_type (&td->details.auditors.auditor_pub),
GNUNET_PQ_query_param_string (td->details.auditors.auditor_name), GNUNET_PQ_query_param_string (td->details.auditors.auditor_name),
GNUNET_PQ_query_param_string (td->details.auditors.auditor_url), GNUNET_PQ_query_param_string (td->details.auditors.auditor_url),
GNUNET_PQ_query_param_auto_from_type (&is_active), GNUNET_PQ_query_param_bool (&td->details.auditors.is_active),
GNUNET_PQ_query_param_timestamp (&td->details.auditors.last_change), GNUNET_PQ_query_param_timestamp (&td->details.auditors.last_change),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -376,6 +382,8 @@ irbt_cb_table_known_coins (struct PostgresClosure *pg,
&td->details.known_coins.denom_sig), &td->details.known_coins.denom_sig),
GNUNET_PQ_query_param_uint64 ( GNUNET_PQ_query_param_uint64 (
&td->details.known_coins.denominations_serial), &td->details.known_coins.denominations_serial),
TALER_PQ_query_param_amount (
&td->details.known_coins.remaining),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -406,6 +414,8 @@ irbt_cb_table_refresh_commitments (struct PostgresClosure *pg,
&td->details.refresh_commitments.noreveal_index), &td->details.refresh_commitments.noreveal_index),
GNUNET_PQ_query_param_auto_from_type ( GNUNET_PQ_query_param_auto_from_type (
&td->details.refresh_commitments.old_coin_pub), &td->details.refresh_commitments.old_coin_pub),
GNUNET_PQ_query_param_auto_from_type (
&td->details.refresh_commitments.h_age_commitment),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -498,9 +508,6 @@ static enum GNUNET_DB_QueryStatus
irbt_cb_table_deposits (struct PostgresClosure *pg, irbt_cb_table_deposits (struct PostgresClosure *pg,
const struct TALER_EXCHANGEDB_TableData *td) const struct TALER_EXCHANGEDB_TableData *td)
{ {
uint8_t tiny = td->details.deposits.tiny ? 1 : 0;
uint8_t done = td->details.deposits.done ? 1 : 0;
uint8_t extension_blocked = td->details.deposits.extension_blocked ? 1 : 0;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&td->serial), GNUNET_PQ_query_param_uint64 (&td->serial),
GNUNET_PQ_query_param_uint64 (&td->details.deposits.shard), GNUNET_PQ_query_param_uint64 (&td->details.deposits.shard),
@ -517,10 +524,12 @@ irbt_cb_table_deposits (struct PostgresClosure *pg,
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.coin_sig), GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.coin_sig),
GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.wire_salt), GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.wire_salt),
GNUNET_PQ_query_param_uint64 (&td->details.deposits.wire_target_serial_id), GNUNET_PQ_query_param_uint64 (&td->details.deposits.wire_target_serial_id),
GNUNET_PQ_query_param_auto_from_type (&tiny), GNUNET_PQ_query_param_bool (td->details.deposits.tiny),
GNUNET_PQ_query_param_auto_from_type (&done), GNUNET_PQ_query_param_bool (td->details.deposits.done),
GNUNET_PQ_query_param_auto_from_type (&extension_blocked), GNUNET_PQ_query_param_bool (td->details.deposits.extension_blocked),
GNUNET_PQ_query_param_uint64 ( 0 == td->details.deposits.extension_details_serial_id
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_uint64 (
&td->details.deposits.extension_details_serial_id), &td->details.deposits.extension_details_serial_id),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };

View File

@ -53,8 +53,8 @@ lrbt_cb_table_denominations (void *cls,
"denom_type", "denom_type",
&td.details.denominations.denom_type), &td.details.denominations.denom_type),
GNUNET_PQ_result_spec_uint32 ( GNUNET_PQ_result_spec_uint32 (
"age_restrictions", "age_mask",
&td.details.denominations.age_restrictions), &td.details.denominations.age_mask),
TALER_PQ_result_spec_denom_pub ( TALER_PQ_result_spec_denom_pub (
"denom_pub", "denom_pub",
&td.details.denominations.denom_pub), &td.details.denominations.denom_pub),
@ -175,6 +175,7 @@ lrbt_cb_table_wire_targets (void *cls,
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
bool no_xid;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("serial", GNUNET_PQ_result_spec_uint64 ("serial",
&td.serial), &td.serial),
@ -182,8 +183,10 @@ lrbt_cb_table_wire_targets (void *cls,
&td.details.wire_targets.payto_uri), &td.details.wire_targets.payto_uri),
GNUNET_PQ_result_spec_auto_from_type ("kyc_ok", GNUNET_PQ_result_spec_auto_from_type ("kyc_ok",
&td.details.wire_targets.kyc_ok), &td.details.wire_targets.kyc_ok),
GNUNET_PQ_result_spec_string ("external_id", GNUNET_PQ_result_spec_allow_null (
&td.details.wire_targets.external_id), GNUNET_PQ_result_spec_string ("external_id",
&td.details.wire_targets.external_id),
&no_xid),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -458,7 +461,6 @@ lrbt_cb_table_auditors (void *cls,
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
uint8_t is_active8 = 0;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("serial", GNUNET_PQ_result_spec_uint64 ("serial",
&td.serial), &td.serial),
@ -468,8 +470,8 @@ lrbt_cb_table_auditors (void *cls,
&td.details.auditors.auditor_url), &td.details.auditors.auditor_url),
GNUNET_PQ_result_spec_string ("auditor_name", GNUNET_PQ_result_spec_string ("auditor_name",
&td.details.auditors.auditor_name), &td.details.auditors.auditor_name),
GNUNET_PQ_result_spec_auto_from_type ("is_active", GNUNET_PQ_result_spec_bool ("is_active",
&is_active8), &td.details.auditors.is_active),
GNUNET_PQ_result_spec_timestamp ("last_change", GNUNET_PQ_result_spec_timestamp ("last_change",
&td.details.auditors.last_change), &td.details.auditors.last_change),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
@ -484,7 +486,6 @@ lrbt_cb_table_auditors (void *cls,
ctx->error = true; ctx->error = true;
return; return;
} }
td.details.auditors.is_active = (0 != is_active8);
ctx->cb (ctx->cb_cls, ctx->cb (ctx->cb_cls,
&td); &td);
GNUNET_PQ_cleanup_result (rs); GNUNET_PQ_cleanup_result (rs);
@ -658,6 +659,7 @@ lrbt_cb_table_known_coins (void *cls,
unsigned int num_results) unsigned int num_results)
{ {
struct LookupRecordsByTableContext *ctx = cls; struct LookupRecordsByTableContext *ctx = cls;
struct PostgresClosure *pg = ctx->pg;
struct TALER_EXCHANGEDB_TableData td = { struct TALER_EXCHANGEDB_TableData td = {
.table = TALER_EXCHANGEDB_RT_KNOWN_COINS .table = TALER_EXCHANGEDB_RT_KNOWN_COINS
}; };
@ -677,6 +679,9 @@ lrbt_cb_table_known_coins (void *cls,
GNUNET_PQ_result_spec_uint64 ( GNUNET_PQ_result_spec_uint64 (
"denominations_serial", "denominations_serial",
&td.details.known_coins.denominations_serial), &td.details.known_coins.denominations_serial),
TALER_PQ_RESULT_SPEC_AMOUNT (
"remaining",
&td.details.known_coins.remaining),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -904,8 +909,7 @@ lrbt_cb_table_deposits (void *cls,
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
uint8_t tiny = 0; /* initialized to make compiler happy */ bool no_extension;
uint8_t done = 0; /* initialized to make compiler happy */
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ( GNUNET_PQ_result_spec_uint64 (
"serial", "serial",
@ -946,18 +950,20 @@ lrbt_cb_table_deposits (void *cls,
GNUNET_PQ_result_spec_uint64 ( GNUNET_PQ_result_spec_uint64 (
"wire_target_serial_id", "wire_target_serial_id",
&td.details.deposits.wire_target_serial_id), &td.details.deposits.wire_target_serial_id),
GNUNET_PQ_result_spec_auto_from_type ( GNUNET_PQ_result_spec_bool (
"tiny", "tiny",
&td.details.deposits.tiny), &td.details.deposits.tiny),
GNUNET_PQ_result_spec_auto_from_type ( GNUNET_PQ_result_spec_bool (
"done", "done",
&td.details.deposits.done), &td.details.deposits.done),
GNUNET_PQ_result_spec_auto_from_type ( GNUNET_PQ_result_spec_auto_from_type (
"extension_blocked", "extension_blocked",
&td.details.deposits.extension_blocked), &td.details.deposits.extension_blocked),
GNUNET_PQ_result_spec_uint64 ( GNUNET_PQ_result_spec_allow_null (
"extension_details_serial_id", GNUNET_PQ_result_spec_uint64 (
&td.details.deposits.extension_details_serial_id), "extension_details_serial_id",
&td.details.deposits.extension_details_serial_id),
&no_extension),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -970,8 +976,6 @@ lrbt_cb_table_deposits (void *cls,
ctx->error = true; ctx->error = true;
return; return;
} }
td.details.deposits.tiny = (0 != tiny);
td.details.deposits.done = (0 != done);
ctx->cb (ctx->cb_cls, ctx->cb (ctx->cb_cls,
&td); &td);
GNUNET_PQ_cleanup_result (rs); GNUNET_PQ_cleanup_result (rs);

View File

@ -241,6 +241,7 @@ prepare_statements (struct PostgresClosure *pg)
"denomination_iterate", "denomination_iterate",
"SELECT" "SELECT"
" master_sig" " master_sig"
",denom_pub_hash"
",valid_from" ",valid_from"
",expire_withdraw" ",expire_withdraw"
",expire_deposit" ",expire_deposit"
@ -279,8 +280,9 @@ prepare_statements (struct PostgresClosure *pg)
",fee_refresh_frac" ",fee_refresh_frac"
",fee_refund_val" ",fee_refund_val"
",fee_refund_frac" ",fee_refund_frac"
",denom_pub" ",denom_type"
",age_mask" ",age_mask"
",denom_pub"
" FROM denominations" " FROM denominations"
" LEFT JOIN " " LEFT JOIN "
" denomination_revocations USING (denominations_serial);", " denomination_revocations USING (denominations_serial);",
@ -611,7 +613,7 @@ prepare_statements (struct PostgresClosure *pg)
",out_zombie_bad AS zombie_required" ",out_zombie_bad AS zombie_required"
",out_noreveal_index AS noreveal_index" ",out_noreveal_index AS noreveal_index"
" FROM exchange_do_melt" " FROM exchange_do_melt"
" ($1,$2,$3,$4,$5,$6,$7,$8,$9);", " ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10);",
9), 9),
/* Used in #postgres_do_refund() to refund a deposit. */ /* Used in #postgres_do_refund() to refund a deposit. */
GNUNET_PQ_make_prepare ( GNUNET_PQ_make_prepare (
@ -730,7 +732,7 @@ prepare_statements (struct PostgresClosure *pg)
"get_known_coin", "get_known_coin",
"SELECT" "SELECT"
" denominations.denom_pub_hash" " denominations.denom_pub_hash"
",age_hash" ",age_commitment_hash"
",denom_sig" ",denom_sig"
" FROM known_coins" " FROM known_coins"
" JOIN denominations USING (denominations_serial)" " JOIN denominations USING (denominations_serial)"
@ -784,7 +786,7 @@ prepare_statements (struct PostgresClosure *pg)
" INSERT INTO known_coins " " INSERT INTO known_coins "
" (coin_pub" " (coin_pub"
" ,denominations_serial" " ,denominations_serial"
" ,age_hash" " ,age_commitment_hash"
" ,denom_sig" " ,denom_sig"
" ,remaining_val" " ,remaining_val"
" ,remaining_frac" " ,remaining_frac"
@ -796,7 +798,7 @@ prepare_statements (struct PostgresClosure *pg)
" ,coin_val" " ,coin_val"
" ,coin_frac" " ,coin_frac"
" FROM dd" " FROM dd"
" ON CONFLICT (coin_pub) DO NOTHING" " ON CONFLICT DO NOTHING" /* CONFLICT on (coin_pub) */
" RETURNING " " RETURNING "
" known_coin_id" " known_coin_id"
" ) " " ) "
@ -804,14 +806,14 @@ prepare_statements (struct PostgresClosure *pg)
" FALSE AS existed" " FALSE AS existed"
" ,known_coin_id" " ,known_coin_id"
" ,NULL AS denom_pub_hash" " ,NULL AS denom_pub_hash"
" ,NULL AS age_hash" " ,NULL AS age_commitment_hash"
" FROM ins " " FROM ins "
"UNION ALL " "UNION ALL "
"SELECT " "SELECT "
" TRUE AS existed" " TRUE AS existed"
" ,known_coin_id" " ,known_coin_id"
" ,denom_pub_hash" " ,denom_pub_hash"
" ,kc.age_hash" " ,kc.age_commitment_hash"
" FROM input_rows" " FROM input_rows"
" JOIN known_coins kc USING (coin_pub)" " JOIN known_coins kc USING (coin_pub)"
" JOIN denominations USING (denominations_serial)" " JOIN denominations USING (denominations_serial)"
@ -873,6 +875,7 @@ prepare_statements (struct PostgresClosure *pg)
",denoms.denom_pub_hash" ",denoms.denom_pub_hash"
",denoms.fee_refresh_val" ",denoms.fee_refresh_val"
",denoms.fee_refresh_frac" ",denoms.fee_refresh_frac"
",h_age_commitment"
",melt_serial_id" ",melt_serial_id"
" FROM refresh_commitments" " FROM refresh_commitments"
" JOIN known_coins kc" " JOIN known_coins kc"
@ -1065,6 +1068,7 @@ prepare_statements (struct PostgresClosure *pg)
",merchant_pub" ",merchant_pub"
",denom.denom_pub" ",denom.denom_pub"
",kc.coin_pub" ",kc.coin_pub"
",kc.age_commitment_hash"
",coin_sig" ",coin_sig"
",refund_deadline" ",refund_deadline"
",wire_deadline" ",wire_deadline"
@ -1188,7 +1192,7 @@ prepare_statements (struct PostgresClosure *pg)
",denoms.fee_deposit_val" ",denoms.fee_deposit_val"
",denoms.fee_deposit_frac" ",denoms.fee_deposit_frac"
",denoms.denom_pub_hash" ",denoms.denom_pub_hash"
",kc.age_hash" ",kc.age_commitment_hash"
",wallet_timestamp" ",wallet_timestamp"
",refund_deadline" ",refund_deadline"
",wire_deadline" ",wire_deadline"
@ -1237,6 +1241,7 @@ prepare_statements (struct PostgresClosure *pg)
" aggregation_serial_id" " aggregation_serial_id"
",deposits.h_contract_terms" ",deposits.h_contract_terms"
",payto_uri" ",payto_uri"
",h_payto"
",kc.coin_pub" ",kc.coin_pub"
",deposits.merchant_pub" ",deposits.merchant_pub"
",wire_out.execution_date" ",wire_out.execution_date"
@ -1918,6 +1923,14 @@ prepare_statements (struct PostgresClosure *pg)
" ORDER BY denom_revocations_serial_id DESC" " ORDER BY denom_revocations_serial_id DESC"
" LIMIT 1;", " LIMIT 1;",
0), 0),
GNUNET_PQ_make_prepare (
"select_serial_by_table_wire_targets",
"SELECT"
" wire_target_serial_id AS serial"
" FROM wire_targets"
" ORDER BY wire_target_serial_id DESC"
" LIMIT 1;",
0),
GNUNET_PQ_make_prepare ( GNUNET_PQ_make_prepare (
"select_serial_by_table_reserves", "select_serial_by_table_reserves",
"SELECT" "SELECT"
@ -2107,6 +2120,17 @@ prepare_statements (struct PostgresClosure *pg)
" WHERE denom_revocations_serial_id > $1" " WHERE denom_revocations_serial_id > $1"
" ORDER BY denom_revocations_serial_id ASC;", " ORDER BY denom_revocations_serial_id ASC;",
1), 1),
GNUNET_PQ_make_prepare (
"select_above_serial_by_table_wire_targets",
"SELECT"
" wire_target_serial_id AS serial"
",payto_uri"
",kyc_ok"
",external_id"
" FROM wire_targets"
" WHERE wire_target_serial_id > $1"
" ORDER BY wire_target_serial_id ASC;",
1),
GNUNET_PQ_make_prepare ( GNUNET_PQ_make_prepare (
"select_above_serial_by_table_reserves", "select_above_serial_by_table_reserves",
"SELECT" "SELECT"
@ -2158,7 +2182,7 @@ prepare_statements (struct PostgresClosure *pg)
",h_blind_ev" ",h_blind_ev"
",denominations_serial" ",denominations_serial"
",denom_sig" ",denom_sig"
",reserve_pub" ",reserve_uuid"
",reserve_sig" ",reserve_sig"
",execution_date" ",execution_date"
",amount_with_fee_val" ",amount_with_fee_val"
@ -2222,6 +2246,8 @@ prepare_statements (struct PostgresClosure *pg)
",coin_pub" ",coin_pub"
",denom_sig" ",denom_sig"
",denominations_serial" ",denominations_serial"
",remaining_val"
",remaining_frac"
" FROM known_coins" " FROM known_coins"
" WHERE known_coin_id > $1" " WHERE known_coin_id > $1"
" ORDER BY known_coin_id ASC;", " ORDER BY known_coin_id ASC;",
@ -2380,6 +2406,8 @@ prepare_statements (struct PostgresClosure *pg)
"INSERT INTO denominations" "INSERT INTO denominations"
"(denominations_serial" "(denominations_serial"
",denom_pub_hash" ",denom_pub_hash"
",denom_type"
",age_mask"
",denom_pub" ",denom_pub"
",master_sig" ",master_sig"
",valid_from" ",valid_from"
@ -2396,11 +2424,10 @@ prepare_statements (struct PostgresClosure *pg)
",fee_refresh_frac" ",fee_refresh_frac"
",fee_refund_val" ",fee_refund_val"
",fee_refund_frac" ",fee_refund_frac"
",age_mask"
") VALUES " ") VALUES "
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10," "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
" $11, $12, $13, $14, $15, $16, $17, $18, $19);", " $11, $12, $13, $14, $15, $16, $17, $18, $19, $20);",
19), 20),
GNUNET_PQ_make_prepare ( GNUNET_PQ_make_prepare (
"insert_into_table_denomination_revocations", "insert_into_table_denomination_revocations",
"INSERT INTO denomination_revocations" "INSERT INTO denomination_revocations"
@ -2410,6 +2437,17 @@ prepare_statements (struct PostgresClosure *pg)
") VALUES " ") VALUES "
"($1, $2, $3);", "($1, $2, $3);",
3), 3),
GNUNET_PQ_make_prepare (
"insert_into_table_wire_targets",
"INSERT INTO wire_targets"
"(wire_target_serial_id"
",h_payto"
",payto_uri"
",kyc_ok"
",external_id"
") VALUES "
"($1, $2, $3, $4, $5);",
5),
GNUNET_PQ_make_prepare ( GNUNET_PQ_make_prepare (
"insert_into_table_reserves", "insert_into_table_reserves",
"INSERT INTO reserves" "INSERT INTO reserves"
@ -2516,9 +2554,11 @@ prepare_statements (struct PostgresClosure *pg)
",coin_pub" ",coin_pub"
",denom_sig" ",denom_sig"
",denominations_serial" ",denominations_serial"
",remaining_val"
",remaining_frac"
") VALUES " ") VALUES "
"($1, $2, $3, $4);", "($1, $2, $3, $4, $5, $6);",
4), 6),
GNUNET_PQ_make_prepare ( GNUNET_PQ_make_prepare (
"insert_into_table_refresh_commitments", "insert_into_table_refresh_commitments",
"INSERT INTO refresh_commitments" "INSERT INTO refresh_commitments"
@ -2529,8 +2569,9 @@ prepare_statements (struct PostgresClosure *pg)
",amount_with_fee_frac" ",amount_with_fee_frac"
",noreveal_index" ",noreveal_index"
",old_coin_pub" ",old_coin_pub"
",h_age_commitment"
") VALUES " ") VALUES "
"($1, $2, $3, $4, $5, $6, $7);", "($1, $2, $3, $4, $5, $6, $7, $8);",
7), 7),
GNUNET_PQ_make_prepare ( GNUNET_PQ_make_prepare (
"insert_into_table_refresh_revealed_coins", "insert_into_table_refresh_revealed_coins",
@ -3091,6 +3132,7 @@ postgres_insert_denomination_info (
const struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue) const struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct TALER_DenominationHashP denom_hash;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash), GNUNET_PQ_query_param_auto_from_type (&issue->properties.denom_hash),
TALER_PQ_query_param_denom_pub (denom_pub), TALER_PQ_query_param_denom_pub (denom_pub),
@ -3104,13 +3146,18 @@ postgres_insert_denomination_info (
TALER_PQ_query_param_amount_nbo (&issue->properties.fees.deposit), TALER_PQ_query_param_amount_nbo (&issue->properties.fees.deposit),
TALER_PQ_query_param_amount_nbo (&issue->properties.fees.refresh), TALER_PQ_query_param_amount_nbo (&issue->properties.fees.refresh),
TALER_PQ_query_param_amount_nbo (&issue->properties.fees.refund), TALER_PQ_query_param_amount_nbo (&issue->properties.fees.refund),
GNUNET_PQ_query_param_uint32 (&denom_pub->age_mask.mask), GNUNET_PQ_query_param_uint32 (&denom_pub->age_mask.bits),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
struct TALER_DenomFeeSet fees; struct TALER_DenomFeeSet fees;
GNUNET_assert (denom_pub->age_mask.mask == issue->age_mask.mask); GNUNET_assert (denom_pub->age_mask.bits ==
issue->age_mask.bits);
TALER_denom_pub_hash (denom_pub,
&denom_hash);
GNUNET_assert (0 ==
GNUNET_memcmp (&denom_hash,
&issue->properties.denom_hash));
GNUNET_assert (! GNUNET_TIME_absolute_is_zero ( GNUNET_assert (! GNUNET_TIME_absolute_is_zero (
GNUNET_TIME_timestamp_ntoh ( GNUNET_TIME_timestamp_ntoh (
issue->properties.start).abs_time)); issue->properties.start).abs_time));
@ -3147,7 +3194,7 @@ postgres_insert_denomination_info (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_get_denomination_info ( postgres_get_denomination_info (
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue) struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
@ -3178,7 +3225,7 @@ postgres_get_denomination_info (
TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_refund", TALER_PQ_RESULT_SPEC_AMOUNT_NBO ("fee_refund",
&issue->properties.fees.refund), &issue->properties.fees.refund),
GNUNET_PQ_result_spec_uint32 ("age_mask", GNUNET_PQ_result_spec_uint32 ("age_mask",
&issue->age_mask.mask), &issue->age_mask.bits),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -3242,9 +3289,12 @@ domination_cb_helper (void *cls,
{ {
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue; struct TALER_EXCHANGEDB_DenominationKeyInformationP issue;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct TALER_DenominationHashP denom_hash;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("master_sig", GNUNET_PQ_result_spec_auto_from_type ("master_sig",
&issue.signature), &issue.signature),
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&denom_hash),
GNUNET_PQ_result_spec_timestamp_nbo ("valid_from", GNUNET_PQ_result_spec_timestamp_nbo ("valid_from",
&issue.properties.start), &issue.properties.start),
GNUNET_PQ_result_spec_timestamp_nbo ("expire_withdraw", GNUNET_PQ_result_spec_timestamp_nbo ("expire_withdraw",
@ -3266,7 +3316,7 @@ domination_cb_helper (void *cls,
TALER_PQ_result_spec_denom_pub ("denom_pub", TALER_PQ_result_spec_denom_pub ("denom_pub",
&denom_pub), &denom_pub),
GNUNET_PQ_result_spec_uint32 ("age_mask", GNUNET_PQ_result_spec_uint32 ("age_mask",
&issue.age_mask.mask), &issue.age_mask.bits),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -3295,9 +3345,18 @@ domination_cb_helper (void *cls,
= htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY); = htonl (TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY);
TALER_denom_pub_hash (&denom_pub, TALER_denom_pub_hash (&denom_pub,
&issue.properties.denom_hash); &issue.properties.denom_hash);
dic->cb (dic->cb_cls, if (0 !=
&denom_pub, GNUNET_memcmp (&issue.properties.denom_hash,
&issue); &denom_hash))
{
GNUNET_break (0);
}
else
{
dic->cb (dic->cb_cls,
&denom_pub,
&issue);
}
TALER_denom_pub_free (&denom_pub); TALER_denom_pub_free (&denom_pub);
} }
} }
@ -3377,7 +3436,7 @@ dominations_cb_helper (void *cls,
struct TALER_EXCHANGEDB_DenominationKeyMetaData meta = {0}; struct TALER_EXCHANGEDB_DenominationKeyMetaData meta = {0};
struct TALER_DenominationPublicKey denom_pub = {0}; struct TALER_DenominationPublicKey denom_pub = {0};
struct TALER_MasterSignatureP master_sig = {0}; struct TALER_MasterSignatureP master_sig = {0};
struct TALER_DenominationHash h_denom_pub = {0}; struct TALER_DenominationHashP h_denom_pub = {0};
bool revoked; bool revoked;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("master_sig", GNUNET_PQ_result_spec_auto_from_type ("master_sig",
@ -3405,7 +3464,7 @@ dominations_cb_helper (void *cls,
TALER_PQ_result_spec_denom_pub ("denom_pub", TALER_PQ_result_spec_denom_pub ("denom_pub",
&denom_pub), &denom_pub),
GNUNET_PQ_result_spec_uint32 ("age_mask", GNUNET_PQ_result_spec_uint32 ("age_mask",
&meta.age_mask.mask), &meta.age_mask.bits),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -3702,7 +3761,7 @@ auditor_denoms_cb_helper (void *cls,
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
struct TALER_AuditorPublicKeyP auditor_pub; struct TALER_AuditorPublicKeyP auditor_pub;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct TALER_AuditorSignatureP auditor_sig; struct TALER_AuditorSignatureP auditor_sig;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("auditor_pub", GNUNET_PQ_result_spec_auto_from_type ("auditor_pub",
@ -3870,7 +3929,7 @@ postgres_set_kyc_ok (void *cls,
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_select_kyc_status (void *cls, postgres_select_kyc_status (void *cls,
uint64_t payment_target_uuid, uint64_t payment_target_uuid,
struct TALER_PaytoHash *h_payto, struct TALER_PaytoHashP *h_payto,
struct TALER_EXCHANGEDB_KycStatus *kyc) struct TALER_EXCHANGEDB_KycStatus *kyc)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
@ -3911,7 +3970,7 @@ inselect_account_kyc_status (
struct TALER_EXCHANGEDB_KycStatus *kyc) struct TALER_EXCHANGEDB_KycStatus *kyc)
{ {
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
TALER_payto_hash (payto_uri, TALER_payto_hash (payto_uri,
@ -4330,7 +4389,7 @@ postgres_reserves_in_insert (void *cls,
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_get_withdraw_info ( postgres_get_withdraw_info (
void *cls, void *cls,
const struct TALER_BlindedCoinHash *bch, const struct TALER_BlindedCoinHashP *bch,
struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable) struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
@ -4516,7 +4575,7 @@ postgres_do_deposit (
void *cls, void *cls,
const struct TALER_EXCHANGEDB_Deposit *deposit, const struct TALER_EXCHANGEDB_Deposit *deposit,
uint64_t known_coin_id, uint64_t known_coin_id,
const struct TALER_PaytoHash *h_payto, const struct TALER_PaytoHashP *h_payto,
bool extension_blocked, bool extension_blocked,
struct GNUNET_TIME_Timestamp *exchange_timestamp, struct GNUNET_TIME_Timestamp *exchange_timestamp,
bool *balance_ok, bool *balance_ok,
@ -4593,6 +4652,7 @@ postgres_do_melt (
GNUNET_PQ_query_param_auto_from_type (&refresh->coin.coin_pub), GNUNET_PQ_query_param_auto_from_type (&refresh->coin.coin_pub),
GNUNET_PQ_query_param_auto_from_type (&refresh->coin_sig), GNUNET_PQ_query_param_auto_from_type (&refresh->coin_sig),
GNUNET_PQ_query_param_uint64 (&known_coin_id), GNUNET_PQ_query_param_uint64 (&known_coin_id),
GNUNET_PQ_query_param_auto_from_type (&refresh->coin.h_age_commitment),
GNUNET_PQ_query_param_uint32 (&refresh->noreveal_index), GNUNET_PQ_query_param_uint32 (&refresh->noreveal_index),
GNUNET_PQ_query_param_bool (*zombie_required), GNUNET_PQ_query_param_bool (*zombie_required),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
@ -5241,8 +5301,8 @@ postgres_get_reserve_history (void *cls,
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_have_deposit2 ( postgres_have_deposit2 (
void *cls, void *cls,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant, const struct TALER_MerchantPublicKeyP *merchant,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,
@ -5277,7 +5337,7 @@ postgres_have_deposit2 (
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
struct TALER_MerchantWireHash h_wire2; struct TALER_MerchantWireHashP h_wire2;
#if EXPLICIT_LOCKS #if EXPLICIT_LOCKS
struct GNUNET_PQ_QueryParam no_params[] = { struct GNUNET_PQ_QueryParam no_params[] = {
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
@ -5402,7 +5462,7 @@ postgres_get_ready_deposit (void *cls,
}; };
struct TALER_Amount amount_with_fee; struct TALER_Amount amount_with_fee;
struct TALER_Amount deposit_fee; struct TALER_Amount deposit_fee;
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_MerchantPublicKeyP merchant_pub;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
uint64_t serial_id; uint64_t serial_id;
@ -5527,7 +5587,7 @@ match_deposit_cb (void *cls,
{ {
struct TALER_Amount amount_with_fee; struct TALER_Amount amount_with_fee;
struct TALER_Amount deposit_fee; struct TALER_Amount deposit_fee;
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
uint64_t serial_id; uint64_t serial_id;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
@ -5641,14 +5701,13 @@ postgres_get_known_coin (void *cls,
GNUNET_PQ_query_param_auto_from_type (coin_pub), GNUNET_PQ_query_param_auto_from_type (coin_pub),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
bool is_null;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&coin_info->denom_pub_hash), &coin_info->denom_pub_hash),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
&coin_info->h_age_commitment), &coin_info->h_age_commitment),
&is_null), &coin_info->no_age_commitment),
TALER_PQ_result_spec_denom_sig ("denom_sig", TALER_PQ_result_spec_denom_sig ("denom_sig",
&coin_info->denom_sig), &coin_info->denom_sig),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
@ -5679,7 +5738,7 @@ postgres_get_coin_denomination (
void *cls, void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t *known_coin_id, uint64_t *known_coin_id,
struct TALER_DenominationHash *denom_hash) struct TALER_DenominationHashP *denom_hash)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = { struct GNUNET_PQ_QueryParam params[] = {
@ -5713,7 +5772,8 @@ postgres_get_coin_denomination (
*/ */
static long long static long long
postgres_count_known_coins (void *cls, postgres_count_known_coins (void *cls,
const struct TALER_DenominationHash *denom_pub_hash) const struct
TALER_DenominationHashP *denom_pub_hash)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
uint64_t count; uint64_t count;
@ -5746,15 +5806,15 @@ postgres_count_known_coins (void *cls,
* @param[out] known_coin_id set to the unique row of the coin * @param[out] known_coin_id set to the unique row of the coin
* @param[out] denom_hash set to the denomination hash of the existing * @param[out] denom_hash set to the denomination hash of the existing
* coin (for conflict error reporting) * coin (for conflict error reporting)
* @param[out] age_hash set to the conflicting age hash on conflict * @param[out] h_age_commitment set to the conflicting age commitment hash on conflict
* @return database transaction status, non-negative on success * @return database transaction status, non-negative on success
*/ */
static enum TALER_EXCHANGEDB_CoinKnownStatus static enum TALER_EXCHANGEDB_CoinKnownStatus
postgres_ensure_coin_known (void *cls, postgres_ensure_coin_known (void *cls,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id, uint64_t *known_coin_id,
struct TALER_DenominationHash *denom_hash, struct TALER_DenominationHashP *denom_hash,
struct TALER_AgeCommitmentHash *age_hash) struct TALER_AgeCommitmentHash *h_age_commitment)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
@ -5778,8 +5838,8 @@ postgres_ensure_coin_known (void *cls,
denom_hash), denom_hash),
&is_denom_pub_hash_null), &is_denom_pub_hash_null),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
age_hash), h_age_commitment),
&is_age_hash_null), &is_age_hash_null),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -5813,10 +5873,10 @@ postgres_ensure_coin_known (void *cls,
} }
if ( (! is_age_hash_null) && if ( (! is_age_hash_null) &&
(0 != GNUNET_memcmp (age_hash, (0 != GNUNET_memcmp (h_age_commitment,
&coin->h_age_commitment)) ) &coin->h_age_commitment)) )
{ {
GNUNET_break (GNUNET_is_zero (age_hash)); GNUNET_break (GNUNET_is_zero (h_age_commitment));
GNUNET_break_op (0); GNUNET_break_op (0);
return TALER_EXCHANGEDB_CKS_AGE_CONFLICT; return TALER_EXCHANGEDB_CKS_AGE_CONFLICT;
} }
@ -5998,7 +6058,7 @@ postgres_select_refunds_by_coin (
void *cls, void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_PrivateContractHash *h_contract, const struct TALER_PrivateContractHashP *h_contract,
TALER_EXCHANGEDB_RefundCoinCallback cb, TALER_EXCHANGEDB_RefundCoinCallback cb,
void *cb_cls) void *cb_cls)
{ {
@ -6065,7 +6125,7 @@ postgres_get_melt (void *cls,
&melt->session.coin_sig), &melt->session.coin_sig),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("h_age_commitment", GNUNET_PQ_result_spec_auto_from_type ("h_age_commitment",
&melt->session.h_age_commitment), &melt->session.coin.h_age_commitment),
&h_age_commitment_is_null), &h_age_commitment_is_null),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee", TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
&melt->session.amount_with_fee), &melt->session.amount_with_fee),
@ -6083,9 +6143,9 @@ postgres_get_melt (void *cls,
params, params,
rs); rs);
if (h_age_commitment_is_null) if (h_age_commitment_is_null)
memset (&melt->session.h_age_commitment, memset (&melt->session.coin.h_age_commitment,
0, 0,
sizeof(melt->session.h_age_commitment)); sizeof(melt->session.coin.h_age_commitment));
melt->session.rc = *rc; melt->session.rc = *rc;
return qs; return qs;
@ -6233,7 +6293,8 @@ add_revealed_coins (void *cls,
{ {
struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrc = &grctx->rrcs[off]; struct TALER_EXCHANGEDB_RefreshRevealedCoin *rrc = &grctx->rrcs[off];
struct GNUNET_PQ_ResultSpec rsi[] = { struct GNUNET_PQ_ResultSpec rsi[] = {
GNUNET_PQ_result_spec_auto_from_type ("h_denom_pub", /* NOTE: freshcoin_index selected and discarded here... */
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&rrc->h_denom_pub), &rrc->h_denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("link_sig", GNUNET_PQ_result_spec_auto_from_type ("link_sig",
&rrc->orig_coin_link_sig), &rrc->orig_coin_link_sig),
@ -6586,7 +6647,6 @@ add_coin_deposit (void *cls,
struct TALER_EXCHANGEDB_DepositListEntry *deposit; struct TALER_EXCHANGEDB_DepositListEntry *deposit;
struct TALER_EXCHANGEDB_TransactionList *tl; struct TALER_EXCHANGEDB_TransactionList *tl;
uint64_t serial_id; uint64_t serial_id;
bool is_null;
chc->have_deposit_or_melt = true; chc->have_deposit_or_melt = true;
deposit = GNUNET_new (struct TALER_EXCHANGEDB_DepositListEntry); deposit = GNUNET_new (struct TALER_EXCHANGEDB_DepositListEntry);
@ -6599,9 +6659,9 @@ add_coin_deposit (void *cls,
GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash", GNUNET_PQ_result_spec_auto_from_type ("denom_pub_hash",
&deposit->h_denom_pub), &deposit->h_denom_pub),
GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_hash", GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
&deposit->h_age_commitment), &deposit->h_age_commitment),
&is_null), &deposit->no_age_commitment),
GNUNET_PQ_result_spec_timestamp ("wallet_timestamp", GNUNET_PQ_result_spec_timestamp ("wallet_timestamp",
&deposit->timestamp), &deposit->timestamp),
GNUNET_PQ_result_spec_timestamp ("refund_deadline", GNUNET_PQ_result_spec_timestamp ("refund_deadline",
@ -6683,6 +6743,10 @@ add_coin_melt (void *cls,
&melt->amount_with_fee), &melt->amount_with_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refresh", TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refresh",
&melt->melt_fee), &melt->melt_fee),
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("h_age_commitment",
&melt->h_age_commitment),
&melt->no_age_commitment),
GNUNET_PQ_result_spec_uint64 ("melt_serial_id", GNUNET_PQ_result_spec_uint64 ("melt_serial_id",
&serial_id), &serial_id),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
@ -6698,6 +6762,7 @@ add_coin_melt (void *cls,
chc->failed = true; chc->failed = true;
return; return;
} }
} }
tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList); tl = GNUNET_new (struct TALER_EXCHANGEDB_TransactionList);
tl->next = chc->head; tl->next = chc->head;
@ -7130,8 +7195,9 @@ handle_wt_result (void *cls,
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
uint64_t rowid; uint64_t rowid;
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_PaytoHashP h_payto;
struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Timestamp exec_time; struct GNUNET_TIME_Timestamp exec_time;
struct TALER_Amount amount_with_fee; struct TALER_Amount amount_with_fee;
@ -7144,6 +7210,8 @@ handle_wt_result (void *cls,
&h_contract_terms), &h_contract_terms),
GNUNET_PQ_result_spec_string ("payto_uri", GNUNET_PQ_result_spec_string ("payto_uri",
&payto_uri), &payto_uri),
GNUNET_PQ_result_spec_auto_from_type ("h_payto",
&h_payto),
TALER_PQ_result_spec_denom_pub ("denom_pub", TALER_PQ_result_spec_denom_pub ("denom_pub",
&denom_pub), &denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub", GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
@ -7172,6 +7240,7 @@ handle_wt_result (void *cls,
rowid, rowid,
&merchant_pub, &merchant_pub,
payto_uri, payto_uri,
&h_payto,
exec_time, exec_time,
&h_contract_terms, &h_contract_terms,
&denom_pub, &denom_pub,
@ -7246,8 +7315,8 @@ postgres_lookup_wire_transfer (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_lookup_transfer_by_deposit ( postgres_lookup_transfer_by_deposit (
void *cls, void *cls,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
bool *pending, bool *pending,
@ -7290,7 +7359,7 @@ postgres_lookup_transfer_by_deposit (
rs); rs);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{ {
struct TALER_MerchantWireHash wh; struct TALER_MerchantWireHashP wh;
TALER_merchant_wire_signature_hash (payto_uri, TALER_merchant_wire_signature_hash (payto_uri,
&wire_salt, &wire_salt,
@ -7347,7 +7416,7 @@ postgres_lookup_transfer_by_deposit (
rs2); rs2);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{ {
struct TALER_MerchantWireHash wh; struct TALER_MerchantWireHashP wh;
TALER_merchant_wire_signature_hash (payto_uri, TALER_merchant_wire_signature_hash (payto_uri,
&wire_salt, &wire_salt,
@ -7942,7 +8011,22 @@ postgres_start_deferred_wire_out (void *cls)
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
struct GNUNET_PQ_ExecuteStatement es[] = { struct GNUNET_PQ_ExecuteStatement es[] = {
GNUNET_PQ_make_execute ("START TRANSACTION ISOLATION LEVEL READ COMMITTED"), GNUNET_PQ_make_execute ("START TRANSACTION ISOLATION LEVEL READ COMMITTED"),
GNUNET_PQ_make_execute ("SET CONSTRAINTS wire_out_ref DEFERRED"), GNUNET_PQ_make_execute ("DO $$"
"BEGIN"
" IF EXISTS ("
" SELECT 1"
" FROM information_Schema.constraint_column_usage"
" WHERE table_name='wire_out'"
" AND constraint_name='wire_out_ref')"
" THEN "
" SET CONSTRAINTS wire_out_ref DEFERRED;"
" END IF;"
"END $$"),
// FIXME: above logic is better as it tests that the constraint
// is actually applicable; but maybe we want to drop the constraint
// entirely once do_gc() is fixed to do without it?
// GNUNET_PQ_make_execute ("CALL defer_wire_out()"),
// GNUNET_PQ_make_execute ("SET CONSTRAINTS wire_out_ref DEFERRED;"),
GNUNET_PQ_EXECUTE_STATEMENT_END GNUNET_PQ_EXECUTE_STATEMENT_END
}; };
@ -8124,6 +8208,10 @@ deposit_serial_helper_cb (void *cls,
&denom_pub), &denom_pub),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub", GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&deposit.coin.coin_pub), &deposit.coin.coin_pub),
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_auto_from_type ("age_commitment_hash",
&deposit.coin.h_age_commitment),
&deposit.coin.no_age_commitment),
GNUNET_PQ_result_spec_auto_from_type ("coin_sig", GNUNET_PQ_result_spec_auto_from_type ("coin_sig",
&deposit.csig), &deposit.csig),
GNUNET_PQ_result_spec_timestamp ("refund_deadline", GNUNET_PQ_result_spec_timestamp ("refund_deadline",
@ -8144,6 +8232,9 @@ deposit_serial_helper_cb (void *cls,
}; };
int ret; int ret;
memset (&deposit,
0,
sizeof (deposit));
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, GNUNET_PQ_extract_result (result,
rs, rs,
@ -8711,7 +8802,7 @@ reserves_out_serial_helper_cb (void *cls,
for (unsigned int i = 0; i<num_results; i++) for (unsigned int i = 0; i<num_results; i++)
{ {
struct TALER_BlindedCoinHash h_blind_ev; struct TALER_BlindedCoinHashP h_blind_ev;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct TALER_ReservePublicKeyP reserve_pub; struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_ReserveSignatureP reserve_sig; struct TALER_ReserveSignatureP reserve_sig;
@ -9028,7 +9119,7 @@ recoup_serial_helper_cb (void *cls,
union TALER_DenominationBlindingKeyP coin_blind; union TALER_DenominationBlindingKeyP coin_blind;
struct TALER_Amount amount; struct TALER_Amount amount;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct TALER_BlindedCoinHash h_blind_ev; struct TALER_BlindedCoinHashP h_blind_ev;
struct GNUNET_TIME_Timestamp timestamp; struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("recoup_uuid", GNUNET_PQ_result_spec_uint64 ("recoup_uuid",
@ -9175,9 +9266,9 @@ recoup_refresh_serial_helper_cb (void *cls,
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
union TALER_DenominationBlindingKeyP coin_blind; union TALER_DenominationBlindingKeyP coin_blind;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct TALER_DenominationHash old_denom_pub_hash; struct TALER_DenominationHashP old_denom_pub_hash;
struct TALER_Amount amount; struct TALER_Amount amount;
struct TALER_BlindedCoinHash h_blind_ev; struct TALER_BlindedCoinHashP h_blind_ev;
struct GNUNET_TIME_Timestamp timestamp; struct GNUNET_TIME_Timestamp timestamp;
struct GNUNET_PQ_ResultSpec rs[] = { struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("recoup_refresh_uuid", GNUNET_PQ_result_spec_uint64 ("recoup_refresh_uuid",
@ -9425,7 +9516,7 @@ postgres_select_reserve_closed_above_serial_id (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_get_reserve_by_h_blind ( postgres_get_reserve_by_h_blind (
void *cls, void *cls,
const struct TALER_BlindedCoinHash *bch, const struct TALER_BlindedCoinHashP *bch,
struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_ReservePublicKeyP *reserve_pub,
uint64_t *reserve_out_serial_id) uint64_t *reserve_out_serial_id)
{ {
@ -9462,7 +9553,7 @@ postgres_get_reserve_by_h_blind (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_get_old_coin_by_h_blind ( postgres_get_old_coin_by_h_blind (
void *cls, void *cls,
const struct TALER_BlindedCoinHash *h_blind_ev, const struct TALER_BlindedCoinHashP *h_blind_ev,
struct TALER_CoinSpendPublicKeyP *old_coin_pub, struct TALER_CoinSpendPublicKeyP *old_coin_pub,
uint64_t *rrc_serial) uint64_t *rrc_serial)
{ {
@ -9498,7 +9589,7 @@ postgres_get_old_coin_by_h_blind (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_insert_denomination_revocation ( postgres_insert_denomination_revocation (
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
const struct TALER_MasterSignatureP *master_sig) const struct TALER_MasterSignatureP *master_sig)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
@ -9527,7 +9618,7 @@ postgres_insert_denomination_revocation (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_get_denomination_revocation ( postgres_get_denomination_revocation (
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_MasterSignatureP *master_sig, struct TALER_MasterSignatureP *master_sig,
uint64_t *rowid) uint64_t *rowid)
{ {
@ -10210,7 +10301,7 @@ postgres_lookup_signkey_revocation (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_lookup_denomination_key ( postgres_lookup_denomination_key (
void *cls, void *cls,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta) struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta)
{ {
struct PostgresClosure *pg = cls; struct PostgresClosure *pg = cls;
@ -10238,7 +10329,7 @@ postgres_lookup_denomination_key (
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refund", TALER_PQ_RESULT_SPEC_AMOUNT ("fee_refund",
&meta->fees.refund), &meta->fees.refund),
GNUNET_PQ_result_spec_uint32 ("age_mask", GNUNET_PQ_result_spec_uint32 ("age_mask",
&meta->age_mask.mask), &meta->age_mask.bits),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
@ -10263,7 +10354,7 @@ postgres_lookup_denomination_key (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_add_denomination_key ( postgres_add_denomination_key (
void *cls, void *cls,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta, const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta,
const struct TALER_MasterSignatureP *master_sig) const struct TALER_MasterSignatureP *master_sig)
@ -10282,7 +10373,7 @@ postgres_add_denomination_key (
TALER_PQ_query_param_amount (&meta->fees.deposit), TALER_PQ_query_param_amount (&meta->fees.deposit),
TALER_PQ_query_param_amount (&meta->fees.refresh), TALER_PQ_query_param_amount (&meta->fees.refresh),
TALER_PQ_query_param_amount (&meta->fees.refund), TALER_PQ_query_param_amount (&meta->fees.refund),
GNUNET_PQ_query_param_uint32 (&meta->age_mask.mask), GNUNET_PQ_query_param_uint32 (&meta->age_mask.bits),
GNUNET_PQ_query_param_end GNUNET_PQ_query_param_end
}; };
@ -10376,7 +10467,7 @@ postgres_lookup_signing_key (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_insert_auditor_denom_sig ( postgres_insert_auditor_denom_sig (
void *cls, void *cls,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const struct TALER_AuditorSignatureP *auditor_sig) const struct TALER_AuditorSignatureP *auditor_sig)
{ {
@ -10406,7 +10497,7 @@ postgres_insert_auditor_denom_sig (
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_select_auditor_denom_sig ( postgres_select_auditor_denom_sig (
void *cls, void *cls,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
struct TALER_AuditorSignatureP *auditor_sig) struct TALER_AuditorSignatureP *auditor_sig)
{ {
@ -10612,6 +10703,9 @@ postgres_lookup_serial_by_table (void *cls,
case TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS: case TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS:
statement = "select_serial_by_table_denomination_revocations"; statement = "select_serial_by_table_denomination_revocations";
break; break;
case TALER_EXCHANGEDB_RT_WIRE_TARGETS:
statement = "select_serial_by_table_wire_targets";
break;
case TALER_EXCHANGEDB_RT_RESERVES: case TALER_EXCHANGEDB_RT_RESERVES:
statement = "select_serial_by_table_reserves"; statement = "select_serial_by_table_reserves";
break; break;
@ -10845,9 +10939,17 @@ postgres_lookup_records_by_table (void *cls,
rh, rh,
&ctx); &ctx);
if (qs < 0) if (qs < 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to run `%s'\n",
statement);
return qs; return qs;
}
if (ctx.error) if (ctx.error)
{
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
}
return qs; return qs;
} }

View File

@ -536,8 +536,9 @@ cb_wt_never (void *cls,
uint64_t serial_id, uint64_t serial_id,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri, const char *account_payto_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *coin_value, const struct TALER_Amount *coin_value,
@ -558,8 +559,8 @@ cb_wt_never (void *cls,
static struct TALER_MerchantPublicKeyP merchant_pub_wt; static struct TALER_MerchantPublicKeyP merchant_pub_wt;
static struct TALER_MerchantWireHash h_wire_wt; static struct TALER_MerchantWireHashP h_wire_wt;
static struct TALER_PrivateContractHash h_contract_terms_wt; static struct TALER_PrivateContractHashP h_contract_terms_wt;
static struct TALER_CoinSpendPublicKeyP coin_pub_wt; static struct TALER_CoinSpendPublicKeyP coin_pub_wt;
static struct TALER_Amount coin_value_wt; static struct TALER_Amount coin_value_wt;
static struct TALER_Amount coin_fee_wt; static struct TALER_Amount coin_fee_wt;
@ -576,8 +577,9 @@ cb_wt_check (void *cls,
uint64_t rowid, uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri, const char *account_payto_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *coin_value, const struct TALER_Amount *coin_value,
@ -639,7 +641,7 @@ deposit_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
uint64_t wire_target, uint64_t wire_target,
const char *payto_uri) const char *payto_uri)
{ {
@ -686,7 +688,7 @@ matching_deposit_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_PrivateContractHash *h_contract_terms) const struct TALER_PrivateContractHashP *h_contract_terms)
{ {
struct TALER_EXCHANGEDB_Deposit *deposit = cls; struct TALER_EXCHANGEDB_Deposit *deposit = cls;
@ -761,7 +763,7 @@ audit_refund_cb (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_MerchantSignatureP *merchant_sig, const struct TALER_MerchantSignatureP *merchant_sig,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
uint64_t rtransaction_id, uint64_t rtransaction_id,
const struct TALER_Amount *amount_with_fee) const struct TALER_Amount *amount_with_fee)
{ {
@ -828,7 +830,7 @@ audit_reserve_in_cb (void *cls,
static enum GNUNET_GenericReturnValue static enum GNUNET_GenericReturnValue
audit_reserve_out_cb (void *cls, audit_reserve_out_cb (void *cls,
uint64_t rowid, uint64_t rowid,
const struct TALER_BlindedCoinHash *h_blind_ev, const struct TALER_BlindedCoinHashP *h_blind_ev,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig, const struct TALER_ReserveSignatureP *reserve_sig,
@ -860,7 +862,7 @@ test_gc (void)
struct GNUNET_TIME_Timestamp now; struct GNUNET_TIME_Timestamp now;
struct GNUNET_TIME_Timestamp past; struct GNUNET_TIME_Timestamp past;
struct TALER_EXCHANGEDB_DenominationKeyInformationP issue2; struct TALER_EXCHANGEDB_DenominationKeyInformationP issue2;
struct TALER_DenominationHash denom_hash; struct TALER_DenominationHashP denom_hash;
now = GNUNET_TIME_timestamp_get (); now = GNUNET_TIME_timestamp_get ();
past = GNUNET_TIME_absolute_to_timestamp ( past = GNUNET_TIME_absolute_to_timestamp (
@ -1079,7 +1081,8 @@ test_wire_out (const struct TALER_EXCHANGEDB_Deposit *deposit)
NULL)); NULL));
{ {
struct TALER_PrivateContractHash h_contract_terms_wt2 = h_contract_terms_wt; struct TALER_PrivateContractHashP h_contract_terms_wt2 =
h_contract_terms_wt;
bool pending; bool pending;
struct TALER_WireTransferIdentifierRawP wtid2; struct TALER_WireTransferIdentifierRawP wtid2;
struct TALER_Amount coin_contribution2; struct TALER_Amount coin_contribution2;
@ -1335,7 +1338,7 @@ run (void *cls)
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
struct GNUNET_TIME_Timestamp now; struct GNUNET_TIME_Timestamp now;
struct TALER_WireSaltP salt; struct TALER_WireSaltP salt;
struct TALER_CoinPubHash c_hash; struct TALER_CoinPubHashP c_hash;
uint64_t known_coin_id; uint64_t known_coin_id;
uint64_t rrc_serial; uint64_t rrc_serial;
struct TALER_EXCHANGEDB_Refresh refresh; struct TALER_EXCHANGEDB_Refresh refresh;
@ -1490,6 +1493,7 @@ run (void *cls)
TALER_denom_sign_blinded ( TALER_denom_sign_blinded (
&cbc.sig, &cbc.sig,
&dkp->priv, &dkp->priv,
false,
&pd.blinded_planchet)); &pd.blinded_planchet));
TALER_blinded_planchet_free (&pd.blinded_planchet); TALER_blinded_planchet_free (&pd.blinded_planchet);
} }
@ -1579,7 +1583,7 @@ run (void *cls)
&dkp->pub)); &dkp->pub));
deadline = GNUNET_TIME_timestamp_get (); deadline = GNUNET_TIME_timestamp_get ();
{ {
struct TALER_DenominationHash dph; struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh; struct TALER_AgeCommitmentHash agh;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED != FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
@ -1596,7 +1600,7 @@ run (void *cls)
= GNUNET_TIME_timestamp_get (); = GNUNET_TIME_timestamp_get ();
bool balance_ok; bool balance_ok;
bool in_conflict; bool in_conflict;
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
RND_BLK (&h_payto); RND_BLK (&h_payto);
deposit.refund_deadline deposit.refund_deadline
@ -1759,6 +1763,7 @@ run (void *cls)
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_denom_sign_blinded (&ccoin->coin_sig, TALER_denom_sign_blinded (&ccoin->coin_sig,
&new_dkp[cnt]->priv, &new_dkp[cnt]->priv,
true,
bp)); bp));
} }
RND_BLK (&tprivs); RND_BLK (&tprivs);
@ -1777,9 +1782,9 @@ run (void *cls)
tprivs, tprivs,
&tpub)); &tpub));
{ {
struct TALER_BlindedCoinHash h_coin_ev; struct TALER_BlindedCoinHashP h_coin_ev;
struct TALER_CoinSpendPublicKeyP ocp; struct TALER_CoinSpendPublicKeyP ocp;
struct TALER_DenominationHash denom_hash; struct TALER_DenominationHashP denom_hash;
TALER_denom_pub_hash (&new_denom_pubs[0], TALER_denom_pub_hash (&new_denom_pubs[0],
&denom_hash); &denom_hash);
@ -1827,7 +1832,7 @@ run (void *cls)
union TALER_DenominationBlindingKeyP coin_bks; union TALER_DenominationBlindingKeyP coin_bks;
uint64_t new_known_coin_id; uint64_t new_known_coin_id;
struct TALER_CoinPublicInfo new_coin; struct TALER_CoinPublicInfo new_coin;
struct TALER_DenominationHash dph; struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh; struct TALER_AgeCommitmentHash agh;
bool recoup_ok; bool recoup_ok;
bool internal_failure; bool internal_failure;
@ -2181,7 +2186,7 @@ run (void *cls)
result = 8; result = 8;
{ {
uint64_t known_coin_id; uint64_t known_coin_id;
struct TALER_DenominationHash dph; struct TALER_DenominationHashP dph;
struct TALER_AgeCommitmentHash agh; struct TALER_AgeCommitmentHash agh;
FAILIF (TALER_EXCHANGEDB_CKS_ADDED != FAILIF (TALER_EXCHANGEDB_CKS_ADDED !=
@ -2195,7 +2200,7 @@ run (void *cls)
struct GNUNET_TIME_Timestamp now; struct GNUNET_TIME_Timestamp now;
struct GNUNET_TIME_Timestamp r; struct GNUNET_TIME_Timestamp r;
struct TALER_Amount deposit_fee; struct TALER_Amount deposit_fee;
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
now = GNUNET_TIME_timestamp_get (); now = GNUNET_TIME_timestamp_get ();
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@ -2299,7 +2304,7 @@ run (void *cls)
"test-2")); "test-2"));
RND_BLK (&deposit2.merchant_pub); /* should fail if merchant is different */ RND_BLK (&deposit2.merchant_pub); /* should fail if merchant is different */
{ {
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
struct GNUNET_TIME_Timestamp r; struct GNUNET_TIME_Timestamp r;
struct TALER_Amount deposit_fee; struct TALER_Amount deposit_fee;

View File

@ -64,7 +64,7 @@ TALER_parse_age_group_string (
if (prev >= val) if (prev >= val)
return GNUNET_SYSERR; return GNUNET_SYSERR;
mask->mask |= 1 << val; mask->bits |= 1 << val;
prev = val; prev = val;
val = 0; val = 0;
continue; continue;
@ -82,8 +82,8 @@ TALER_parse_age_group_string (
if (0>val || 32<=val || prev>=val) if (0>val || 32<=val || prev>=val)
return GNUNET_SYSERR; return GNUNET_SYSERR;
mask->mask |= (1 << val); mask->bits |= (1 << val);
mask->mask |= 1; // mark zeroth group, too mask->bits |= 1; // mark zeroth group, too
return GNUNET_OK; return GNUNET_OK;
} }
@ -100,7 +100,7 @@ char *
TALER_age_mask_to_string ( TALER_age_mask_to_string (
const struct TALER_AgeMask *m) const struct TALER_AgeMask *m)
{ {
uint32_t mask = m->mask; uint32_t bits = m->bits;
unsigned int n = 0; unsigned int n = 0;
char *buf = GNUNET_malloc (32 * 3); // max characters possible char *buf = GNUNET_malloc (32 * 3); // max characters possible
char *pos = buf; char *pos = buf;
@ -110,11 +110,11 @@ TALER_age_mask_to_string (
return buf; return buf;
} }
while (mask != 0) while (bits != 0)
{ {
mask >>= 1; bits >>= 1;
n++; n++;
if (0 == (mask & 1)) if (0 == (bits & 1))
{ {
continue; continue;
} }
@ -125,7 +125,7 @@ TALER_age_mask_to_string (
} }
*(pos++) = '0' + n % 10; *(pos++) = '0' + n % 10;
if (0 != (mask >> 1)) if (0 != (bits >> 1))
{ {
*(pos++) = ':'; *(pos++) = ':';
} }
@ -160,7 +160,7 @@ age_restriction_disable (
this->config_json = NULL; this->config_json = NULL;
} }
_config.mask.mask = 0; _config.mask.bits = 0;
_config.num_groups = 0; _config.num_groups = 0;
} }
@ -212,23 +212,23 @@ age_restriction_load_taler_config (
return GNUNET_SYSERR; return GNUNET_SYSERR;
mask.mask = TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK; mask.bits = TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK;
ret = GNUNET_OK; ret = GNUNET_OK;
if (groups != NULL) if (groups != NULL)
{ {
ret = TALER_parse_age_group_string (groups, &mask); ret = TALER_parse_age_group_string (groups, &mask);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
mask.mask = TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK; mask.bits = TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK;
} }
if (GNUNET_OK == ret) if (GNUNET_OK == ret)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"setting age mask to %x with #groups: %d\n", mask.mask, "setting age mask to %x with #groups: %d\n", mask.bits,
__builtin_popcount (mask.mask) - 1); __builtin_popcount (mask.bits) - 1);
_config.mask.mask = mask.mask; _config.mask.bits = mask.bits;
_config.num_groups = __builtin_popcount (mask.mask) - 1; /* no underflow, first bit always set */ _config.num_groups = __builtin_popcount (mask.bits) - 1; /* no underflow, first bit always set */
this->config = &_config; this->config = &_config;
/* Note: we do now have _config set, however this->config_json is NOT set, /* Note: we do now have _config set, however this->config_json is NOT set,
@ -266,16 +266,16 @@ age_restriction_load_json_config (
if (TALER_Extension_AgeRestriction != this->type) if (TALER_Extension_AgeRestriction != this->type)
return GNUNET_SYSERR; return GNUNET_SYSERR;
_config.mask.mask = mask.mask; _config.mask.bits = mask.bits;
_config.num_groups = 0; _config.num_groups = 0;
if (mask.mask > 0) if (mask.bits > 0)
{ {
/* if the mask is not zero, the first bit MUST be set */ /* if the mask is not zero, the first bit MUST be set */
if (0 == (mask.mask & 1)) if (0 == (mask.bits & 1))
return GNUNET_SYSERR; return GNUNET_SYSERR;
_config.num_groups = __builtin_popcount (mask.mask) - 1; _config.num_groups = __builtin_popcount (mask.bits) - 1;
} }
this->config = &_config; this->config = &_config;
@ -358,7 +358,7 @@ struct TALER_Extension _extension_age_restriction = {
bool bool
TALER_extensions_age_restriction_is_configured () TALER_extensions_age_restriction_is_configured ()
{ {
return (0 != _config.mask.mask); return (0 != _config.mask.bits);
} }

View File

@ -139,7 +139,7 @@ TALER_extensions_get_by_name (
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
config_hash_verify ( config_hash_verify (
const struct TALER_ExtensionConfigHash *h_config, const struct TALER_ExtensionConfigHashP *h_config,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig const struct TALER_MasterSignatureP *master_sig
) )
@ -164,7 +164,7 @@ TALER_extensions_verify_json_config_signature (
struct TALER_MasterSignatureP *extensions_sig, struct TALER_MasterSignatureP *extensions_sig,
struct TALER_MasterPublicKeyP *master_pub) struct TALER_MasterPublicKeyP *master_pub)
{ {
struct TALER_ExtensionConfigHash h_config; struct TALER_ExtensionConfigHashP h_config;
if (GNUNET_OK != if (GNUNET_OK !=
TALER_JSON_extensions_config_hash (extensions, &h_config)) TALER_JSON_extensions_config_hash (extensions, &h_config))

View File

@ -256,9 +256,9 @@ typedef void
struct TALER_AUDITOR_DepositConfirmationHandle * struct TALER_AUDITOR_DepositConfirmationHandle *
TALER_AUDITOR_deposit_confirmation ( TALER_AUDITOR_deposit_confirmation (
struct TALER_AUDITOR_Handle *auditor, struct TALER_AUDITOR_Handle *auditor,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp exchange_timestamp, struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline, struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,

View File

@ -62,7 +62,7 @@ typedef void
typedef enum GNUNET_GenericReturnValue typedef enum GNUNET_GenericReturnValue
(*TALER_AUDITORDB_HistoricDenominationRevenueDataCallback)( (*TALER_AUDITORDB_HistoricDenominationRevenueDataCallback)(
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct GNUNET_TIME_Timestamp revenue_timestamp, struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance, const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *loss_balance); const struct TALER_Amount *loss_balance);
@ -274,17 +274,17 @@ struct TALER_AUDITORDB_DepositConfirmation
/** /**
* Hash over the contract for which this deposit is made. * Hash over the contract for which this deposit is made.
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
/** /**
* Hash over the extensions for the deposit. * Hash over the extensions for the deposit.
*/ */
struct TALER_ExtensionContractHash h_extensions; struct TALER_ExtensionContractHashP h_extensions;
/** /**
* Hash over the wiring information of the merchant. * Hash over the wiring information of the merchant.
*/ */
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
/** /**
* Time when this deposit confirmation was generated by the exchange. * Time when this deposit confirmation was generated by the exchange.
@ -1048,14 +1048,14 @@ struct TALER_AUDITORDB_Plugin
* @return transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*insert_denomination_balance)(void *cls, (*insert_denomination_balance)(
const struct void *cls,
TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
const struct TALER_Amount *denom_balance, const struct TALER_Amount *denom_balance,
const struct TALER_Amount *denom_loss, const struct TALER_Amount *denom_loss,
const struct TALER_Amount *denom_risk, const struct TALER_Amount *denom_risk,
const struct TALER_Amount *recoup_loss, const struct TALER_Amount *recoup_loss,
uint64_t num_issued); uint64_t num_issued);
/** /**
@ -1072,14 +1072,14 @@ struct TALER_AUDITORDB_Plugin
* @return transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*update_denomination_balance)(void *cls, (*update_denomination_balance)(
const struct void *cls,
TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
const struct TALER_Amount *denom_balance, const struct TALER_Amount *denom_balance,
const struct TALER_Amount *denom_loss, const struct TALER_Amount *denom_loss,
const struct TALER_Amount *denom_risk, const struct TALER_Amount *denom_risk,
const struct TALER_Amount *recoup_loss, const struct TALER_Amount *recoup_loss,
uint64_t num_issued); uint64_t num_issued);
/** /**
@ -1095,14 +1095,14 @@ struct TALER_AUDITORDB_Plugin
* @return transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*get_denomination_balance)(void *cls, (*get_denomination_balance)(
const struct void *cls,
TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_Amount *denom_balance, struct TALER_Amount *denom_balance,
struct TALER_Amount *denom_loss, struct TALER_Amount *denom_loss,
struct TALER_Amount *denom_risk, struct TALER_Amount *denom_risk,
struct TALER_Amount *recoup_loss, struct TALER_Amount *recoup_loss,
uint64_t *num_issued); uint64_t *num_issued);
/** /**
@ -1113,9 +1113,9 @@ struct TALER_AUDITORDB_Plugin
* @return transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*del_denomination_balance)(void *cls, (*del_denomination_balance)(
const struct void *cls,
TALER_DenominationHash *denom_pub_hash); const struct TALER_DenominationHashP *denom_pub_hash);
/** /**
@ -1219,7 +1219,7 @@ struct TALER_AUDITORDB_Plugin
(*insert_historic_denom_revenue)( (*insert_historic_denom_revenue)(
void *cls, void *cls,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct GNUNET_TIME_Timestamp revenue_timestamp, struct GNUNET_TIME_Timestamp revenue_timestamp,
const struct TALER_Amount *revenue_balance, const struct TALER_Amount *revenue_balance,
const struct TALER_Amount *recoup_loss_balance); const struct TALER_Amount *recoup_loss_balance);

View File

@ -489,7 +489,7 @@ struct TALER_RefreshMasterSecretP
* Hash used to represent a denomination public key * Hash used to represent a denomination public key
* and associated age restrictions (if any). * and associated age restrictions (if any).
*/ */
struct TALER_DenominationHash struct TALER_DenominationHashP
{ {
/** /**
* Actual hash value. * Actual hash value.
@ -502,7 +502,7 @@ struct TALER_DenominationHash
* Hash used to represent the private part * Hash used to represent the private part
* of a contract between merchant and consumer. * of a contract between merchant and consumer.
*/ */
struct TALER_PrivateContractHash struct TALER_PrivateContractHashP
{ {
/** /**
* Actual hash value. * Actual hash value.
@ -515,7 +515,7 @@ struct TALER_PrivateContractHash
* Hash used to represent the "public" extensions to * Hash used to represent the "public" extensions to
* a contract that is shared with the exchange. * a contract that is shared with the exchange.
*/ */
struct TALER_ExtensionContractHash struct TALER_ExtensionContractHashP
{ {
/** /**
* Actual hash value. * Actual hash value.
@ -528,7 +528,7 @@ struct TALER_ExtensionContractHash
* Hash used to represent the salted hash of a * Hash used to represent the salted hash of a
* merchant's bank account. * merchant's bank account.
*/ */
struct TALER_MerchantWireHash struct TALER_MerchantWireHashP
{ {
/** /**
* Actual hash value. * Actual hash value.
@ -541,7 +541,7 @@ struct TALER_MerchantWireHash
* Hash used to represent the unsalted hash of a * Hash used to represent the unsalted hash of a
* payto:// URI representing a bank account. * payto:// URI representing a bank account.
*/ */
struct TALER_PaytoHash struct TALER_PaytoHashP
{ {
/** /**
* Actual hash value. * Actual hash value.
@ -554,7 +554,7 @@ struct TALER_PaytoHash
* Hash used to represent a commitment to a blinded * Hash used to represent a commitment to a blinded
* coin, i.e. the hash of the envelope. * coin, i.e. the hash of the envelope.
*/ */
struct TALER_BlindedCoinHash struct TALER_BlindedCoinHashP
{ {
/** /**
* Actual hash value. * Actual hash value.
@ -567,7 +567,7 @@ struct TALER_BlindedCoinHash
* Hash used to represent the hash of the public * Hash used to represent the hash of the public
* key of a coin (without blinding). * key of a coin (without blinding).
*/ */
struct TALER_CoinPubHash struct TALER_CoinPubHashP
{ {
/** /**
* Actual hash value. * Actual hash value.
@ -604,7 +604,7 @@ struct TALER_PickupIdentifierP
* @brief Salted hash over the JSON object representing the configuration of an * @brief Salted hash over the JSON object representing the configuration of an
* extension. * extension.
*/ */
struct TALER_ExtensionConfigHash struct TALER_ExtensionConfigHashP
{ {
/** /**
* Actual hash value. * Actual hash value.
@ -850,7 +850,7 @@ struct TALER_BlindedDenominationSignature
*/ */
struct TALER_AgeMask struct TALER_AgeMask
{ {
uint32_t mask; uint32_t bits;
}; };
/** /**
@ -864,6 +864,14 @@ struct TALER_AgeCommitmentHash
struct GNUNET_ShortHashCode shash; struct GNUNET_ShortHashCode shash;
}; };
/**
* @brief Signature of an age with the private key for the corresponding age group of an age commitment.
*/
struct TALER_AgeAttestation
{
struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
};
extern const struct TALER_AgeCommitmentHash TALER_ZeroAgeCommitmentHash; extern const struct TALER_AgeCommitmentHash TALER_ZeroAgeCommitmentHash;
#define TALER_AgeCommitmentHash_isNullOrZero(ph) ((NULL == ph) || \ #define TALER_AgeCommitmentHash_isNullOrZero(ph) ((NULL == ph) || \
(0 == memcmp (ph, \ (0 == memcmp (ph, \
@ -1047,7 +1055,7 @@ struct TALER_CoinPublicInfo
* Hash of the public key representing the denomination of the coin that is * Hash of the public key representing the denomination of the coin that is
* being deposited. * being deposited.
*/ */
struct TALER_DenominationHash denom_pub_hash; struct TALER_DenominationHashP denom_pub_hash;
/** /**
* Hash of the age commitment. If no age commitment was provided, it must be * Hash of the age commitment. If no age commitment was provided, it must be
@ -1055,6 +1063,11 @@ struct TALER_CoinPublicInfo
*/ */
struct TALER_AgeCommitmentHash h_age_commitment; struct TALER_AgeCommitmentHash h_age_commitment;
/**
* True, if age commitment is not applicable.
*/
bool no_age_commitment;
/** /**
* (Unblinded) signature over @e coin_pub with @e denom_pub, * (Unblinded) signature over @e coin_pub with @e denom_pub,
* which demonstrates that the coin is valid. * which demonstrates that the coin is valid.
@ -1072,7 +1085,7 @@ struct TALER_TrackTransferDetails
/** /**
* Hash of the proposal data. * Hash of the proposal data.
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
/** /**
* Which coin was deposited? * Which coin was deposited?
@ -1227,7 +1240,7 @@ TALER_denom_blind (const struct TALER_DenominationPublicKey *dk,
const struct TALER_AgeCommitmentHash *age_commitment_hash, const struct TALER_AgeCommitmentHash *age_commitment_hash,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_ExchangeWithdrawValues *alg_values, const struct TALER_ExchangeWithdrawValues *alg_values,
struct TALER_CoinPubHash *c_hash, struct TALER_CoinPubHashP *c_hash,
struct TALER_BlindedPlanchet *blinded_planchet); struct TALER_BlindedPlanchet *blinded_planchet);
@ -1236,12 +1249,14 @@ TALER_denom_blind (const struct TALER_DenominationPublicKey *dk,
* *
* @param[out] denom_sig where to write the signature * @param[out] denom_sig where to write the signature
* @param denom_priv private key to use for signing * @param denom_priv private key to use for signing
* @param for_melt true to use the HKDF for melt
* @param blinded_planchet the planchet already blinded * @param blinded_planchet the planchet already blinded
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_denom_sign_blinded (struct TALER_BlindedDenominationSignature *denom_sig, TALER_denom_sign_blinded (struct TALER_BlindedDenominationSignature *denom_sig,
const struct TALER_DenominationPrivateKey *denom_priv, const struct TALER_DenominationPrivateKey *denom_priv,
bool for_melt,
const struct TALER_BlindedPlanchet *blinded_planchet); const struct TALER_BlindedPlanchet *blinded_planchet);
@ -1261,7 +1276,7 @@ TALER_denom_sig_unblind (
struct TALER_DenominationSignature *denom_sig, struct TALER_DenominationSignature *denom_sig,
const struct TALER_BlindedDenominationSignature *bdenom_sig, const struct TALER_BlindedDenominationSignature *bdenom_sig,
const union TALER_DenominationBlindingKeyP *bks, const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinPubHash *c_hash, const struct TALER_CoinPubHashP *c_hash,
const struct TALER_ExchangeWithdrawValues *alg_values, const struct TALER_ExchangeWithdrawValues *alg_values,
const struct TALER_DenominationPublicKey *denom_pub); const struct TALER_DenominationPublicKey *denom_pub);
@ -1284,7 +1299,7 @@ TALER_blinded_denom_sig_free (
*/ */
void void
TALER_denom_pub_hash (const struct TALER_DenominationPublicKey *denom_pub, TALER_denom_pub_hash (const struct TALER_DenominationPublicKey *denom_pub,
struct TALER_DenominationHash *denom_hash); struct TALER_DenominationHashP *denom_hash);
/** /**
@ -1399,7 +1414,7 @@ TALER_denom_priv_to_pub (const struct TALER_DenominationPrivateKey *denom_priv,
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_denom_pub_verify (const struct TALER_DenominationPublicKey *denom_pub, TALER_denom_pub_verify (const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationSignature *denom_sig,
const struct TALER_CoinPubHash *c_hash); const struct TALER_CoinPubHashP *c_hash);
/** /**
@ -1427,8 +1442,8 @@ TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info,
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet, TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet,
const struct TALER_DenominationHash *denom_hash, const struct TALER_DenominationHashP *denom_hash,
struct TALER_BlindedCoinHash *bch); struct TALER_BlindedCoinHashP *bch);
/** /**
@ -1441,7 +1456,7 @@ TALER_coin_ev_hash (const struct TALER_BlindedPlanchet *blinded_planchet,
void void
TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub, TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_AgeCommitmentHash *age_commitment_hash, const struct TALER_AgeCommitmentHash *age_commitment_hash,
struct TALER_CoinPubHash *coin_h); struct TALER_CoinPubHashP *coin_h);
/** /**
@ -1452,7 +1467,7 @@ TALER_coin_pub_hash (const struct TALER_CoinSpendPublicKeyP *coin_pub,
*/ */
void void
TALER_payto_hash (const char *payto, TALER_payto_hash (const char *payto,
struct TALER_PaytoHash *h_payto); struct TALER_PaytoHashP *h_payto);
/** /**
* Details about a planchet that the customer wants to obtain * Details about a planchet that the customer wants to obtain
@ -1465,7 +1480,7 @@ struct TALER_PlanchetDetail
/** /**
* Hash of the denomination public key. * Hash of the denomination public key.
*/ */
struct TALER_DenominationHash denom_pub_hash; struct TALER_DenominationHashP denom_pub_hash;
/** /**
* The blinded planchet * The blinded planchet
@ -1679,7 +1694,7 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
const union TALER_DenominationBlindingKeyP *bks, const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitmentHash *ach, const struct TALER_AgeCommitmentHash *ach,
struct TALER_CoinPubHash *c_hash, struct TALER_CoinPubHashP *c_hash,
struct TALER_PlanchetDetail *pd); struct TALER_PlanchetDetail *pd);
@ -1723,7 +1738,7 @@ TALER_planchet_to_coin (
const union TALER_DenominationBlindingKeyP *bks, const union TALER_DenominationBlindingKeyP *bks,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitmentHash *ach, const struct TALER_AgeCommitmentHash *ach,
const struct TALER_CoinPubHash *c_hash, const struct TALER_CoinPubHashP *c_hash,
const struct TALER_ExchangeWithdrawValues *alg_values, const struct TALER_ExchangeWithdrawValues *alg_values,
struct TALER_FreshCoin *coin); struct TALER_FreshCoin *coin);
@ -2048,7 +2063,31 @@ TALER_CRYPTO_helper_cs_poll (struct TALER_CRYPTO_CsDenominationHelper *dh);
* @return #TALER_EC_NONE on success * @return #TALER_EC_NONE on success
*/ */
enum TALER_ErrorCode enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_sign ( TALER_CRYPTO_helper_cs_sign_melt (
struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CsPubHashP *h_cs,
const struct TALER_BlindedCsPlanchet *blinded_planchet,
struct TALER_BlindedDenominationSignature *bs);
/**
* Request helper @a dh to sign @a msg using the public key corresponding to
* @a h_denom_pub.
*
* This operation will block until the signature has been obtained. Should
* this process receive a signal (that is not ignored) while the operation is
* pending, the operation will fail. Note that the helper may still believe
* that it created the signature. Thus, signals may result in a small
* differences in the signature counters. Retrying in this case may work.
*
* @param dh helper process connection
* @param h_cs hash of the CS public key to use to sign
* @param blinded_planchet blinded planchet containing c and nonce
* @param[out] bs set to the blind signature
* @return #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_sign_withdraw (
struct TALER_CRYPTO_CsDenominationHelper *dh, struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CsPubHashP *h_cs, const struct TALER_CsPubHashP *h_cs,
const struct TALER_BlindedCsPlanchet *blinded_planchet, const struct TALER_BlindedCsPlanchet *blinded_planchet,
@ -2093,10 +2132,35 @@ TALER_CRYPTO_helper_cs_revoke (
* @return set to the error code (or #TALER_EC_NONE on success) * @return set to the error code (or #TALER_EC_NONE on success)
*/ */
enum TALER_ErrorCode enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_r_derive (struct TALER_CRYPTO_CsDenominationHelper *dh, TALER_CRYPTO_helper_cs_r_derive_withdraw (
const struct TALER_CsPubHashP *h_cs, struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CsNonce *nonce, const struct TALER_CsPubHashP *h_cs,
struct TALER_DenominationCSPublicRPairP *crp); const struct TALER_CsNonce *nonce,
struct TALER_DenominationCSPublicRPairP *crp);
/**
* Ask the helper to derive R using the @a nonce and denomination key
* associated with @a h_cs.
*
* This operation will block until the R has been obtained. Should
* this process receive a signal (that is not ignored) while the operation is
* pending, the operation will fail. Note that the helper may still believe
* that it created the signature. Thus, signals may result in a small
* differences in the signature counters. Retrying in this case may work.
*
* @param dh helper to process connection
* @param h_cs hash of the CS public key to revoke
* @param nonce witdhraw nonce
* @param[out] crp set to the pair of R values
* @return set to the error code (or #TALER_EC_NONE on success)
*/
enum TALER_ErrorCode
TALER_CRYPTO_helper_cs_r_derive_melt (
struct TALER_CRYPTO_CsDenominationHelper *dh,
const struct TALER_CsPubHashP *h_cs,
const struct TALER_CsNonce *nonce,
struct TALER_DenominationCSPublicRPairP *crp);
/** /**
@ -2269,9 +2333,9 @@ TALER_CRYPTO_helper_esign_disconnect (
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_exchange_deposit_confirm_verify ( TALER_exchange_deposit_confirm_verify (
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_ExtensionContractHashP *h_extensions,
struct GNUNET_TIME_Timestamp exchange_timestamp, struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline, struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,
@ -2316,11 +2380,11 @@ void
TALER_wallet_deposit_sign ( TALER_wallet_deposit_sign (
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment, const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp wallet_timestamp, struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,
@ -2349,11 +2413,11 @@ enum GNUNET_GenericReturnValue
TALER_wallet_deposit_verify ( TALER_wallet_deposit_verify (
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_commitment_hash, const struct TALER_AgeCommitmentHash *h_commitment_hash,
const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp wallet_timestamp, struct GNUNET_TIME_Timestamp wallet_timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,
@ -2368,6 +2432,7 @@ TALER_wallet_deposit_verify (
* @param melt_fee the melt fee we expect to pay * @param melt_fee the melt fee we expect to pay
* @param rc refresh session we are committed to * @param rc refresh session we are committed to
* @param h_denom_pub hash of the coin denomination's public key * @param h_denom_pub hash of the coin denomination's public key
* @param h_age_commitment hash of the age commitment (may be NULL)
* @param coin_priv coins private key * @param coin_priv coins private key
* @param[out] coin_sig set to the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_MELT * @param[out] coin_sig set to the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_MELT
*/ */
@ -2376,7 +2441,8 @@ TALER_wallet_melt_sign (
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *melt_fee, const struct TALER_Amount *melt_fee,
const struct TALER_RefreshCommitmentP *rc, const struct TALER_RefreshCommitmentP *rc,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig); struct TALER_CoinSpendSignatureP *coin_sig);
@ -2398,7 +2464,7 @@ TALER_wallet_melt_verify (
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *melt_fee, const struct TALER_Amount *melt_fee,
const struct TALER_RefreshCommitmentP *rc, const struct TALER_RefreshCommitmentP *rc,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment, const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig); const struct TALER_CoinSpendSignatureP *coin_sig);
@ -2415,9 +2481,9 @@ TALER_wallet_melt_verify (
*/ */
void void
TALER_wallet_link_sign ( TALER_wallet_link_sign (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_TransferPublicKeyP *transfer_pub, const struct TALER_TransferPublicKeyP *transfer_pub,
const struct TALER_BlindedCoinHash *bch, const struct TALER_BlindedCoinHashP *bch,
const struct TALER_CoinSpendPrivateKeyP *old_coin_priv, const struct TALER_CoinSpendPrivateKeyP *old_coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig); struct TALER_CoinSpendSignatureP *coin_sig);
@ -2434,9 +2500,9 @@ TALER_wallet_link_sign (
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_wallet_link_verify ( TALER_wallet_link_verify (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_TransferPublicKeyP *transfer_pub, const struct TALER_TransferPublicKeyP *transfer_pub,
const struct TALER_BlindedCoinHash *h_coin_ev, const struct TALER_BlindedCoinHashP *h_coin_ev,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub, const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig); const struct TALER_CoinSpendSignatureP *coin_sig);
@ -2452,9 +2518,9 @@ TALER_wallet_link_verify (
*/ */
void void
TALER_wallet_withdraw_sign ( TALER_wallet_withdraw_sign (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_BlindedCoinHash *bch, const struct TALER_BlindedCoinHashP *bch,
const struct TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_ReservePrivateKeyP *reserve_priv,
struct TALER_ReserveSignatureP *reserve_sig); struct TALER_ReserveSignatureP *reserve_sig);
@ -2471,9 +2537,9 @@ TALER_wallet_withdraw_sign (
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_wallet_withdraw_verify ( TALER_wallet_withdraw_verify (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_BlindedCoinHash *bch, const struct TALER_BlindedCoinHashP *bch,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig); const struct TALER_ReserveSignatureP *reserve_sig);
@ -2506,7 +2572,7 @@ TALER_exchange_melt_confirmation_verify (
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_wallet_recoup_verify ( TALER_wallet_recoup_verify (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const union TALER_DenominationBlindingKeyP *coin_bks, const union TALER_DenominationBlindingKeyP *coin_bks,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig); const struct TALER_CoinSpendSignatureP *coin_sig);
@ -2522,7 +2588,7 @@ TALER_wallet_recoup_verify (
*/ */
void void
TALER_wallet_recoup_sign ( TALER_wallet_recoup_sign (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const union TALER_DenominationBlindingKeyP *coin_bks, const union TALER_DenominationBlindingKeyP *coin_bks,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig); struct TALER_CoinSpendSignatureP *coin_sig);
@ -2539,7 +2605,7 @@ TALER_wallet_recoup_sign (
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_wallet_recoup_refresh_verify ( TALER_wallet_recoup_refresh_verify (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const union TALER_DenominationBlindingKeyP *coin_bks, const union TALER_DenominationBlindingKeyP *coin_bks,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_CoinSpendSignatureP *coin_sig); const struct TALER_CoinSpendSignatureP *coin_sig);
@ -2555,7 +2621,7 @@ TALER_wallet_recoup_refresh_verify (
*/ */
void void
TALER_wallet_recoup_refresh_sign ( TALER_wallet_recoup_refresh_sign (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const union TALER_DenominationBlindingKeyP *coin_bks, const union TALER_DenominationBlindingKeyP *coin_bks,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
struct TALER_CoinSpendSignatureP *coin_sig); struct TALER_CoinSpendSignatureP *coin_sig);
@ -2577,7 +2643,7 @@ TALER_wallet_recoup_refresh_sign (
void void
TALER_merchant_refund_sign ( TALER_merchant_refund_sign (
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
uint64_t rtransaction_id, uint64_t rtransaction_id,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_MerchantPrivateKeyP *merchant_priv, const struct TALER_MerchantPrivateKeyP *merchant_priv,
@ -2598,7 +2664,7 @@ TALER_merchant_refund_sign (
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_merchant_refund_verify ( TALER_merchant_refund_verify (
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
uint64_t rtransaction_id, uint64_t rtransaction_id,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
@ -2687,7 +2753,7 @@ TALER_exchange_offline_auditor_del_verify (
*/ */
void void
TALER_exchange_offline_denomination_revoke_sign ( TALER_exchange_offline_denomination_revoke_sign (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_MasterPrivateKeyP *master_priv, const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig); struct TALER_MasterSignatureP *master_sig);
@ -2702,7 +2768,7 @@ TALER_exchange_offline_denomination_revoke_sign (
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_exchange_offline_denomination_revoke_verify ( TALER_exchange_offline_denomination_revoke_verify (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig); const struct TALER_MasterSignatureP *master_sig);
@ -2792,7 +2858,7 @@ TALER_exchange_offline_signkey_validity_verify (
*/ */
void void
TALER_exchange_offline_denom_validity_sign ( TALER_exchange_offline_denom_validity_sign (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp stamp_start, struct GNUNET_TIME_Timestamp stamp_start,
struct GNUNET_TIME_Timestamp stamp_expire_withdraw, struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
struct GNUNET_TIME_Timestamp stamp_expire_deposit, struct GNUNET_TIME_Timestamp stamp_expire_deposit,
@ -2819,7 +2885,7 @@ TALER_exchange_offline_denom_validity_sign (
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_exchange_offline_denom_validity_verify ( TALER_exchange_offline_denom_validity_verify (
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
struct GNUNET_TIME_Timestamp stamp_start, struct GNUNET_TIME_Timestamp stamp_start,
struct GNUNET_TIME_Timestamp stamp_expire_withdraw, struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
struct GNUNET_TIME_Timestamp stamp_expire_deposit, struct GNUNET_TIME_Timestamp stamp_expire_deposit,
@ -2967,7 +3033,7 @@ TALER_exchange_secmod_cs_verify (
void void
TALER_auditor_denom_validity_sign ( TALER_auditor_denom_validity_sign (
const char *auditor_url, const char *auditor_url,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Timestamp stamp_start, struct GNUNET_TIME_Timestamp stamp_start,
struct GNUNET_TIME_Timestamp stamp_expire_withdraw, struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
@ -2998,7 +3064,7 @@ TALER_auditor_denom_validity_sign (
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_auditor_denom_validity_verify ( TALER_auditor_denom_validity_verify (
const char *auditor_url, const char *auditor_url,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
struct GNUNET_TIME_Timestamp stamp_start, struct GNUNET_TIME_Timestamp stamp_start,
struct GNUNET_TIME_Timestamp stamp_expire_withdraw, struct GNUNET_TIME_Timestamp stamp_expire_withdraw,
@ -3165,7 +3231,7 @@ TALER_exchange_wire_signature_make (
void void
TALER_merchant_wire_signature_hash (const char *payto_uri, TALER_merchant_wire_signature_hash (const char *payto_uri,
const struct TALER_WireSaltP *salt, const struct TALER_WireSaltP *salt,
struct TALER_MerchantWireHash *hc); struct TALER_MerchantWireHashP *hc);
/** /**
@ -3212,7 +3278,7 @@ TALER_merchant_wire_signature_make (
*/ */
void void
TALER_exchange_offline_extension_config_hash_sign ( TALER_exchange_offline_extension_config_hash_sign (
const struct TALER_ExtensionConfigHash *h_config, const struct TALER_ExtensionConfigHashP *h_config,
const struct TALER_MasterPrivateKeyP *master_priv, const struct TALER_MasterPrivateKeyP *master_priv,
struct TALER_MasterSignatureP *master_sig); struct TALER_MasterSignatureP *master_sig);
@ -3228,7 +3294,7 @@ TALER_exchange_offline_extension_config_hash_sign (
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_exchange_offline_extension_config_hash_verify ( TALER_exchange_offline_extension_config_hash_verify (
const struct TALER_ExtensionConfigHash *h_config, const struct TALER_ExtensionConfigHashP *h_config,
const struct TALER_MasterPublicKeyP *master_pub, const struct TALER_MasterPublicKeyP *master_pub,
const struct TALER_MasterSignatureP *master_sig const struct TALER_MasterSignatureP *master_sig
); );
@ -3249,7 +3315,7 @@ struct TALER_AgeCommitment
/* The number of public keys, which must be the same as the number of /* The number of public keys, which must be the same as the number of
* groups in the mask. * groups in the mask.
*/ */
size_t num_pub; size_t num;
/* The list of #num_pub public keys. In must have same size as the number of /* The list of #num_pub public keys. In must have same size as the number of
* age groups defined in the mask. * age groups defined in the mask.
@ -3261,12 +3327,17 @@ struct TALER_AgeCommitment
* The list has been allocated via GNUNET_malloc. * The list has been allocated via GNUNET_malloc.
*/ */
struct TALER_AgeCommitmentPublicKeyP *pub; struct TALER_AgeCommitmentPublicKeyP *pub;
};
struct TALER_AgeProof
{
/* The number of private keys, which must be at most num_pub_keys. One minus /* The number of private keys, which must be at most num_pub_keys. One minus
* this number corresponds to the largest age group that is supported with * this number corresponds to the largest age group that is supported with
* this age commitment. * this age commitment.
* **Note**, that this and the next field are only relevant on the wallet
* side for attestation and derive operations.
*/ */
size_t num_priv; size_t num;
/* List of #num_priv private keys. /* List of #num_priv private keys.
* *
@ -3279,6 +3350,12 @@ struct TALER_AgeCommitment
struct TALER_AgeCommitmentPrivateKeyP *priv; struct TALER_AgeCommitmentPrivateKeyP *priv;
}; };
struct TALER_AgeCommitmentProof
{
struct TALER_AgeCommitment commitment;
struct TALER_AgeProof proof;
};
/* /*
* @brief Generates a hash of the public keys in the age commitment. * @brief Generates a hash of the public keys in the age commitment.
* *
@ -3295,37 +3372,85 @@ TALER_age_commitment_hash (
* *
* @param mask The age mask the defines the age groups * @param mask The age mask the defines the age groups
* @param age The actual age for which an age commitment is generated * @param age The actual age for which an age commitment is generated
* @param seed The seed that goes into the key generation. MUST be choosen uniformly random. * @param salt The salt that goes into the key generation. MUST be choosen uniformly random.
* @param commitment[out] The generated age commitment, ->priv and ->pub allocated via GNUNET_malloc on success * @param comm_proof[out] The generated age commitment, ->priv and ->pub allocated via GNUNET_malloc on success
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_age_restriction_commit ( TALER_age_restriction_commit (
const struct TALER_AgeMask *mask, const struct TALER_AgeMask *mask,
const uint8_t age, const uint8_t age,
const uint32_t seed, const uint64_t salt,
struct TALER_AgeCommitment *commitment); struct TALER_AgeCommitmentProof *comm_proof);
/* /*
* @brief Derives another, equivalent age commitment for a given one. * @brief Derives another, equivalent age commitment for a given one.
* *
* @param orig Original age commitment * @param orig Original age commitment
* @param seed Used to move the points on the elliptic curve in order to generate another, equivalent commitment. * @param salt Salt to randomly move the points on the elliptic curve in order to generate another, equivalent commitment.
* @param derived[out] The resulting age commitment, ->priv and ->pub allocated via GNUNET_malloc on success. * @param[out] derived The resulting age commitment, ->priv and ->pub allocated via GNUNET_malloc on success.
* @return GNUNET_OK on success, GNUNET_SYSERR otherwise * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_age_commitment_derive ( TALER_age_commitment_derive (
const struct TALER_AgeCommitment *orig, const struct TALER_AgeCommitmentProof *orig,
const uint32_t seed, const uint64_t salt,
struct TALER_AgeCommitment *derived); struct TALER_AgeCommitmentProof *derived);
/*
* @brief Provide attestation for a given age, from a given age commitment, if possible.
*
* @param comm_proof The age commitment to be used for attestation. For successful attestation, it must contain the private key for the corresponding age group.
* @param age Age (not age group) for which the an attestation should be done
* @param[out] attest Signature of the age with the appropriate key from the age commitment for the corresponding age group, if applicaple.
* @return GNUNET_OK on success, GNUNET_NO when no attestation can be made for that age with the given commitment, GNUNET_SYSERR otherwise
*/
enum GNUNET_GenericReturnValue
TALER_age_commitment_attest (
const struct TALER_AgeCommitmentProof *comm_proof,
uint8_t age,
struct TALER_AgeAttestation *attest);
/*
* @brief Verify the attestation for an given age and age commitment
*
* @param commitent The age commitment that went into the attestation. Only the public keys are needed.
* @param age Age (not age group) for which the an attestation should be done
* @param attest Signature of the age with the appropriate key from the age commitment for the corresponding age group, if applicaple.
* @return GNUNET_OK when the attestation was successfull, GNUNET_NO no attestation couldn't be verified, GNUNET_SYSERR otherwise
*/
enum GNUNET_GenericReturnValue
TALER_age_commitment_verify (
const struct TALER_AgeCommitment *commitment,
uint8_t age,
const struct TALER_AgeAttestation *attest);
/* /*
* @brief helper function to free memory of a struct TALER_AgeCommitment * @brief helper function to free memory of a struct TALER_AgeCommitment
* @param cmt the commitment from which all memory should be freed. *
* @param p the commitment from which all memory should be freed.
*/ */
void void
TALER_age_commitment_free ( TALER_age_commitment_free (
struct TALER_AgeCommitment *cmt); struct TALER_AgeCommitment *p);
/*
* @brief helper function to free memory of a struct TALER_AgeProof
*
* @param p the proof of commitment from which all memory should be freed.
*/
void
TALER_age_proof_free (
struct TALER_AgeProof *p);
/*
* @brief helper function to free memory of a struct TALER_AgeCommitmentProof
*
* @param p the commitment and its proof from which all memory should be freed.
*/
void
TALER_age_commitment_proof_free (
struct TALER_AgeCommitmentProof *p);
#endif #endif

View File

@ -97,7 +97,7 @@ struct TALER_EXCHANGE_DenomPublicKey
/** /**
* The hash of the public key. * The hash of the public key.
*/ */
struct TALER_DenominationHash h_key; struct TALER_DenominationHashP h_key;
/** /**
* Exchange's master signature over this denomination record. * Exchange's master signature over this denomination record.
@ -609,7 +609,7 @@ TALER_EXCHANGE_destroy_denomination_key (
const struct TALER_EXCHANGE_DenomPublicKey * const struct TALER_EXCHANGE_DenomPublicKey *
TALER_EXCHANGE_get_denomination_key_by_hash ( TALER_EXCHANGE_get_denomination_key_by_hash (
const struct TALER_EXCHANGE_Keys *keys, const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_DenominationHash *hc); const struct TALER_DenominationHashP *hc);
/** /**
@ -775,10 +775,10 @@ void
TALER_EXCHANGE_deposit_permission_sign ( TALER_EXCHANGE_deposit_permission_sign (
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitment *age_commitment, const struct TALER_AgeCommitment *age_commitment,
struct GNUNET_TIME_Timestamp wallet_timestamp, struct GNUNET_TIME_Timestamp wallet_timestamp,
@ -905,7 +905,7 @@ TALER_EXCHANGE_deposit (
struct GNUNET_TIME_Timestamp wire_deadline, struct GNUNET_TIME_Timestamp wire_deadline,
const char *merchant_payto_uri, const char *merchant_payto_uri,
const struct TALER_WireSaltP *wire_salt, const struct TALER_WireSaltP *wire_salt,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment, const struct TALER_AgeCommitmentHash *h_age_commitment,
const json_t *extension_details, const json_t *extension_details,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
@ -996,7 +996,8 @@ typedef void
struct TALER_EXCHANGE_RefundHandle * struct TALER_EXCHANGE_RefundHandle *
TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_PrivateContractHash *h_contract_terms, const struct
TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t rtransaction_id, uint64_t rtransaction_id,
const struct TALER_MerchantPrivateKeyP *merchant_priv, const struct TALER_MerchantPrivateKeyP *merchant_priv,
@ -1681,9 +1682,11 @@ struct TALER_EXCHANGE_RefreshData
struct TALER_CoinSpendPrivateKeyP melt_priv; struct TALER_CoinSpendPrivateKeyP melt_priv;
/* /*
* age commitment that went into the original coin, might be NULL * age commitment and proof and its hash that went into the original coin,
* might be NULL.
*/ */
struct TALER_AgeCommitment *age_commitment; const struct TALER_AgeCommitmentProof *melt_age_commitment_proof;
const struct TALER_AgeCommitmentHash *melt_h_age_commitment;
/** /**
* amount specifying how much the coin will contribute to the melt * amount specifying how much the coin will contribute to the melt
@ -1855,7 +1858,7 @@ struct TALER_EXCHANGE_RevealedCoinInfo
/** /**
* Age commitment and its hash of the coin, might be NULL. * Age commitment and its hash of the coin, might be NULL.
*/ */
struct TALER_AgeCommitment *age_commitment; struct TALER_AgeCommitmentProof *age_commitment_proof;
struct TALER_AgeCommitmentHash *h_age_commitment; struct TALER_AgeCommitmentHash *h_age_commitment;
/** /**
@ -1996,6 +1999,12 @@ struct TALER_EXCHANGE_LinkedCoinInfo
*/ */
struct TALER_CoinSpendPrivateKeyP coin_priv; struct TALER_CoinSpendPrivateKeyP coin_priv;
/**
* Age commitment and its hash, if applicable. Might be NULL.
*/
struct TALER_AgeCommitmentProof *age_commitment_proof;
struct TALER_AgeCommitmentHash *h_age_commitment;
/** /**
* Master secret of this coin. * Master secret of this coin.
*/ */
@ -2083,7 +2092,8 @@ typedef void
struct TALER_EXCHANGE_LinkHandle * struct TALER_EXCHANGE_LinkHandle *
TALER_EXCHANGE_link (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_link (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitment *age_commitment, const struct
TALER_AgeCommitmentProof *age_commitment_proof,
TALER_EXCHANGE_LinkCallback link_cb, TALER_EXCHANGE_LinkCallback link_cb,
void *link_cb_cls); void *link_cb_cls);
@ -2125,7 +2135,7 @@ struct TALER_EXCHANGE_TransferData
/** /**
* hash of the payto:// URI the transfer went to * hash of the payto:// URI the transfer went to
*/ */
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
/** /**
* time when the exchange claims to have performed the wire transfer * time when the exchange claims to have performed the wire transfer
@ -2324,8 +2334,8 @@ struct TALER_EXCHANGE_DepositGetHandle *
TALER_EXCHANGE_deposits_get ( TALER_EXCHANGE_deposits_get (
struct TALER_EXCHANGE_Handle *exchange, struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_MerchantPrivateKeyP *merchant_priv, const struct TALER_MerchantPrivateKeyP *merchant_priv,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
TALER_EXCHANGE_DepositGetCallback cb, TALER_EXCHANGE_DepositGetCallback cb,
void *cb_cls); void *cb_cls);
@ -2360,7 +2370,7 @@ TALER_EXCHANGE_verify_coin_history (
const char *currency, const char *currency,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
json_t *history, json_t *history,
struct TALER_DenominationHash *h_denom_pub, struct TALER_DenominationHashP *h_denom_pub,
struct TALER_Amount *total); struct TALER_Amount *total);
@ -2622,7 +2632,7 @@ typedef void
struct TALER_EXCHANGE_KycCheckHandle * struct TALER_EXCHANGE_KycCheckHandle *
TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *eh, TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *eh,
uint64_t payment_target, uint64_t payment_target,
const struct TALER_PaytoHash *h_payto, const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
TALER_EXCHANGE_KycStatusCallback cb, TALER_EXCHANGE_KycStatusCallback cb,
void *cb_cls); void *cb_cls);
@ -3010,7 +3020,7 @@ struct TALER_EXCHANGE_DenominationKeySignature
/** /**
* The hash of the denomination's public key * The hash of the denomination's public key
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Signature over this denomination key by the exchange's master signature. * Signature over this denomination key by the exchange's master signature.
@ -3187,7 +3197,7 @@ struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *
TALER_EXCHANGE_management_revoke_denomination_key ( TALER_EXCHANGE_management_revoke_denomination_key (
struct GNUNET_CURL_Context *ctx, struct GNUNET_CURL_Context *ctx,
const char *url, const char *url,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_MasterSignatureP *master_sig, const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb, TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb,
void *cb_cls); void *cb_cls);
@ -3559,7 +3569,7 @@ struct TALER_EXCHANGE_AuditorAddDenominationHandle *
TALER_EXCHANGE_add_auditor_denomination ( TALER_EXCHANGE_add_auditor_denomination (
struct GNUNET_CURL_Context *ctx, struct GNUNET_CURL_Context *ctx,
const char *url, const char *url,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const struct TALER_AuditorSignatureP *auditor_sig, const struct TALER_AuditorSignatureP *auditor_sig,
TALER_EXCHANGE_AuditorAddDenominationCallback cb, TALER_EXCHANGE_AuditorAddDenominationCallback cb,

View File

@ -109,7 +109,7 @@ struct TALER_KycCompletedEventP
/** /**
* Public key of the reserve the event is about. * Public key of the reserve the event is about.
*/ */
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
}; };
@ -200,7 +200,7 @@ struct TALER_EXCHANGEDB_TableData
struct struct
{ {
uint32_t denom_type; uint32_t denom_type;
uint32_t age_restrictions; uint32_t age_mask;
struct TALER_DenominationPublicKey denom_pub; struct TALER_DenominationPublicKey denom_pub;
struct TALER_MasterSignatureP master_sig; struct TALER_MasterSignatureP master_sig;
struct GNUNET_TIME_Timestamp valid_from; struct GNUNET_TIME_Timestamp valid_from;
@ -257,7 +257,7 @@ struct TALER_EXCHANGEDB_TableData
struct struct
{ {
struct TALER_BlindedCoinHash h_blind_ev; struct TALER_BlindedCoinHashP h_blind_ev;
uint64_t denominations_serial; uint64_t denominations_serial;
struct TALER_BlindedDenominationSignature denom_sig; struct TALER_BlindedDenominationSignature denom_sig;
uint64_t reserve_uuid; uint64_t reserve_uuid;
@ -301,6 +301,7 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_AgeCommitmentHash age_hash; struct TALER_AgeCommitmentHash age_hash;
uint64_t denominations_serial; uint64_t denominations_serial;
struct TALER_DenominationSignature denom_sig; struct TALER_DenominationSignature denom_sig;
struct TALER_Amount remaining;
} known_coins; } known_coins;
struct struct
@ -309,6 +310,7 @@ struct TALER_EXCHANGEDB_TableData
struct TALER_CoinSpendPublicKeyP old_coin_pub; struct TALER_CoinSpendPublicKeyP old_coin_pub;
struct TALER_CoinSpendSignatureP old_coin_sig; struct TALER_CoinSpendSignatureP old_coin_sig;
struct TALER_Amount amount_with_fee; struct TALER_Amount amount_with_fee;
struct TALER_AgeCommitmentHash h_age_commitment;
uint32_t noreveal_index; uint32_t noreveal_index;
} refresh_commitments; } refresh_commitments;
@ -342,7 +344,7 @@ struct TALER_EXCHANGEDB_TableData
struct GNUNET_TIME_Timestamp refund_deadline; struct GNUNET_TIME_Timestamp refund_deadline;
struct GNUNET_TIME_Timestamp wire_deadline; struct GNUNET_TIME_Timestamp wire_deadline;
struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_MerchantPublicKeyP merchant_pub;
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_WireSaltP wire_salt; struct TALER_WireSaltP wire_salt;
uint64_t wire_target_serial_id; uint64_t wire_target_serial_id;
@ -648,7 +650,7 @@ typedef void
(*TALER_EXCHANGEDB_DenominationsCallback)( (*TALER_EXCHANGEDB_DenominationsCallback)(
void *cls, void *cls,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta, const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta,
const struct TALER_MasterSignatureP *master_sig, const struct TALER_MasterSignatureP *master_sig,
bool recoup_possible); bool recoup_possible);
@ -700,7 +702,7 @@ typedef void
(*TALER_EXCHANGEDB_AuditorDenominationsCallback)( (*TALER_EXCHANGEDB_AuditorDenominationsCallback)(
void *cls, void *cls,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AuditorSignatureP *auditor_sig); const struct TALER_AuditorSignatureP *auditor_sig);
@ -720,7 +722,7 @@ struct TALER_EXCHANGEDB_CollectableBlindcoin
/** /**
* Hash of the denomination key (which coin was generated). * Hash of the denomination key (which coin was generated).
*/ */
struct TALER_DenominationHash denom_pub_hash; struct TALER_DenominationHashP denom_pub_hash;
/** /**
* Value of the coin being exchangeed (matching the denomination key) * Value of the coin being exchangeed (matching the denomination key)
@ -753,7 +755,7 @@ struct TALER_EXCHANGEDB_CollectableBlindcoin
* Hash over the blinded message, needed to verify * Hash over the blinded message, needed to verify
* the @e reserve_sig. * the @e reserve_sig.
*/ */
struct TALER_BlindedCoinHash h_coin_envelope; struct TALER_BlindedCoinHashP h_coin_envelope;
/** /**
* Signature confirming the withdrawal, matching @e reserve_pub, * Signature confirming the withdrawal, matching @e reserve_pub,
@ -844,7 +846,7 @@ struct TALER_EXCHANGEDB_RecoupListEntry
/** /**
* Hash of the public denomination key used to sign the coin. * Hash of the public denomination key used to sign the coin.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Public key of the reserve the coin was paid back into. * Public key of the reserve the coin was paid back into.
@ -1024,7 +1026,7 @@ struct TALER_EXCHANGEDB_Deposit
* Hash over the proposal data between merchant and customer * Hash over the proposal data between merchant and customer
* (remains unknown to the Exchange). * (remains unknown to the Exchange).
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
/** /**
* Salt used by the merchant to compute "h_wire". * Salt used by the merchant to compute "h_wire".
@ -1112,12 +1114,12 @@ struct TALER_EXCHANGEDB_DepositListEntry
* Hash over the proposa data between merchant and customer * Hash over the proposa data between merchant and customer
* (remains unknown to the Exchange). * (remains unknown to the Exchange).
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
/** /**
* Hash of the public denomination key used to sign the coin. * Hash of the public denomination key used to sign the coin.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Age commitment hash, if applicable ot the denomination. Should be all * Age commitment hash, if applicable ot the denomination. Should be all
@ -1125,6 +1127,11 @@ struct TALER_EXCHANGEDB_DepositListEntry
*/ */
struct TALER_AgeCommitmentHash h_age_commitment; struct TALER_AgeCommitmentHash h_age_commitment;
/**
* true, if age commitment is not applicable
*/
bool no_age_commitment;
/** /**
* Detailed information about the receiver for executing the transaction. * Detailed information about the receiver for executing the transaction.
* URL in payto://-format. * URL in payto://-format.
@ -1205,7 +1212,7 @@ struct TALER_EXCHANGEDB_RefundListEntry
* Hash over the proposal data between merchant and customer * Hash over the proposal data between merchant and customer
* (remains unknown to the Exchange). * (remains unknown to the Exchange).
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
/** /**
* Merchant-generated REFUND transaction ID to detect duplicate * Merchant-generated REFUND transaction ID to detect duplicate
@ -1268,13 +1275,6 @@ struct TALER_EXCHANGEDB_Refresh
*/ */
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
/**
* Hash of the age commitment used to sign the coin, if age restriction was
* applicable to the denomination. May be all zeroes if no age restriction
* applies.
*/
struct TALER_AgeCommitmentHash h_age_commitment;
/** /**
* Refresh commitment this coin is melted into. * Refresh commitment this coin is melted into.
*/ */
@ -1318,7 +1318,7 @@ struct TALER_EXCHANGEDB_MeltListEntry
/** /**
* Hash of the public denomination key used to sign the coin. * Hash of the public denomination key used to sign the coin.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Hash of the age commitment used to sign the coin, if age restriction was * Hash of the age commitment used to sign the coin, if age restriction was
@ -1327,6 +1327,11 @@ struct TALER_EXCHANGEDB_MeltListEntry
*/ */
struct TALER_AgeCommitmentHash h_age_commitment; struct TALER_AgeCommitmentHash h_age_commitment;
/**
* true, if no h_age_commitment is applicable
*/
bool no_age_commitment;
/** /**
* How much value is being melted? This amount includes the fees, * How much value is being melted? This amount includes the fees,
* so the final amount contributed to the melt is this value minus * so the final amount contributed to the melt is this value minus
@ -1549,7 +1554,7 @@ typedef enum GNUNET_DB_QueryStatus
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_PrivateContractHash *h_contract_terms); const struct TALER_PrivateContractHashP *h_contract_terms);
/** /**
@ -1576,7 +1581,7 @@ typedef enum GNUNET_DB_QueryStatus
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee, const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *deposit_fee, const struct TALER_Amount *deposit_fee,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
uint64_t wire_target, uint64_t wire_target,
const char *payto_uri); const char *payto_uri);
@ -1671,7 +1676,7 @@ struct TALER_EXCHANGEDB_RefreshRevealedCoin
/** /**
* Hash of the public denomination key of the coin. * Hash of the public denomination key of the coin.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Signature of the original coin being refreshed over the * Signature of the original coin being refreshed over the
@ -1682,7 +1687,7 @@ struct TALER_EXCHANGEDB_RefreshRevealedCoin
/** /**
* Hash of the blinded new coin, that is @e coin_ev. * Hash of the blinded new coin, that is @e coin_ev.
*/ */
struct TALER_BlindedCoinHash coin_envelope_hash; struct TALER_BlindedCoinHashP coin_envelope_hash;
/** /**
* Signature generated by the exchange over the coin (in blinded format). * Signature generated by the exchange over the coin (in blinded format).
@ -1712,7 +1717,7 @@ struct TALER_EXCHANGEDB_CsRevealFreshCoinData
/** /**
* Denomination of the fresh coin. * Denomination of the fresh coin.
*/ */
struct TALER_DenominationHash new_denom_pub_hash; struct TALER_DenominationHashP new_denom_pub_hash;
/** /**
* Blind signature of the fresh coin (possibly updated * Blind signature of the fresh coin (possibly updated
@ -1834,7 +1839,7 @@ typedef enum GNUNET_GenericReturnValue
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_MerchantSignatureP *merchant_sig, const struct TALER_MerchantSignatureP *merchant_sig,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
uint64_t rtransaction_id, uint64_t rtransaction_id,
const struct TALER_Amount *amount_with_fee); const struct TALER_Amount *amount_with_fee);
@ -1915,7 +1920,7 @@ typedef enum GNUNET_GenericReturnValue
(*TALER_EXCHANGEDB_WithdrawCallback)( (*TALER_EXCHANGEDB_WithdrawCallback)(
void *cls, void *cls,
uint64_t rowid, uint64_t rowid,
const struct TALER_BlindedCoinHash *h_blind_ev, const struct TALER_BlindedCoinHashP *h_blind_ev,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_ReserveSignatureP *reserve_sig, const struct TALER_ReserveSignatureP *reserve_sig,
@ -1946,6 +1951,7 @@ typedef void
* @param rowid which row in the table is the information from (for diagnostics) * @param rowid which row in the table is the information from (for diagnostics)
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls) * @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
* @param account_payto_uri which account did the transfer go to? * @param account_payto_uri which account did the transfer go to?
* @param h_payto hash over @a account_payto_uri as it is in the DB
* @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls) * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
* @param h_contract_terms which proposal was this payment about * @param h_contract_terms which proposal was this payment about
* @param denom_pub denomination of @a coin_pub * @param denom_pub denomination of @a coin_pub
@ -1959,8 +1965,9 @@ typedef void
uint64_t rowid, uint64_t rowid,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const char *account_payto_uri, const char *account_payto_uri,
const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Timestamp exec_time, struct GNUNET_TIME_Timestamp exec_time,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *coin_value, const struct TALER_Amount *coin_value,
@ -2059,7 +2066,7 @@ typedef enum GNUNET_GenericReturnValue
struct GNUNET_TIME_Timestamp timestamp, struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_CoinSpendPublicKeyP *old_coin_pub, const struct TALER_CoinSpendPublicKeyP *old_coin_pub,
const struct TALER_DenominationHash *old_denom_pub_hash, const struct TALER_DenominationHashP *old_denom_pub_hash,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
@ -2142,7 +2149,7 @@ typedef void
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
const struct TALER_CoinSpendSignatureP *coin_sig, const struct TALER_CoinSpendSignatureP *coin_sig,
const union TALER_DenominationBlindingKeyP *coin_blind, const union TALER_DenominationBlindingKeyP *coin_blind,
const struct TALER_BlindedCoinHash *h_blinded_ev, const struct TALER_BlindedCoinHashP *h_blinded_ev,
const struct TALER_Amount *amount); const struct TALER_Amount *amount);
@ -2357,7 +2364,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*get_denomination_info)( (*get_denomination_info)(
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue); struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue);
@ -2483,7 +2490,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*select_kyc_status)(void *cls, (*select_kyc_status)(void *cls,
uint64_t payment_target_uuid, uint64_t payment_target_uuid,
struct TALER_PaytoHash *h_payto, struct TALER_PaytoHashP *h_payto,
struct TALER_EXCHANGEDB_KycStatus *kyc); struct TALER_EXCHANGEDB_KycStatus *kyc);
@ -2537,7 +2544,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*lock_nonce)(void *cls, (*lock_nonce)(void *cls,
const struct TALER_CsNonce *nonce, const struct TALER_CsNonce *nonce,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
const union TALER_EXCHANGEDB_NonceLockTargetP *target); const union TALER_EXCHANGEDB_NonceLockTargetP *target);
@ -2554,7 +2561,7 @@ struct TALER_EXCHANGEDB_Plugin
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*get_withdraw_info)(void *cls, (*get_withdraw_info)(void *cls,
const struct TALER_BlindedCoinHash *bch, const struct TALER_BlindedCoinHashP *bch,
struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable); struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable);
@ -2623,7 +2630,7 @@ struct TALER_EXCHANGEDB_Plugin
void *cls, void *cls,
const struct TALER_EXCHANGEDB_Deposit *deposit, const struct TALER_EXCHANGEDB_Deposit *deposit,
uint64_t known_coin_id, uint64_t known_coin_id,
const struct TALER_PaytoHash *h_payto, const struct TALER_PaytoHashP *h_payto,
bool extension_blocked, bool extension_blocked,
struct GNUNET_TIME_Timestamp *exchange_timestamp, struct GNUNET_TIME_Timestamp *exchange_timestamp,
bool *balance_ok, bool *balance_ok,
@ -2798,7 +2805,7 @@ struct TALER_EXCHANGEDB_Plugin
*/ */
long long long long
(*count_known_coins) (void *cls, (*count_known_coins) (void *cls,
const struct TALER_DenominationHash *denom_pub_hash); const struct TALER_DenominationHashP *denom_pub_hash);
/** /**
@ -2846,7 +2853,7 @@ struct TALER_EXCHANGEDB_Plugin
(*ensure_coin_known)(void *cls, (*ensure_coin_known)(void *cls,
const struct TALER_CoinPublicInfo *coin, const struct TALER_CoinPublicInfo *coin,
uint64_t *known_coin_id, uint64_t *known_coin_id,
struct TALER_DenominationHash *denom_pub_hash, struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_AgeCommitmentHash *age_hash); struct TALER_AgeCommitmentHash *age_hash);
@ -2876,7 +2883,7 @@ struct TALER_EXCHANGEDB_Plugin
(*get_coin_denomination)(void *cls, (*get_coin_denomination)(void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t *known_coin_id, uint64_t *known_coin_id,
struct TALER_DenominationHash *denom_hash); struct TALER_DenominationHashP *denom_hash);
/** /**
@ -2898,8 +2905,8 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*have_deposit2)( (*have_deposit2)(
void *cls, void *cls,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant, const struct TALER_MerchantPublicKeyP *merchant,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,
@ -2950,7 +2957,7 @@ struct TALER_EXCHANGEDB_Plugin
(*select_refunds_by_coin)(void *cls, (*select_refunds_by_coin)(void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_PrivateContractHash *h_contract, const struct TALER_PrivateContractHashP *h_contract,
TALER_EXCHANGEDB_RefundCoinCallback cb, TALER_EXCHANGEDB_RefundCoinCallback cb,
void *cb_cls); void *cb_cls);
@ -3189,8 +3196,8 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*lookup_transfer_by_deposit)( (*lookup_transfer_by_deposit)(
void *cls, void *cls,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
bool *pending, bool *pending,
@ -3614,7 +3621,7 @@ struct TALER_EXCHANGEDB_Plugin
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*get_reserve_by_h_blind)(void *cls, (*get_reserve_by_h_blind)(void *cls,
const struct TALER_BlindedCoinHash *bch, const struct TALER_BlindedCoinHashP *bch,
struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_ReservePublicKeyP *reserve_pub,
uint64_t *reserve_out_serial_id); uint64_t *reserve_out_serial_id);
@ -3631,7 +3638,7 @@ struct TALER_EXCHANGEDB_Plugin
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*get_old_coin_by_h_blind)(void *cls, (*get_old_coin_by_h_blind)(void *cls,
const struct TALER_BlindedCoinHash *h_blind_ev, const struct TALER_BlindedCoinHashP *h_blind_ev,
struct TALER_CoinSpendPublicKeyP *old_coin_pub, struct TALER_CoinSpendPublicKeyP *old_coin_pub,
uint64_t *rrc_serial); uint64_t *rrc_serial);
@ -3648,7 +3655,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*insert_denomination_revocation)( (*insert_denomination_revocation)(
void *cls, void *cls,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
const struct TALER_MasterSignatureP *master_sig); const struct TALER_MasterSignatureP *master_sig);
@ -3663,11 +3670,11 @@ struct TALER_EXCHANGEDB_Plugin
* @return transaction status code * @return transaction status code
*/ */
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*get_denomination_revocation)(void *cls, (*get_denomination_revocation)(
const struct void *cls,
TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct TALER_MasterSignatureP *master_sig, struct TALER_MasterSignatureP *master_sig,
uint64_t *rowid); uint64_t *rowid);
/** /**
@ -3882,7 +3889,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*lookup_denomination_key)( (*lookup_denomination_key)(
void *cls, void *cls,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta); struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta);
@ -3899,7 +3906,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*add_denomination_key)( (*add_denomination_key)(
void *cls, void *cls,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta, const struct TALER_EXCHANGEDB_DenominationKeyMetaData *meta,
const struct TALER_MasterSignatureP *master_sig); const struct TALER_MasterSignatureP *master_sig);
@ -3950,7 +3957,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*insert_auditor_denom_sig)( (*insert_auditor_denom_sig)(
void *cls, void *cls,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const struct TALER_AuditorSignatureP *auditor_sig); const struct TALER_AuditorSignatureP *auditor_sig);
@ -3967,7 +3974,7 @@ struct TALER_EXCHANGEDB_Plugin
enum GNUNET_DB_QueryStatus enum GNUNET_DB_QueryStatus
(*select_auditor_denom_sig)( (*select_auditor_denom_sig)(
void *cls, void *cls,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
struct TALER_AuditorSignatureP *auditor_sig); struct TALER_AuditorSignatureP *auditor_sig);

View File

@ -400,7 +400,7 @@ TALER_JSON_spec_i18n_str (const char *name,
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_JSON_contract_hash (const json_t *json, TALER_JSON_contract_hash (const json_t *json,
struct TALER_PrivateContractHash *hc); struct TALER_PrivateContractHashP *hc);
/** /**
@ -522,7 +522,7 @@ TALER_JSON_get_error_code2 (const void *data,
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s, TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s,
struct TALER_MerchantWireHash *hc); struct TALER_MerchantWireHashP *hc);
/** /**
@ -623,7 +623,7 @@ TALER_JSON_wire_to_payto (const json_t *wire_s);
*/ */
void void
TALER_deposit_extension_hash (const json_t *extensions, TALER_deposit_extension_hash (const json_t *extensions,
struct TALER_ExtensionContractHash *ech); struct TALER_ExtensionContractHashP *ech);
/** /**
* Hash the @a config of an extension, given as JSON * Hash the @a config of an extension, given as JSON
@ -634,7 +634,7 @@ TALER_deposit_extension_hash (const json_t *extensions,
*/ */
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_JSON_extensions_config_hash (const json_t *config, TALER_JSON_extensions_config_hash (const json_t *config,
struct TALER_ExtensionConfigHash *eh); struct TALER_ExtensionConfigHashP *eh);
/** /**
* Canonicalize a JSON input to a string according to RFC 8785. * Canonicalize a JSON input to a string according to RFC 8785.

View File

@ -271,6 +271,12 @@
*/ */
#define TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH 1206 #define TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH 1206
/**
* Signature using a age restriction key for attestation of a particular
* age/age-group.
*/
#define TALER_SIGNATURE_WALLET_AGE_ATTESTATION 1207
/******************************/ /******************************/
/* Security module signatures */ /* Security module signatures */
@ -345,7 +351,7 @@ struct TALER_DenominationKeyAnnouncementPS
/** /**
* Hash of the denomination public key. * Hash of the denomination public key.
*/ */
struct TALER_DenominationHash h_denom; struct TALER_DenominationHashP h_denom;
/** /**
* Hash of the section name in the configuration of this denomination. * Hash of the section name in the configuration of this denomination.
@ -412,7 +418,7 @@ struct TALER_LinkDataPS
/** /**
* Hash of the denomination public key of the new coin. * Hash of the denomination public key of the new coin.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Transfer public key (for which the private key was not revealed) * Transfer public key (for which the private key was not revealed)
@ -427,7 +433,7 @@ struct TALER_LinkDataPS
/** /**
* Hash of the blinded new coin. * Hash of the blinded new coin.
*/ */
struct TALER_BlindedCoinHash coin_envelope_hash; struct TALER_BlindedCoinHashP coin_envelope_hash;
}; };
@ -456,12 +462,12 @@ struct TALER_WithdrawRequestPS
/** /**
* Hash of the denomination public key for the coin that is withdrawn. * Hash of the denomination public key for the coin that is withdrawn.
*/ */
struct TALER_DenominationHash h_denomination_pub GNUNET_PACKED; struct TALER_DenominationHashP h_denomination_pub GNUNET_PACKED;
/** /**
* Hash of the (blinded) message to be signed by the Exchange. * Hash of the (blinded) message to be signed by the Exchange.
*/ */
struct TALER_BlindedCoinHash h_coin_envelope GNUNET_PACKED; struct TALER_BlindedCoinHashP h_coin_envelope GNUNET_PACKED;
}; };
@ -480,7 +486,7 @@ struct TALER_DepositRequestPS
/** /**
* Hash over the contract for which this deposit is made. * Hash over the contract for which this deposit is made.
*/ */
struct TALER_PrivateContractHash h_contract_terms GNUNET_PACKED; struct TALER_PrivateContractHashP h_contract_terms GNUNET_PACKED;
/** /**
* Hash over the age commitment that went into the coin. Maybe all zero, if * Hash over the age commitment that went into the coin. Maybe all zero, if
@ -491,17 +497,17 @@ struct TALER_DepositRequestPS
/** /**
* Hash over extension attributes shared with the exchange. * Hash over extension attributes shared with the exchange.
*/ */
struct TALER_ExtensionContractHash h_extensions GNUNET_PACKED; struct TALER_ExtensionContractHashP h_extensions GNUNET_PACKED;
/** /**
* Hash over the wiring information of the merchant. * Hash over the wiring information of the merchant.
*/ */
struct TALER_MerchantWireHash h_wire GNUNET_PACKED; struct TALER_MerchantWireHashP h_wire GNUNET_PACKED;
/** /**
* Hash over the denomination public key used to sign the coin. * Hash over the denomination public key used to sign the coin.
*/ */
struct TALER_DenominationHash h_denom_pub GNUNET_PACKED; struct TALER_DenominationHashP h_denom_pub GNUNET_PACKED;
/** /**
* Time when this request was generated. Used, for example, to * Time when this request was generated. Used, for example, to
@ -567,18 +573,18 @@ struct TALER_DepositConfirmationPS
/** /**
* Hash over the contract for which this deposit is made. * Hash over the contract for which this deposit is made.
*/ */
struct TALER_PrivateContractHash h_contract_terms GNUNET_PACKED; struct TALER_PrivateContractHashP h_contract_terms GNUNET_PACKED;
/** /**
* Hash over the wiring information of the merchant. * Hash over the wiring information of the merchant.
*/ */
struct TALER_MerchantWireHash h_wire GNUNET_PACKED; struct TALER_MerchantWireHashP h_wire GNUNET_PACKED;
/** /**
* Hash over the extension options of the deposit, 0 if there * Hash over the extension options of the deposit, 0 if there
* were not extension options. * were not extension options.
*/ */
struct TALER_ExtensionContractHash h_extensions GNUNET_PACKED; struct TALER_ExtensionContractHashP h_extensions GNUNET_PACKED;
/** /**
* Time when this confirmation was generated / when the exchange received * Time when this confirmation was generated / when the exchange received
@ -636,7 +642,7 @@ struct TALER_RefundRequestPS
* Hash over the proposal data to identify the contract * Hash over the proposal data to identify the contract
* which is being refunded. * which is being refunded.
*/ */
struct TALER_PrivateContractHash h_contract_terms GNUNET_PACKED; struct TALER_PrivateContractHashP h_contract_terms GNUNET_PACKED;
/** /**
* The coin's public key. This is the value that must have been * The coin's public key. This is the value that must have been
@ -672,7 +678,7 @@ struct TALER_RefundConfirmationPS
* Hash over the proposal data to identify the contract * Hash over the proposal data to identify the contract
* which is being refunded. * which is being refunded.
*/ */
struct TALER_PrivateContractHash h_contract_terms GNUNET_PACKED; struct TALER_PrivateContractHashP h_contract_terms GNUNET_PACKED;
/** /**
* The coin's public key. This is the value that must have been * The coin's public key. This is the value that must have been
@ -719,7 +725,7 @@ struct TALER_RefreshMeltCoinAffirmationPS
/** /**
* Hash over the denomination public key used to sign the coin. * Hash over the denomination public key used to sign the coin.
*/ */
struct TALER_DenominationHash h_denom_pub GNUNET_PACKED; struct TALER_DenominationHashP h_denom_pub GNUNET_PACKED;
/** /**
* If age commitment was provided during the withdrawal of the coin, this is * If age commitment was provided during the withdrawal of the coin, this is
@ -866,7 +872,7 @@ struct TALER_ExchangeAccountSetupSuccessPS
* Hash over the payto for which the signature was * Hash over the payto for which the signature was
* made. * made.
*/ */
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
/** /**
* When was the signature made. * When was the signature made.
@ -952,7 +958,7 @@ struct TALER_MasterAddWirePS
/** /**
* Hash over the exchange's payto URI. * Hash over the exchange's payto URI.
*/ */
struct TALER_PaytoHash h_payto GNUNET_PACKED; struct TALER_PaytoHashP h_payto GNUNET_PACKED;
}; };
@ -977,7 +983,7 @@ struct TALER_MasterDelWirePS
/** /**
* Hash over the exchange's payto URI. * Hash over the exchange's payto URI.
*/ */
struct TALER_PaytoHash h_payto GNUNET_PACKED; struct TALER_PaytoHashP h_payto GNUNET_PACKED;
}; };
@ -997,7 +1003,7 @@ struct TALER_MasterExtensionConfigurationPS
/** /**
* Hash of the JSON object that represents the configuration of an extension. * Hash of the JSON object that represents the configuration of an extension.
*/ */
struct TALER_ExtensionConfigHash h_config GNUNET_PACKED; struct TALER_ExtensionConfigHashP h_config GNUNET_PACKED;
}; };
@ -1073,7 +1079,7 @@ struct TALER_DenominationKeyValidityPS
* Hash code of the denomination public key. (Used to avoid having * Hash code of the denomination public key. (Used to avoid having
* the variable-size RSA key in this struct.) * the variable-size RSA key in this struct.)
*/ */
struct TALER_DenominationHash denom_hash GNUNET_PACKED; struct TALER_DenominationHashP denom_hash GNUNET_PACKED;
}; };
@ -1156,7 +1162,7 @@ struct TALER_ExchangeKeyValidityPS
* Hash code of the denomination public key. (Used to avoid having * Hash code of the denomination public key. (Used to avoid having
* the variable-size RSA key in this struct.) * the variable-size RSA key in this struct.)
*/ */
struct TALER_DenominationHash denom_hash GNUNET_PACKED; struct TALER_DenominationHashP denom_hash GNUNET_PACKED;
}; };
@ -1176,7 +1182,7 @@ struct TALER_MasterWireDetailsPS
/** /**
* Hash over the account holder's payto:// URL. * Hash over the account holder's payto:// URL.
*/ */
struct TALER_PaytoHash h_wire_details GNUNET_PACKED; struct TALER_PaytoHashP h_wire_details GNUNET_PACKED;
}; };
@ -1197,7 +1203,7 @@ struct TALER_MerchantWireDetailsPS
* Salted hash over the account holder's payto:// URL and * Salted hash over the account holder's payto:// URL and
* the salt, as done by #TALER_merchant_wire_signature_hash(). * the salt, as done by #TALER_merchant_wire_signature_hash().
*/ */
struct TALER_MerchantWireHash h_wire_details GNUNET_PACKED; struct TALER_MerchantWireHashP h_wire_details GNUNET_PACKED;
}; };
@ -1257,7 +1263,7 @@ struct TALER_MasterDenominationKeyRevocationPS
/** /**
* Hash of the denomination key. * Hash of the denomination key.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
}; };
@ -1294,12 +1300,12 @@ struct TALER_DepositTrackPS
/** /**
* Hash over the proposal data of the contract for which this deposit is made. * Hash over the proposal data of the contract for which this deposit is made.
*/ */
struct TALER_PrivateContractHash h_contract_terms GNUNET_PACKED; struct TALER_PrivateContractHashP h_contract_terms GNUNET_PACKED;
/** /**
* Hash over the wiring information of the merchant. * Hash over the wiring information of the merchant.
*/ */
struct TALER_MerchantWireHash h_wire GNUNET_PACKED; struct TALER_MerchantWireHashP h_wire GNUNET_PACKED;
/** /**
* The Merchant's public key. The deposit inquiry request is to be * The Merchant's public key. The deposit inquiry request is to be
@ -1326,7 +1332,7 @@ struct TALER_WireDepositDetailP
/** /**
* Hash of the contract * Hash of the contract
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
/** /**
* Time when the wire transfer was performed by the exchange. * Time when the wire transfer was performed by the exchange.
@ -1381,7 +1387,7 @@ struct TALER_WireDepositDataPS
/** /**
* Hash of bank account of the merchant. * Hash of bank account of the merchant.
*/ */
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
/** /**
* Hash of the individual deposits that were aggregated, * Hash of the individual deposits that were aggregated,
@ -1406,7 +1412,7 @@ struct TALER_ProposalDataPS
* Hash of the JSON contract in UTF-8 including 0-termination, * Hash of the JSON contract in UTF-8 including 0-termination,
* using JSON_COMPACT | JSON_SORT_KEYS * using JSON_COMPACT | JSON_SORT_KEYS
*/ */
struct TALER_PrivateContractHash hash; struct TALER_PrivateContractHashP hash;
}; };
/** /**
@ -1424,7 +1430,7 @@ struct TALER_PaymentResponsePS
/** /**
* Hash of the proposal data associated with this confirmation * Hash of the proposal data associated with this confirmation
*/ */
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
}; };
@ -1443,12 +1449,12 @@ struct TALER_ConfirmWirePS
/** /**
* Hash over the wiring information of the merchant. * Hash over the wiring information of the merchant.
*/ */
struct TALER_MerchantWireHash h_wire GNUNET_PACKED; struct TALER_MerchantWireHashP h_wire GNUNET_PACKED;
/** /**
* Hash over the contract for which this deposit is made. * Hash over the contract for which this deposit is made.
*/ */
struct TALER_PrivateContractHash h_contract_terms GNUNET_PACKED; struct TALER_PrivateContractHashP h_contract_terms GNUNET_PACKED;
/** /**
* Raw value (binary encoding) of the wire transfer subject. * Raw value (binary encoding) of the wire transfer subject.
@ -1493,7 +1499,7 @@ struct TALER_RecoupRequestPS
/** /**
* Hash of the (revoked) denomination public key of the coin. * Hash of the (revoked) denomination public key of the coin.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/** /**
* Blinding factor that was used to withdraw the coin. * Blinding factor that was used to withdraw the coin.
@ -1600,7 +1606,7 @@ struct TALER_DenominationUnknownAffirmationPS
/** /**
* Hash of the public denomination key we do not know. * Hash of the public denomination key we do not know.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
}; };
@ -1630,7 +1636,7 @@ struct TALER_DenominationExpiredAffirmationPS
/** /**
* Hash of the public denomination key we do not know. * Hash of the public denomination key we do not know.
*/ */
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
}; };
@ -1670,7 +1676,7 @@ struct TALER_ReserveCloseConfirmationPS
/** /**
* Hash of the receiver's bank account. * Hash of the receiver's bank account.
*/ */
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
/** /**
* Wire transfer subject. * Wire transfer subject.
@ -1704,6 +1710,27 @@ struct TALER_MerchantPaySessionSigPS
}; };
/**
* Used for attestation of a particular age
*/
struct TALER_AgeAttestationPS
{
/**
* Purpose must be #TALER_SIGNATURE_WALLET_AGE_ATTESTATION.
*/
struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
/**
* Age mask that defines the underlying age groups
*/
struct TALER_AgeMask mask;
/**
* The particular age that this attestation is for
*/
uint8_t age;
};
GNUNET_NETWORK_STRUCT_END GNUNET_NETWORK_STRUCT_END

View File

@ -2483,8 +2483,9 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
#define TALER_TESTING_INDEXED_TRAITS(op) \ #define TALER_TESTING_INDEXED_TRAITS(op) \
op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \ op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \
op (denom_sig, const struct TALER_DenominationSignature) \ op (denom_sig, const struct TALER_DenominationSignature) \
op (age_commitment, struct TALER_AgeCommitment) \ op (age_commitment, const struct TALER_AgeCommitment) \
op (h_age_commitment, struct TALER_AgeCommitmentHash) \ op (age_commitment_proof, const struct TALER_AgeCommitmentProof) \
op (h_age_commitment, const struct TALER_AgeCommitmentHash) \
op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) \ op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) \
op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \ op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \
op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \ op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \

View File

@ -125,7 +125,7 @@ TALER_b2s (const void *buf,
* @param obj address of object to convert * @param obj address of object to convert
* @return string representing the binary obj buffer * @return string representing the binary obj buffer
*/ */
#define TALER_B2S(obj) TALER_b2s (obj, sizeof (*obj)) #define TALER_B2S(obj) TALER_b2s ((obj), sizeof (*(obj)))
/** /**

View File

@ -490,7 +490,7 @@ forget (const json_t *in,
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_JSON_contract_hash (const json_t *json, TALER_JSON_contract_hash (const json_t *json,
struct TALER_PrivateContractHash *hc) struct TALER_PrivateContractHashP *hc)
{ {
enum GNUNET_GenericReturnValue ret; enum GNUNET_GenericReturnValue ret;
json_t *cjson; json_t *cjson;
@ -1009,7 +1009,7 @@ TALER_JSON_get_error_code2 (const void *data,
void void
TALER_deposit_extension_hash (const json_t *extensions, TALER_deposit_extension_hash (const json_t *extensions,
struct TALER_ExtensionContractHash *ech) struct TALER_ExtensionContractHashP *ech)
{ {
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
dump_and_hash (extensions, dump_and_hash (extensions,
@ -1038,7 +1038,7 @@ TALER_JSON_canonicalize (const json_t *input)
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_JSON_extensions_config_hash (const json_t *config, TALER_JSON_extensions_config_hash (const json_t *config,
struct TALER_ExtensionConfigHash *ech) struct TALER_ExtensionConfigHashP *ech)
{ {
return dump_and_hash (config, return dump_and_hash (config,
"taler-extension-configuration", "taler-extension-configuration",

View File

@ -253,7 +253,7 @@ parse_denom_pub (void *cls,
GNUNET_JSON_spec_string ("cipher", GNUNET_JSON_spec_string ("cipher",
&cipher), &cipher),
GNUNET_JSON_spec_uint32 ("age_mask", GNUNET_JSON_spec_uint32 ("age_mask",
&denom_pub->age_mask.mask), &denom_pub->age_mask.bits),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
const char *emsg; const char *emsg;

View File

@ -64,7 +64,7 @@ TALER_JSON_pack_denom_pub (
GNUNET_JSON_pack_string ("cipher", GNUNET_JSON_pack_string ("cipher",
"RSA"), "RSA"),
GNUNET_JSON_pack_uint64 ("age_mask", GNUNET_JSON_pack_uint64 ("age_mask",
pk->age_mask.mask), pk->age_mask.bits),
GNUNET_JSON_pack_rsa_public_key ("rsa_public_key", GNUNET_JSON_pack_rsa_public_key ("rsa_public_key",
pk->details.rsa_public_key)); pk->details.rsa_public_key));
break; break;
@ -74,7 +74,7 @@ TALER_JSON_pack_denom_pub (
GNUNET_JSON_pack_string ("cipher", GNUNET_JSON_pack_string ("cipher",
"CS"), "CS"),
GNUNET_JSON_pack_uint64 ("age_mask", GNUNET_JSON_pack_uint64 ("age_mask",
pk->age_mask.mask), pk->age_mask.bits),
GNUNET_JSON_pack_data_varsize ("cs_public_key", GNUNET_JSON_pack_data_varsize ("cs_public_key",
&pk->details.cs_public_key, &pk->details.cs_public_key,
sizeof (pk->details.cs_public_key))); sizeof (pk->details.cs_public_key)));

View File

@ -26,7 +26,7 @@
enum GNUNET_GenericReturnValue enum GNUNET_GenericReturnValue
TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s, TALER_JSON_merchant_wire_signature_hash (const json_t *wire_s,
struct TALER_MerchantWireHash *hc) struct TALER_MerchantWireHashP *hc)
{ {
const char *payto_uri; const char *payto_uri;
struct TALER_WireSaltP salt; struct TALER_WireSaltP salt;

View File

@ -91,8 +91,8 @@ path_cb (void *cls,
static int static int
test_contract (void) test_contract (void)
{ {
struct TALER_PrivateContractHash h1; struct TALER_PrivateContractHashP h1;
struct TALER_PrivateContractHash h2; struct TALER_PrivateContractHashP h2;
json_t *c1; json_t *c1;
json_t *c2; json_t *c2;
json_t *c3; json_t *c3;
@ -384,7 +384,7 @@ test_json_canon (void)
static int static int
test_rfc8785 (void) test_rfc8785 (void)
{ {
struct TALER_PrivateContractHash h1; struct TALER_PrivateContractHashP h1;
json_t *c1; json_t *c1;
c1 = json_pack ("{s:s}", c1 = json_pack ("{s:s}",

View File

@ -170,9 +170,9 @@ handle_deposit_confirmation_finished (void *cls,
* @return #GNUNET_OK if signatures are OK, #GNUNET_SYSERR if not * @return #GNUNET_OK if signatures are OK, #GNUNET_SYSERR if not
*/ */
static enum GNUNET_GenericReturnValue static enum GNUNET_GenericReturnValue
verify_signatures (const struct TALER_MerchantWireHash *h_wire, verify_signatures (const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp exchange_timestamp, struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline, struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,
@ -236,9 +236,9 @@ verify_signatures (const struct TALER_MerchantWireHash *h_wire,
struct TALER_AUDITOR_DepositConfirmationHandle * struct TALER_AUDITOR_DepositConfirmationHandle *
TALER_AUDITOR_deposit_confirmation ( TALER_AUDITOR_deposit_confirmation (
struct TALER_AUDITOR_Handle *auditor, struct TALER_AUDITOR_Handle *auditor,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_ExtensionContractHash *h_extensions, const struct TALER_ExtensionContractHashP *h_extensions,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
struct GNUNET_TIME_Timestamp exchange_timestamp, struct GNUNET_TIME_Timestamp exchange_timestamp,
struct GNUNET_TIME_Timestamp wire_deadline, struct GNUNET_TIME_Timestamp wire_deadline,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,

View File

@ -142,7 +142,7 @@ struct TALER_EXCHANGE_AuditorAddDenominationHandle *
TALER_EXCHANGE_add_auditor_denomination ( TALER_EXCHANGE_add_auditor_denomination (
struct GNUNET_CURL_Context *ctx, struct GNUNET_CURL_Context *ctx,
const char *url, const char *url,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_AuditorPublicKeyP *auditor_pub, const struct TALER_AuditorPublicKeyP *auditor_pub,
const struct TALER_AuditorSignatureP *auditor_sig, const struct TALER_AuditorSignatureP *auditor_sig,
TALER_EXCHANGE_AuditorAddDenominationCallback cb, TALER_EXCHANGE_AuditorAddDenominationCallback cb,

View File

@ -124,8 +124,8 @@ TALER_EXCHANGE_parse_reserve_history (
"WITHDRAW")) "WITHDRAW"))
{ {
struct TALER_ReserveSignatureP sig; struct TALER_ReserveSignatureP sig;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct TALER_BlindedCoinHash bch; struct TALER_BlindedCoinHashP bch;
struct TALER_Amount withdraw_fee; struct TALER_Amount withdraw_fee;
struct GNUNET_JSON_Specification withdraw_spec[] = { struct GNUNET_JSON_Specification withdraw_spec[] = {
GNUNET_JSON_spec_fixed_auto ("reserve_sig", GNUNET_JSON_spec_fixed_auto ("reserve_sig",
@ -411,7 +411,7 @@ TALER_EXCHANGE_verify_coin_history (
const char *currency, const char *currency,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
json_t *history, json_t *history,
struct TALER_DenominationHash *h_denom_pub, struct TALER_DenominationHashP *h_denom_pub,
struct TALER_Amount *total) struct TALER_Amount *total)
{ {
size_t len; size_t len;
@ -470,14 +470,14 @@ TALER_EXCHANGE_verify_coin_history (
if (0 == strcasecmp (type, if (0 == strcasecmp (type,
"DEPOSIT")) "DEPOSIT"))
{ {
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
// struct TALER_ExtensionContractHash h_extensions; // FIXME! // struct TALER_ExtensionContractHashP h_extensions; // FIXME!
struct GNUNET_TIME_Timestamp wallet_timestamp; struct GNUNET_TIME_Timestamp wallet_timestamp;
struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Timestamp refund_deadline = {0}; struct GNUNET_TIME_Timestamp refund_deadline = {0};
struct TALER_CoinSpendSignatureP sig; struct TALER_CoinSpendSignatureP sig;
struct TALER_AgeCommitmentHash *hac = NULL; struct TALER_AgeCommitmentHash hac = {0};
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig", GNUNET_JSON_spec_fixed_auto ("coin_sig",
&sig), &sig),
@ -487,6 +487,9 @@ TALER_EXCHANGE_verify_coin_history (
&h_wire), &h_wire),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub", GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
h_denom_pub), h_denom_pub),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
&hac)),
GNUNET_JSON_spec_timestamp ("timestamp", GNUNET_JSON_spec_timestamp ("timestamp",
&wallet_timestamp), &wallet_timestamp),
GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_mark_optional (
@ -508,18 +511,19 @@ TALER_EXCHANGE_verify_coin_history (
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_wallet_deposit_verify (&amount, TALER_wallet_deposit_verify (
&fee, &amount,
&h_wire, &fee,
&h_contract_terms, &h_wire,
hac, &h_contract_terms,
NULL /* h_extensions! */, TALER_AgeCommitmentHash_isNullOrZero (&hac) ? NULL : &hac,
h_denom_pub, NULL /* h_extensions! */,
wallet_timestamp, h_denom_pub,
&merchant_pub, wallet_timestamp,
refund_deadline, &merchant_pub,
coin_pub, refund_deadline,
&sig)) coin_pub,
&sig))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
@ -585,31 +589,27 @@ TALER_EXCHANGE_verify_coin_history (
} }
} }
if (GNUNET_OK !=
TALER_wallet_melt_verify (
&amount,
&fee,
&rc,
h_denom_pub,
TALER_AgeCommitmentHash_isNullOrZero (&h_age_commitment) ?
NULL : &h_age_commitment,
coin_pub,
&sig))
{ {
const struct TALER_AgeCommitmentHash *ahc = &h_age_commitment; GNUNET_break_op (0);
return GNUNET_SYSERR;
if (TALER_AgeCommitmentHash_isNullOrZero (ahc))
ahc = NULL;
if (GNUNET_OK !=
TALER_wallet_melt_verify (&amount,
&fee,
&rc,
h_denom_pub,
ahc,
coin_pub,
&sig))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
} }
add = GNUNET_YES; add = GNUNET_YES;
} }
else if (0 == strcasecmp (type, else if (0 == strcasecmp (type,
"REFUND")) "REFUND"))
{ {
struct TALER_PrivateContractHash h_contract_terms; struct TALER_PrivateContractHashP h_contract_terms;
struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_MerchantPublicKeyP merchant_pub;
struct TALER_MerchantSignatureP sig; struct TALER_MerchantSignatureP sig;
struct TALER_Amount refund_fee; struct TALER_Amount refund_fee;

View File

@ -240,7 +240,7 @@ TALER_EXCHANGE_csr_withdraw (struct TALER_EXCHANGE_Handle *exchange,
sizeof(struct TALER_CsNonce)), sizeof(struct TALER_CsNonce)),
GNUNET_JSON_pack_data_varsize ("denom_pub_hash", GNUNET_JSON_pack_data_varsize ("denom_pub_hash",
&pk->h_key, &pk->h_key,
sizeof(struct TALER_DenominationHash))); sizeof(struct TALER_DenominationHashP)));
GNUNET_assert (NULL != req); GNUNET_assert (NULL != req);
ctx = TEAH_handle_to_context (exchange); ctx = TEAH_handle_to_context (exchange);
eh = TALER_EXCHANGE_curl_easy_get_ (csrh->url); eh = TALER_EXCHANGE_curl_easy_get_ (csrh->url);

View File

@ -83,18 +83,18 @@ struct TALER_EXCHANGE_DepositHandle
/** /**
* Hash over the contract for which this deposit is made. * Hash over the contract for which this deposit is made.
*/ */
struct TALER_PrivateContractHash h_contract_terms GNUNET_PACKED; struct TALER_PrivateContractHashP h_contract_terms GNUNET_PACKED;
/** /**
* Hash over the wiring information of the merchant. * Hash over the wiring information of the merchant.
*/ */
struct TALER_MerchantWireHash h_wire GNUNET_PACKED; struct TALER_MerchantWireHashP h_wire GNUNET_PACKED;
/** /**
* Hash over the extension options of the deposit, 0 if there * Hash over the extension options of the deposit, 0 if there
* were not extension options. * were not extension options.
*/ */
struct TALER_ExtensionContractHash h_extensions GNUNET_PACKED; struct TALER_ExtensionContractHashP h_extensions GNUNET_PACKED;
/** /**
* Time when this confirmation was generated / when the exchange received * Time when this confirmation was generated / when the exchange received
@ -242,7 +242,7 @@ verify_deposit_signature_conflict (
json_t *history; json_t *history;
struct TALER_Amount total; struct TALER_Amount total;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
memset (&h_denom_pub, memset (&h_denom_pub,
0, 0,
@ -476,14 +476,14 @@ handle_deposit_finished (void *cls,
static enum GNUNET_GenericReturnValue static enum GNUNET_GenericReturnValue
verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki, verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
const struct TALER_Amount *amount, const struct TALER_Amount *amount,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_ExtensionContractHash *ech, const struct TALER_ExtensionContractHashP *ech,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_AgeCommitmentHash *h_age_commitment, const struct TALER_AgeCommitmentHash *h_age_commitment,
const struct TALER_DenominationSignature *denom_sig, const struct TALER_DenominationSignature *denom_sig,
const struct TALER_DenominationPublicKey *denom_pub, const struct TALER_DenominationPublicKey *denom_pub,
const struct TALER_DenominationHash *denom_pub_hash, const struct TALER_DenominationHashP *denom_pub_hash,
struct GNUNET_TIME_Timestamp timestamp, struct GNUNET_TIME_Timestamp timestamp,
const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantPublicKeyP *merchant_pub,
struct GNUNET_TIME_Timestamp refund_deadline, struct GNUNET_TIME_Timestamp refund_deadline,
@ -554,7 +554,7 @@ TALER_EXCHANGE_deposit (
struct GNUNET_TIME_Timestamp wire_deadline, struct GNUNET_TIME_Timestamp wire_deadline,
const char *merchant_payto_uri, const char *merchant_payto_uri,
const struct TALER_WireSaltP *wire_salt, const struct TALER_WireSaltP *wire_salt,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_AgeCommitmentHash *h_age_commitment, const struct TALER_AgeCommitmentHash *h_age_commitment,
const json_t *extension_details, const json_t *extension_details,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
@ -574,10 +574,10 @@ TALER_EXCHANGE_deposit (
struct GNUNET_CURL_Context *ctx; struct GNUNET_CURL_Context *ctx;
json_t *deposit_obj; json_t *deposit_obj;
CURL *eh; CURL *eh;
struct TALER_MerchantWireHash h_wire; struct TALER_MerchantWireHashP h_wire;
struct TALER_DenominationHash denom_pub_hash; struct TALER_DenominationHashP denom_pub_hash;
struct TALER_Amount amount_without_fee; struct TALER_Amount amount_without_fee;
struct TALER_ExtensionContractHash ech; struct TALER_ExtensionContractHashP ech;
char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32]; char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32];
if (NULL != extension_details) if (NULL != extension_details)

View File

@ -262,8 +262,8 @@ struct TALER_EXCHANGE_DepositGetHandle *
TALER_EXCHANGE_deposits_get ( TALER_EXCHANGE_deposits_get (
struct TALER_EXCHANGE_Handle *exchange, struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_MerchantPrivateKeyP *merchant_priv, const struct TALER_MerchantPrivateKeyP *merchant_priv,
const struct TALER_MerchantWireHash *h_wire, const struct TALER_MerchantWireHashP *h_wire,
const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_PrivateContractHashP *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub, const struct TALER_CoinSpendPublicKeyP *coin_pub,
TALER_EXCHANGE_DepositGetCallback cb, TALER_EXCHANGE_DepositGetCallback cb,
void *cb_cls) void *cb_cls)
@ -274,9 +274,9 @@ TALER_EXCHANGE_deposits_get (
struct GNUNET_CURL_Context *ctx; struct GNUNET_CURL_Context *ctx;
CURL *eh; CURL *eh;
char arg_str[(sizeof (struct TALER_CoinSpendPublicKeyP) char arg_str[(sizeof (struct TALER_CoinSpendPublicKeyP)
+ sizeof (struct TALER_MerchantWireHash) + sizeof (struct TALER_MerchantWireHashP)
+ sizeof (struct TALER_MerchantPublicKeyP) + sizeof (struct TALER_MerchantPublicKeyP)
+ sizeof (struct TALER_PrivateContractHash) + sizeof (struct TALER_PrivateContractHashP)
+ sizeof (struct TALER_MerchantSignatureP)) * 2 + 48]; + sizeof (struct TALER_MerchantSignatureP)) * 2 + 48];
if (GNUNET_YES != if (GNUNET_YES !=
@ -300,8 +300,8 @@ TALER_EXCHANGE_deposits_get (
char cpub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2]; char cpub_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2];
char mpub_str[sizeof (struct TALER_MerchantPublicKeyP) * 2]; char mpub_str[sizeof (struct TALER_MerchantPublicKeyP) * 2];
char msig_str[sizeof (struct TALER_MerchantSignatureP) * 2]; char msig_str[sizeof (struct TALER_MerchantSignatureP) * 2];
char chash_str[sizeof (struct TALER_PrivateContractHash) * 2]; char chash_str[sizeof (struct TALER_PrivateContractHashP) * 2];
char whash_str[sizeof (struct TALER_MerchantWireHash) * 2]; char whash_str[sizeof (struct TALER_MerchantWireHashP) * 2];
char *end; char *end;
end = GNUNET_STRINGS_data_to_string (h_wire, end = GNUNET_STRINGS_data_to_string (h_wire,

View File

@ -437,7 +437,7 @@ parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
off = 0; off = 0;
json_array_foreach (keys, i, key) { json_array_foreach (keys, i, key) {
struct TALER_AuditorSignatureP auditor_sig; struct TALER_AuditorSignatureP auditor_sig;
struct TALER_DenominationHash denom_h; struct TALER_DenominationHashP denom_h;
const struct TALER_EXCHANGE_DenomPublicKey *dk; const struct TALER_EXCHANGE_DenomPublicKey *dk;
unsigned int dk_off; unsigned int dk_off;
struct GNUNET_JSON_Specification kspec[] = { struct GNUNET_JSON_Specification kspec[] = {
@ -1005,7 +1005,7 @@ decode_keys_json (const json_t *resp_obj,
EXITIF (JSON_ARRAY != json_typeof (recoup_array)); EXITIF (JSON_ARRAY != json_typeof (recoup_array));
json_array_foreach (recoup_array, index, recoup_info) { json_array_foreach (recoup_array, index, recoup_info) {
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("h_denom_pub", GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&h_denom_pub), &h_denom_pub),
@ -2099,7 +2099,7 @@ TALER_EXCHANGE_destroy_denomination_key (
const struct TALER_EXCHANGE_DenomPublicKey * const struct TALER_EXCHANGE_DenomPublicKey *
TALER_EXCHANGE_get_denomination_key_by_hash ( TALER_EXCHANGE_get_denomination_key_by_hash (
const struct TALER_EXCHANGE_Keys *keys, const struct TALER_EXCHANGE_Keys *keys,
const struct TALER_DenominationHash *hc) const struct TALER_DenominationHashP *hc)
{ {
for (unsigned int i = 0; i<keys->num_denom_keys; i++) for (unsigned int i = 0; i<keys->num_denom_keys; i++)
if (0 == GNUNET_memcmp (hc, if (0 == GNUNET_memcmp (hc,

View File

@ -64,7 +64,7 @@ struct TALER_EXCHANGE_KycCheckHandle
/** /**
* Hash of the payto:// URL that is being KYC'ed. * Hash of the payto:// URL that is being KYC'ed.
*/ */
struct TALER_PaytoHash h_payto; struct TALER_PaytoHashP h_payto;
}; };
@ -216,7 +216,7 @@ handle_kyc_check_finished (void *cls,
struct TALER_EXCHANGE_KycCheckHandle * struct TALER_EXCHANGE_KycCheckHandle *
TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange,
uint64_t payment_target, uint64_t payment_target,
const struct TALER_PaytoHash *h_payto, const struct TALER_PaytoHashP *h_payto,
struct GNUNET_TIME_Relative timeout, struct GNUNET_TIME_Relative timeout,
TALER_EXCHANGE_KycStatusCallback cb, TALER_EXCHANGE_KycStatusCallback cb,
void *cb_cls) void *cb_cls)

View File

@ -67,9 +67,10 @@ struct TALER_EXCHANGE_LinkHandle
struct TALER_CoinSpendPrivateKeyP coin_priv; struct TALER_CoinSpendPrivateKeyP coin_priv;
/** /**
* Age commitment of the coin, might be NULL, required to re-generate age commitments * Age commitment and proof of the original coin, might be NULL.
* Required to derive the new age commitment and proof.
*/ */
const struct TALER_AgeCommitment *age_commitment; const struct TALER_AgeCommitmentProof *age_commitment_proof;
}; };
@ -80,7 +81,6 @@ struct TALER_EXCHANGE_LinkHandle
* *
* @param lh link handle * @param lh link handle
* @param json json reply with the data for one coin * @param json json reply with the data for one coin
* @param coin_num number of the coin
* @param trans_pub our transfer public key * @param trans_pub our transfer public key
* @param[out] lci where to return coin details * @param[out] lci where to return coin details
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
@ -88,7 +88,6 @@ struct TALER_EXCHANGE_LinkHandle
static enum GNUNET_GenericReturnValue static enum GNUNET_GenericReturnValue
parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh, parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
const json_t *json, const json_t *json,
uint32_t coin_num,
const struct TALER_TransferPublicKeyP *trans_pub, const struct TALER_TransferPublicKeyP *trans_pub,
struct TALER_EXCHANGE_LinkedCoinInfo *lci) struct TALER_EXCHANGE_LinkedCoinInfo *lci)
{ {
@ -117,8 +116,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
}; };
struct TALER_TransferSecretP secret; struct TALER_TransferSecretP secret;
struct TALER_PlanchetDetail pd; struct TALER_PlanchetDetail pd;
struct TALER_CoinPubHash c_hash; struct TALER_CoinPubHashP c_hash;
struct TALER_AgeCommitmentHash *hac = NULL;
/* parse reply */ /* parse reply */
memset (&nonce, memset (&nonce,
@ -136,7 +134,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
&lh->coin_priv, &lh->coin_priv,
&secret); &secret);
TALER_transfer_secret_to_planchet_secret (&secret, TALER_transfer_secret_to_planchet_secret (&secret,
coin_num, coin_idx,
&lci->ps); &lci->ps);
TALER_planchet_setup_coin_priv (&lci->ps, TALER_planchet_setup_coin_priv (&lci->ps,
&alg_values, &alg_values,
@ -145,28 +143,26 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
&alg_values, &alg_values,
&bks); &bks);
/* Derive the age commitment and calculate the hash */ lci->age_commitment_proof = NULL;
if (NULL != lh->age_commitment) lci->h_age_commitment = NULL;
{
struct TALER_AgeCommitment nac = {0};
struct TALER_AgeCommitmentHash h = {0};
uint32_t seed = secret.key.bits[0];
if (GNUNET_OK != /* Derive the age commitment and calculate the hash */
TALER_age_commitment_derive ( if (NULL != lh->age_commitment_proof)
lh->age_commitment, {
seed, uint64_t seed = (uint64_t) secret.key.bits[0]
&nac)) | (uint64_t) secret.key.bits[1] << 32;
{ lci->age_commitment_proof = GNUNET_new (struct TALER_AgeCommitmentProof);
GNUNET_break_op (0); lci->h_age_commitment = GNUNET_new (struct TALER_AgeCommitmentHash);
return GNUNET_SYSERR;
} GNUNET_assert (GNUNET_OK ==
TALER_age_commitment_derive (
lh->age_commitment_proof,
seed,
lci->age_commitment_proof));
TALER_age_commitment_hash ( TALER_age_commitment_hash (
&nac, &(lci->age_commitment_proof->commitment),
&h); lci->h_age_commitment);
hac = &h;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -174,7 +170,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
&alg_values, &alg_values,
&bks, &bks,
&lci->coin_priv, &lci->coin_priv,
hac, lci->h_age_commitment,
&c_hash, &c_hash,
&pd)) &pd))
{ {
@ -207,7 +203,7 @@ parse_link_coin (const struct TALER_EXCHANGE_LinkHandle *lh,
/* verify link_sig */ /* verify link_sig */
{ {
struct TALER_CoinSpendPublicKeyP old_coin_pub; struct TALER_CoinSpendPublicKeyP old_coin_pub;
struct TALER_BlindedCoinHash coin_envelope_hash; struct TALER_BlindedCoinHashP coin_envelope_hash;
GNUNET_CRYPTO_eddsa_key_get_public (&lh->coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&lh->coin_priv.eddsa_priv,
&old_coin_pub.eddsa_pub); &old_coin_pub.eddsa_pub);
@ -351,7 +347,6 @@ parse_link_ok (struct TALER_EXCHANGE_LinkHandle *lh,
parse_link_coin (lh, parse_link_coin (lh,
json_array_get (jsona, json_array_get (jsona,
i), i),
i,
&trans_pub, &trans_pub,
lci)) lci))
{ {
@ -476,7 +471,8 @@ handle_link_finished (void *cls,
struct TALER_EXCHANGE_LinkHandle * struct TALER_EXCHANGE_LinkHandle *
TALER_EXCHANGE_link (struct TALER_EXCHANGE_Handle *exchange, TALER_EXCHANGE_link (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_CoinSpendPrivateKeyP *coin_priv, const struct TALER_CoinSpendPrivateKeyP *coin_priv,
const struct TALER_AgeCommitment *age_commitment, const struct
TALER_AgeCommitmentProof *age_commitment_proof,
TALER_EXCHANGE_LinkCallback link_cb, TALER_EXCHANGE_LinkCallback link_cb,
void *link_cb_cls) void *link_cb_cls)
{ {
@ -515,7 +511,7 @@ TALER_EXCHANGE_link (struct TALER_EXCHANGE_Handle *exchange,
lh->link_cb = link_cb; lh->link_cb = link_cb;
lh->link_cb_cls = link_cb_cls; lh->link_cb_cls = link_cb_cls;
lh->coin_priv = *coin_priv; lh->coin_priv = *coin_priv;
lh->age_commitment = age_commitment; lh->age_commitment_proof = age_commitment_proof;
lh->url = TEAH_path_to_url (exchange, lh->url = TEAH_path_to_url (exchange,
arg_str); arg_str);
if (NULL == lh->url) if (NULL == lh->url)

View File

@ -215,7 +215,7 @@ handle_ok (struct TALER_EXCHANGE_ManagementGetKeysHandle *gh,
} }
{ {
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct GNUNET_TIME_Relative duration struct GNUNET_TIME_Relative duration
= GNUNET_TIME_absolute_get_difference ( = GNUNET_TIME_absolute_get_difference (
denom_key->valid_from.abs_time, denom_key->valid_from.abs_time,

View File

@ -126,7 +126,7 @@ struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *
TALER_EXCHANGE_management_revoke_denomination_key ( TALER_EXCHANGE_management_revoke_denomination_key (
struct GNUNET_CURL_Context *ctx, struct GNUNET_CURL_Context *ctx,
const char *url, const char *url,
const struct TALER_DenominationHash *h_denom_pub, const struct TALER_DenominationHashP *h_denom_pub,
const struct TALER_MasterSignatureP *master_sig, const struct TALER_MasterSignatureP *master_sig,
TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb, TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb,
void *cb_cls) void *cb_cls)

View File

@ -199,7 +199,7 @@ verify_melt_signature_denom_conflict (struct TALER_EXCHANGE_MeltHandle *mh,
{ {
json_t *history; json_t *history;
struct TALER_Amount total; struct TALER_Amount total;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
memset (&h_denom_pub, memset (&h_denom_pub,
0, 0,
@ -246,7 +246,7 @@ verify_melt_signature_spend_conflict (struct TALER_EXCHANGE_MeltHandle *mh,
}; };
const struct MeltedCoin *mc; const struct MeltedCoin *mc;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
/* parse JSON reply */ /* parse JSON reply */
if (GNUNET_OK != if (GNUNET_OK !=
@ -458,7 +458,7 @@ start_melt (struct TALER_EXCHANGE_MeltHandle *mh)
struct GNUNET_CURL_Context *ctx; struct GNUNET_CURL_Context *ctx;
struct TALER_CoinSpendSignatureP confirm_sig; struct TALER_CoinSpendSignatureP confirm_sig;
char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32]; char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32];
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
struct TALER_ExchangeWithdrawValues alg_values[mh->rd->fresh_pks_len]; struct TALER_ExchangeWithdrawValues alg_values[mh->rd->fresh_pks_len];
for (unsigned int i = 0; i<mh->rd->fresh_pks_len; i++) for (unsigned int i = 0; i<mh->rd->fresh_pks_len; i++)
@ -478,6 +478,7 @@ start_melt (struct TALER_EXCHANGE_MeltHandle *mh)
&mh->md.melted_coin.fee_melt, &mh->md.melted_coin.fee_melt,
&mh->md.rc, &mh->md.rc,
&h_denom_pub, &h_denom_pub,
mh->md.melted_coin.h_age_commitment,
&mh->md.melted_coin.coin_priv, &mh->md.melted_coin.coin_priv,
&confirm_sig); &confirm_sig);
GNUNET_CRYPTO_eddsa_key_get_public (&mh->md.melted_coin.coin_priv.eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (&mh->md.melted_coin.coin_priv.eddsa_priv,
@ -493,6 +494,12 @@ start_melt (struct TALER_EXCHANGE_MeltHandle *mh)
&mh->md.melted_coin.melt_amount_with_fee), &mh->md.melted_coin.melt_amount_with_fee),
GNUNET_JSON_pack_data_auto ("rc", GNUNET_JSON_pack_data_auto ("rc",
&mh->md.rc), &mh->md.rc),
GNUNET_JSON_pack_allow_null (
mh->md.melted_coin.h_age_commitment
? GNUNET_JSON_pack_data_auto ("age_commitment_hash",
mh->md.melted_coin.h_age_commitment)
: GNUNET_JSON_pack_string ("age_commitment_hash",
NULL)),
GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_allow_null (
mh->send_rms mh->send_rms
? GNUNET_JSON_pack_data_auto ("rms", ? GNUNET_JSON_pack_data_auto ("rms",

View File

@ -169,7 +169,7 @@ handle_recoup_finished (void *cls,
/* Insufficient funds, proof attached */ /* Insufficient funds, proof attached */
json_t *history; json_t *history;
struct TALER_Amount total; struct TALER_Amount total;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
const struct TALER_EXCHANGE_DenomPublicKey *dki; const struct TALER_EXCHANGE_DenomPublicKey *dki;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
@ -293,7 +293,7 @@ TALER_EXCHANGE_recoup (struct TALER_EXCHANGE_Handle *exchange,
struct GNUNET_CURL_Context *ctx; struct GNUNET_CURL_Context *ctx;
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
json_t *recoup_obj; json_t *recoup_obj;
CURL *eh; CURL *eh;
char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32]; char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32];

View File

@ -183,7 +183,7 @@ handle_recoup_refresh_finished (void *cls,
/* Insufficient funds, proof attached */ /* Insufficient funds, proof attached */
json_t *history; json_t *history;
struct TALER_Amount total; struct TALER_Amount total;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
const struct TALER_EXCHANGE_DenomPublicKey *dki; const struct TALER_EXCHANGE_DenomPublicKey *dki;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
@ -297,7 +297,7 @@ TALER_EXCHANGE_recoup_refresh (
struct GNUNET_CURL_Context *ctx; struct GNUNET_CURL_Context *ctx;
struct TALER_CoinSpendSignatureP coin_sig; struct TALER_CoinSpendSignatureP coin_sig;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
struct TALER_DenominationHash h_denom_pub; struct TALER_DenominationHashP h_denom_pub;
json_t *recoup_obj; json_t *recoup_obj;
CURL *eh; CURL *eh;
char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32]; char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32];

View File

@ -78,7 +78,8 @@ TALER_EXCHANGE_get_melt_data_ (
md->melted_coin.fee_melt = rd->melt_pk.fees.refresh; md->melted_coin.fee_melt = rd->melt_pk.fees.refresh;
md->melted_coin.original_value = rd->melt_pk.value; md->melted_coin.original_value = rd->melt_pk.value;
md->melted_coin.expire_deposit = rd->melt_pk.expire_deposit; md->melted_coin.expire_deposit = rd->melt_pk.expire_deposit;
md->melted_coin.age_commitment = rd->age_commitment; md->melted_coin.age_commitment_proof = rd->melt_age_commitment_proof;
md->melted_coin.h_age_commitment = rd->melt_h_age_commitment;
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_amount_set_zero (rd->melt_amount.currency, TALER_amount_set_zero (rd->melt_amount.currency,
@ -166,7 +167,7 @@ TALER_EXCHANGE_get_melt_data_ (
struct TALER_RefreshCoinData *rcd = &md->rcd[i][j]; struct TALER_RefreshCoinData *rcd = &md->rcd[i][j];
union TALER_DenominationBlindingKeyP *bks = &fcd->bks[i]; union TALER_DenominationBlindingKeyP *bks = &fcd->bks[i];
struct TALER_PlanchetDetail pd; struct TALER_PlanchetDetail pd;
struct TALER_CoinPubHash c_hash; struct TALER_CoinPubHashP c_hash;
struct TALER_AgeCommitmentHash *ach = NULL; struct TALER_AgeCommitmentHash *ach = NULL;
TALER_transfer_secret_to_planchet_secret (&trans_sec, TALER_transfer_secret_to_planchet_secret (&trans_sec,
@ -182,31 +183,26 @@ TALER_EXCHANGE_get_melt_data_ (
bks); bks);
/* Handle age commitment, if present */ /* Handle age commitment, if present */
if (NULL != md->melted_coin.age_commitment) if (NULL != md->melted_coin.age_commitment_proof)
{ {
struct TALER_AgeCommitment new_ac; /* We use the first 8 bytes of the trans_sec to generate a new age
struct TALER_AgeCommitmentHash hac;
/* We use the first 4 bytes of the trans_sec to generate a new age
* commitment */ * commitment */
uint32_t age_seed = trans_sec.key.bits[0]; uint64_t age_seed = (uint64_t) trans_sec.key.bits[0]
| (uint64_t) trans_sec.key.bits[1] << 32;
if (GNUNET_OK != fcd->age_commitment_proof[i] = GNUNET_new (struct
TALER_age_commitment_derive ( TALER_AgeCommitmentProof);
md->melted_coin.age_commitment, ach = GNUNET_new (struct TALER_AgeCommitmentHash);
age_seed + j,
&new_ac)) GNUNET_assert (GNUNET_OK ==
{ TALER_age_commitment_derive (
GNUNET_break_op (0); md->melted_coin.age_commitment_proof,
TALER_EXCHANGE_free_melt_data_ (md); age_seed,
return GNUNET_SYSERR; fcd->age_commitment_proof[i]));
}
TALER_age_commitment_hash ( TALER_age_commitment_hash (
&new_ac, &fcd->age_commitment_proof[i]->commitment,
&hac); ach);
ach = &hac;
} }
if (TALER_DENOMINATION_CS == alg_values[j].cipher) if (TALER_DENOMINATION_CS == alg_values[j].cipher)
@ -225,7 +221,6 @@ TALER_EXCHANGE_get_melt_data_ (
TALER_EXCHANGE_free_melt_data_ (md); TALER_EXCHANGE_free_melt_data_ (md);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
rcd->blinded_planchet = pd.blinded_planchet; rcd->blinded_planchet = pd.blinded_planchet;
rcd->dk = &fcd->fresh_pk; rcd->dk = &fcd->fresh_pk;
} }

View File

@ -53,11 +53,11 @@ struct MeltedCoin
struct TALER_Amount original_value; struct TALER_Amount original_value;
/** /**
* The original age commitment and its hash. MUST be NULL if no age * The original age commitment, its proof and its hash. MUST be NULL if no
* commitment was set. * age commitment was set.
*/ */
struct TALER_AgeCommitment *age_commitment; const struct TALER_AgeCommitmentProof *age_commitment_proof;
struct TALER_AgeCommitmentHash *h_age_commitment; const struct TALER_AgeCommitmentHash *h_age_commitment;
/** /**
* Timestamp indicating when coins of this denomination become invalid. * Timestamp indicating when coins of this denomination become invalid.
@ -100,11 +100,11 @@ struct FreshCoinData
struct TALER_CoinSpendPrivateKeyP coin_priv; struct TALER_CoinSpendPrivateKeyP coin_priv;
/** /**
* Arrays age commitments to be created, one for each cut-and-choose * Arrays of age commitments and proofs to be created, one for each
* dimension. The entries in each list might be NULL and indicate no age * cut-and-choose dimension. The entries in each list might be NULL and
* commitment/restriction on the particular coin. * indicate no age commitment/restriction on the particular coin.
*/ */
struct TALER_AgeCommitment *age_commitment[TALER_CNC_KAPPA]; struct TALER_AgeCommitmentProof *age_commitment_proof[TALER_CNC_KAPPA];
/** /**
* Blinding key secrets for the coins, depending on the * Blinding key secrets for the coins, depending on the

Some files were not shown because too many files have changed in this diff Show More