aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-28 20:53:21 +0100
committerChristian Grothoff <christian@grothoff.org>2015-01-28 20:53:21 +0100
commit9c3c6295a85a03fdad9a77799e85289ce65a109b (patch)
tree4325f5a0d8f26f32effd9b2bf4c900a83a038d8a
parentc4b63c13029b9d731b826ffab4a9d59005b0c6a5 (diff)
downloadexchange-9c3c6295a85a03fdad9a77799e85289ce65a109b.tar.gz
exchange-9c3c6295a85a03fdad9a77799e85289ce65a109b.zip
even cleaner separation of PostGres-specific logic, and nicer libtalerutil headers
-rw-r--r--src/include/Makefile.am7
-rw-r--r--src/include/taler_amount_lib.h173
-rw-r--r--src/include/taler_crypto_lib.h208
-rw-r--r--src/include/taler_util.h341
-rw-r--r--src/mint/Makefile.am2
-rw-r--r--src/mint/mint_db.c3
-rw-r--r--src/pq/Makefile.am2
-rw-r--r--src/pq/db_pq.c2
-rw-r--r--src/pq/db_pq.h (renamed from src/include/taler_db_lib.h)0
-rw-r--r--src/util/amount.c5
-rw-r--r--src/util/crypto.c3
-rw-r--r--src/util/json.c4
12 files changed, 401 insertions, 349 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 70dee2186..40382dcc1 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -2,8 +2,9 @@ talerincludedir = $(includedir)/taler
2 2
3talerinclude_HEADERS = \ 3talerinclude_HEADERS = \
4 platform.h \ 4 platform.h \
5 taler_db_lib.h \ 5 taler_amount_lib.h \
6 taler_crypto_lib.h \
6 taler_json_lib.h \ 7 taler_json_lib.h \
8 taler_util.h \
7 taler_mint_service.h \ 9 taler_mint_service.h \
8 taler_signatures.h \ 10 taler_signatures.h
9 taler_util.h
diff --git a/src/include/taler_amount_lib.h b/src/include/taler_amount_lib.h
new file mode 100644
index 000000000..50b34ff15
--- /dev/null
+++ b/src/include/taler_amount_lib.h
@@ -0,0 +1,173 @@
1/*
2 This file is part of TALER
3 (C) 2014, 2015 Christian Grothoff (and other contributing authors)
4
5 TALER is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 3, or (at your option) any later version.
8
9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
15*/
16/**
17 * @file include/taler_amount_lib.h
18 * @brief amount-representation utility functions
19 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
20 */
21#ifndef TALER_AMOUNT_LIB_H
22#define TALER_AMOUNT_LIB_H
23
24
25/**
26 * Number of characters (plus 1 for 0-termination) we use to
27 * represent currency names (i.e. EUR, USD, etc.). We use
28 * 8 for alignment (!).
29 */
30#define TALER_CURRENCY_LEN 8
31
32
33GNUNET_NETWORK_STRUCT_BEGIN
34
35
36/**
37 * Amount, encoded for network transmission.
38 */
39struct TALER_AmountNBO
40{
41 /**
42 * Value in the main currency, in NBO.
43 */
44 uint32_t value;
45
46 /**
47 * Additinal fractional value, in NBO.
48 */
49 uint32_t fraction;
50
51 /**
52 * Type of the currency being represented.
53 */
54 char currency[TALER_CURRENCY_LEN];
55};
56
57GNUNET_NETWORK_STRUCT_END
58
59
60/**
61 * Representation of monetary value in a given currency.
62 */
63struct TALER_Amount
64{
65 /**
66 * Value (numerator of fraction)
67 */
68 uint32_t value;
69
70 /**
71 * Fraction (denominator of fraction)
72 */
73 uint32_t fraction;
74
75 /**
76 * Currency string, left adjusted and padded with zeros.
77 */
78 char currency[TALER_CURRENCY_LEN];
79};
80
81
82/**
83 * Parse denomination description, in the format "T : V : F".
84 *
85 * @param str denomination description
86 * @param denom denomination to write the result to
87 * @return #GNUNET_OK if the string is a valid denomination specification,
88 * #GNUNET_SYSERR if it is invalid.
89 */
90int
91TALER_string_to_amount (const char *str,
92 struct TALER_Amount *denom);
93
94
95/**
96 * Convert amount from host to network representation.
97 *
98 * @param d amount in host representation
99 * @return amount in network representation
100 */
101struct TALER_AmountNBO
102TALER_amount_hton (struct TALER_Amount d);
103
104
105/**
106 * Convert amount from network to host representation.
107 *
108 * @param d amount in network representation
109 * @return amount in host representation
110 */
111struct TALER_Amount
112TALER_amount_ntoh (struct TALER_AmountNBO dn);
113
114
115/**
116 * Compare the value/fraction of two amounts. Does not compare the currency,
117 * i.e. comparing amounts with the same value and fraction but different
118 * currency would return 0.
119 *
120 * @param a1 first amount
121 * @param a2 second amount
122 * @return result of the comparison
123 */
124int
125TALER_amount_cmp (struct TALER_Amount a1,
126 struct TALER_Amount a2);
127
128
129/**
130 * Perform saturating subtraction of amounts.
131 *
132 * @param a1 amount to subtract from
133 * @param a2 amount to subtract
134 * @return (a1-a2) or 0 if a2>=a1
135 */
136struct TALER_Amount
137TALER_amount_subtract (struct TALER_Amount a1,
138 struct TALER_Amount a2);
139
140
141/**
142 * Perform saturating addition of amounts
143 *
144 * @param a1 first amount to add
145 * @param a2 second amount to add
146 * @return sum of a1 and a2
147 */
148struct TALER_Amount
149TALER_amount_add (struct TALER_Amount a1,
150 struct TALER_Amount a2);
151
152
153/**
154 * Normalize the given amount.
155 *
156 * @param amout amount to normalize
157 * @return normalized amount
158 */
159struct TALER_Amount
160TALER_amount_normalize (struct TALER_Amount amount);
161
162
163/**
164 * Convert amount to string.
165 *
166 * @param amount amount to convert to string
167 * @return freshly allocated string representation
168 */
169char *
170TALER_amount_to_string (struct TALER_Amount amount);
171
172
173#endif
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
new file mode 100644
index 000000000..597c85cdd
--- /dev/null
+++ b/src/include/taler_crypto_lib.h
@@ -0,0 +1,208 @@
1/*
2 This file is part of TALER
3 (C) 2014, 2015 Christian Grothoff (and other contributing authors)
4
5 TALER is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 3, or (at your option) any later version.
8
9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
15*/
16/**
17 * @file include/taler_crypto_lib.h
18 * @brief taler-specific crypto functions
19 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
20 */
21#ifndef TALER_CRYPTO_LIB_H
22#define TALER_CRYPTO_LIB_H
23
24#include <gnunet/gnunet_util_lib.h>
25#include <gcrypt.h>
26
27
28/* ****************** Coin crypto primitives ************* */
29
30/**
31 * Public information about a coin (including the public key
32 * of the coin, the denomination key and the signature with
33 * the denomination key).
34 */
35struct TALER_CoinPublicInfo
36{
37 /**
38 * The coin's public key.
39 */
40 struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub;
41
42 /**
43 * Public key representing the denomination of the coin
44 * that is being deposited.
45 */
46 struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
47
48 /**
49 * (Unblinded) signature over @e coin_pub with @e denom_pub,
50 * which demonstrates that the coin is valid.
51 */
52 struct GNUNET_CRYPTO_rsa_Signature *denom_sig;
53};
54
55
56/**
57 * Check if a coin is valid; that is, whether the denomination key exists,
58 * is not expired, and the signature is correct.
59 *
60 * @param coin_public_info the coin public info to check for validity
61 * @return #GNUNET_YES if the coin is valid,
62 * #GNUNET_NO if it is invalid
63 * #GNUNET_SYSERROR if an internal error occured
64 */
65int
66TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info);
67
68
69/* ****************** Refresh crypto primitives ************* */
70
71/**
72 * Secret used to decrypt the key to decrypt link secrets.
73 */
74struct TALER_TransferSecret
75{
76 /**
77 * Secret used to encrypt/decrypt the `struct TALER_LinkSecret`.
78 * Must be (currently) a hash as this is what
79 * #GNUNET_CRYPTO_ecc_ecdh() returns to us.
80 */
81 struct GNUNET_HashCode key;
82};
83
84
85/**
86 * Secret used to decrypt refresh links.
87 */
88struct TALER_LinkSecret
89{
90 /**
91 * Secret used to decrypt the refresh link data.
92 */
93 char key[sizeof (struct GNUNET_HashCode)];
94};
95
96
97/**
98 * Encrypted secret used to decrypt refresh links.
99 */
100struct TALER_EncryptedLinkSecret
101{
102 /**
103 * Encrypted secret, must be the given size!
104 */
105 char enc[sizeof (struct TALER_LinkSecret)];
106};
107
108
109/**
110 * Representation of an encrypted refresh link.
111 */
112struct TALER_RefreshLinkEncrypted
113{
114
115 /**
116 * Encrypted blinding key with @e blinding_key_enc_size bytes,
117 * must be allocated at the end of this struct.
118 */
119 const char *blinding_key_enc;
120
121 /**
122 * Number of bytes in @e blinding_key_enc.
123 */
124 size_t blinding_key_enc_size;
125
126 /**
127 * Encrypted private key of the coin.
128 */
129 char coin_priv_enc[sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)];
130
131};
132
133
134/**
135 * Representation of an refresh link in cleartext.
136 */
137struct TALER_RefreshLinkDecrypted
138{
139
140 /**
141 * Private key of the coin.
142 */
143 struct GNUNET_CRYPTO_EcdsaPrivateKey coin_priv;
144
145 /**
146 * Blinding key with @e blinding_key_enc_size bytes.
147 */
148 struct GNUNET_CRYPTO_rsa_BlindingKey *blinding_key;
149
150};
151
152
153/**
154 * Use the @a trans_sec (from ECDHE) to decrypt the @a secret_enc
155 * to obtain the @a secret to decrypt the linkage data.
156 *
157 * @param secret_enc encrypted secret
158 * @param trans_sec transfer secret
159 * @param secret shared secret for refresh link decryption
160 * @return #GNUNET_OK on success
161 */
162int
163TALER_transfer_decrypt (const struct TALER_EncryptedLinkSecret *secret_enc,
164 const struct TALER_TransferSecret *trans_sec,
165 struct TALER_LinkSecret *secret);
166
167
168/**
169 * Use the @a trans_sec (from ECDHE) to encrypt the @a secret
170 * to obtain the @a secret_enc.
171 *
172 * @param secret shared secret for refresh link decryption
173 * @param trans_sec transfer secret
174 * @param secret_enc[out] encrypted secret
175 * @return #GNUNET_OK on success
176 */
177int
178TALER_transfer_encrypt (const struct TALER_LinkSecret *secret,
179 const struct TALER_TransferSecret *trans_sec,
180 struct TALER_EncryptedLinkSecret *secret_enc);
181
182
183/**
184 * Decrypt refresh link information.
185 *
186 * @param input encrypted refresh link data
187 * @param secret shared secret to use for decryption
188 * @return NULL on error
189 */
190struct TALER_RefreshLinkDecrypted *
191TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input,
192 const struct TALER_LinkSecret *secret);
193
194
195/**
196 * Encrypt refresh link information.
197 *
198 * @param input plaintext refresh link data
199 * @param secret shared secret to use for encryption
200 * @return NULL on error (should never happen)
201 */
202struct TALER_RefreshLinkEncrypted *
203TALER_refresh_encrypt (const struct TALER_RefreshLinkDecrypted *input,
204 const struct TALER_LinkSecret *secret);
205
206
207
208#endif
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 00f139286..f2f319720 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -18,11 +18,15 @@
18 * @brief Interface for common utility functions 18 * @brief Interface for common utility functions
19 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 19 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
20 */ 20 */
21#ifndef TALER_UTIL_H_ 21#ifndef TALER_UTIL_H
22#define TALER_UTIL_H_ 22#define TALER_UTIL_H
23 23
24#include <gnunet/gnunet_util_lib.h> 24#include <gnunet/gnunet_util_lib.h>
25#include <gcrypt.h> 25#include "taler_amount_lib.h"
26#include "taler_crypto_lib.h"
27#include "taler_json_lib.h"
28
29
26 30
27/* Define logging functions */ 31/* Define logging functions */
28#define LOG_DEBUG(...) \ 32#define LOG_DEBUG(...) \
@@ -50,7 +54,6 @@
50 } while(0) 54 } while(0)
51 55
52 56
53
54/** 57/**
55 * Log an error message at log-level 'level' that indicates 58 * Log an error message at log-level 'level' that indicates
56 * a failure of the command 'cmd' with the message given 59 * a failure of the command 'cmd' with the message given
@@ -63,7 +66,6 @@
63 do {int rc; rc = cmd; if (!rc) break; LOG_ERROR("A Gcrypt call failed at %s:%d with error: %s\n", __FILE__, __LINE__, gcry_strerror(rc)); abort(); } while (0) 66 do {int rc; rc = cmd; if (!rc) break; LOG_ERROR("A Gcrypt call failed at %s:%d with error: %s\n", __FILE__, __LINE__, gcry_strerror(rc)); abort(); } while (0)
64 67
65 68
66
67/** 69/**
68 * Initialize Gcrypt library. 70 * Initialize Gcrypt library.
69 */ 71 */
@@ -83,333 +85,4 @@ TALER_config_load (const char *base_dir);
83 85
84 86
85 87
86/* *********************** Amount management ****************** */
87
88
89/**
90 * Number of characters (plus 1 for 0-termination) we use to
91 * represent currency names (i.e. EUR, USD, etc.). We use
92 * 8 for alignment (!).
93 */
94#define TALER_CURRENCY_LEN 8
95
96
97GNUNET_NETWORK_STRUCT_BEGIN
98
99/**
100 * Amount, encoded for network transmission.
101 */
102struct TALER_AmountNBO
103{
104 /**
105 * Value in the main currency, in NBO.
106 */
107 uint32_t value;
108
109 /**
110 * Additinal fractional value, in NBO.
111 */
112 uint32_t fraction;
113
114 /**
115 * Type of the currency being represented.
116 */
117 char currency[TALER_CURRENCY_LEN];
118};
119
120GNUNET_NETWORK_STRUCT_END
121
122
123/**
124 * Representation of monetary value in a given currency.
125 */
126struct TALER_Amount
127{
128 /**
129 * Value (numerator of fraction)
130 */
131 uint32_t value;
132
133 /**
134 * Fraction (denominator of fraction)
135 */
136 uint32_t fraction;
137
138 /**
139 * Currency string, left adjusted and padded with zeros.
140 */
141 char currency[TALER_CURRENCY_LEN];
142};
143
144
145/**
146 * Parse denomination description, in the format "T : V : F".
147 *
148 * @param str denomination description
149 * @param denom denomination to write the result to
150 * @return #GNUNET_OK if the string is a valid denomination specification,
151 * #GNUNET_SYSERR if it is invalid.
152 */
153int
154TALER_string_to_amount (const char *str,
155 struct TALER_Amount *denom);
156
157
158/**
159 * Convert amount from host to network representation.
160 *
161 * @param d amount in host representation
162 * @return amount in network representation
163 */
164struct TALER_AmountNBO
165TALER_amount_hton (struct TALER_Amount d);
166
167
168/**
169 * Convert amount from network to host representation.
170 *
171 * @param d amount in network representation
172 * @return amount in host representation
173 */
174struct TALER_Amount
175TALER_amount_ntoh (struct TALER_AmountNBO dn);
176
177
178/**
179 * Compare the value/fraction of two amounts. Does not compare the currency,
180 * i.e. comparing amounts with the same value and fraction but different
181 * currency would return 0.
182 *
183 * @param a1 first amount
184 * @param a2 second amount
185 * @return result of the comparison
186 */
187int
188TALER_amount_cmp (struct TALER_Amount a1,
189 struct TALER_Amount a2);
190
191
192/**
193 * Perform saturating subtraction of amounts.
194 *
195 * @param a1 amount to subtract from
196 * @param a2 amount to subtract
197 * @return (a1-a2) or 0 if a2>=a1
198 */
199struct TALER_Amount
200TALER_amount_subtract (struct TALER_Amount a1,
201 struct TALER_Amount a2);
202
203
204/**
205 * Perform saturating addition of amounts
206 *
207 * @param a1 first amount to add
208 * @param a2 second amount to add
209 * @return sum of a1 and a2
210 */
211struct TALER_Amount
212TALER_amount_add (struct TALER_Amount a1,
213 struct TALER_Amount a2);
214
215
216/**
217 * Normalize the given amount.
218 *
219 * @param amout amount to normalize
220 * @return normalized amount
221 */
222struct TALER_Amount
223TALER_amount_normalize (struct TALER_Amount amount);
224
225
226/**
227 * Convert amount to string.
228 *
229 * @param amount amount to convert to string
230 * @return freshly allocated string representation
231 */
232char *
233TALER_amount_to_string (struct TALER_Amount amount);
234
235
236/* ****************** Coin crypto primitives ************* */
237
238/**
239 * Public information about a coin (including the public key
240 * of the coin, the denomination key and the signature with
241 * the denomination key).
242 */
243struct TALER_CoinPublicInfo
244{
245 /**
246 * The coin's public key.
247 */
248 struct GNUNET_CRYPTO_EcdsaPublicKey coin_pub;
249
250 /**
251 * Public key representing the denomination of the coin
252 * that is being deposited.
253 */
254 struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
255
256 /**
257 * (Unblinded) signature over @e coin_pub with @e denom_pub,
258 * which demonstrates that the coin is valid.
259 */
260 struct GNUNET_CRYPTO_rsa_Signature *denom_sig;
261};
262
263
264/**
265 * Check if a coin is valid; that is, whether the denomination key exists,
266 * is not expired, and the signature is correct.
267 *
268 * @param coin_public_info the coin public info to check for validity
269 * @return #GNUNET_YES if the coin is valid,
270 * #GNUNET_NO if it is invalid
271 * #GNUNET_SYSERROR if an internal error occured
272 */
273int
274TALER_test_coin_valid (const struct TALER_CoinPublicInfo *coin_public_info);
275
276
277/* ****************** Refresh crypto primitives ************* */
278
279/**
280 * Secret used to decrypt the key to decrypt link secrets.
281 */
282struct TALER_TransferSecret
283{
284 /**
285 * Secret used to encrypt/decrypt the `struct TALER_LinkSecret`.
286 * Must be (currently) a hash as this is what
287 * #GNUNET_CRYPTO_ecc_ecdh() returns to us.
288 */
289 struct GNUNET_HashCode key;
290};
291
292
293/**
294 * Secret used to decrypt refresh links.
295 */
296struct TALER_LinkSecret
297{
298 /**
299 * Secret used to decrypt the refresh link data.
300 */
301 char key[sizeof (struct GNUNET_HashCode)];
302};
303
304
305/**
306 * Encrypted secret used to decrypt refresh links.
307 */
308struct TALER_EncryptedLinkSecret
309{
310 /**
311 * Encrypted secret, must be the given size!
312 */
313 char enc[sizeof (struct TALER_LinkSecret)];
314};
315
316
317/**
318 * Representation of an encrypted refresh link.
319 */
320struct TALER_RefreshLinkEncrypted
321{
322
323 /**
324 * Encrypted blinding key with @e blinding_key_enc_size bytes,
325 * must be allocated at the end of this struct.
326 */
327 const char *blinding_key_enc;
328
329 /**
330 * Number of bytes in @e blinding_key_enc.
331 */
332 size_t blinding_key_enc_size;
333
334 /**
335 * Encrypted private key of the coin.
336 */
337 char coin_priv_enc[sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)];
338
339};
340
341
342/**
343 * Representation of an refresh link in cleartext.
344 */
345struct TALER_RefreshLinkDecrypted
346{
347
348 /**
349 * Private key of the coin.
350 */
351 struct GNUNET_CRYPTO_EcdsaPrivateKey coin_priv;
352
353 /**
354 * Blinding key with @e blinding_key_enc_size bytes.
355 */
356 struct GNUNET_CRYPTO_rsa_BlindingKey *blinding_key;
357
358};
359
360
361/**
362 * Use the @a trans_sec (from ECDHE) to decrypt the @a secret_enc
363 * to obtain the @a secret to decrypt the linkage data.
364 *
365 * @param secret_enc encrypted secret
366 * @param trans_sec transfer secret
367 * @param secret shared secret for refresh link decryption
368 * @return #GNUNET_OK on success
369 */
370int
371TALER_transfer_decrypt (const struct TALER_EncryptedLinkSecret *secret_enc,
372 const struct TALER_TransferSecret *trans_sec,
373 struct TALER_LinkSecret *secret);
374
375
376/**
377 * Use the @a trans_sec (from ECDHE) to encrypt the @a secret
378 * to obtain the @a secret_enc.
379 *
380 * @param secret shared secret for refresh link decryption
381 * @param trans_sec transfer secret
382 * @param secret_enc[out] encrypted secret
383 * @return #GNUNET_OK on success
384 */
385int
386TALER_transfer_encrypt (const struct TALER_LinkSecret *secret,
387 const struct TALER_TransferSecret *trans_sec,
388 struct TALER_EncryptedLinkSecret *secret_enc);
389
390
391/**
392 * Decrypt refresh link information.
393 *
394 * @param input encrypted refresh link data
395 * @param secret shared secret to use for decryption
396 * @return NULL on error
397 */
398struct TALER_RefreshLinkDecrypted *
399TALER_refresh_decrypt (const struct TALER_RefreshLinkEncrypted *input,
400 const struct TALER_LinkSecret *secret);
401
402
403/**
404 * Encrypt refresh link information.
405 *
406 * @param input plaintext refresh link data
407 * @param secret shared secret to use for encryption
408 * @return NULL on error (should never happen)
409 */
410struct TALER_RefreshLinkEncrypted *
411TALER_refresh_encrypt (const struct TALER_RefreshLinkDecrypted *input,
412 const struct TALER_LinkSecret *secret);
413
414
415#endif 88#endif
diff --git a/src/mint/Makefile.am b/src/mint/Makefile.am
index d1a68e590..9bb554a48 100644
--- a/src/mint/Makefile.am
+++ b/src/mint/Makefile.am
@@ -1,4 +1,4 @@
1AM_CPPFLAGS = -I$(top_srcdir)/src/include $(POSTGRESQL_CPPFLAGS) 1AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/pq/ $(POSTGRESQL_CPPFLAGS)
2 2
3lib_LTLIBRARIES = \ 3lib_LTLIBRARIES = \
4 libtalermint_common.la 4 libtalermint_common.la
diff --git a/src/mint/mint_db.c b/src/mint/mint_db.c
index 35f803e1b..0f233a5ae 100644
--- a/src/mint/mint_db.c
+++ b/src/mint/mint_db.c
@@ -13,14 +13,13 @@
13 You should have received a copy of the GNU General Public License along with 13 You should have received a copy of the GNU General Public License along with
14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> 14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
15*/ 15*/
16
17/** 16/**
18 * @file mint_db.c 17 * @file mint_db.c
19 * @brief Database access for the mint 18 * @brief Database access for the mint
20 * @author Florian Dold 19 * @author Florian Dold
21 */ 20 */
22#include "platform.h" 21#include "platform.h"
23#include "taler_db_lib.h" 22#include "db_pq.h"
24#include "taler_signatures.h" 23#include "taler_signatures.h"
25#include "taler-mint-httpd_responses.h" 24#include "taler-mint-httpd_responses.h"
26#include "mint_db.h" 25#include "mint_db.h"
diff --git a/src/pq/Makefile.am b/src/pq/Makefile.am
index cd7a5c93f..532d2909b 100644
--- a/src/pq/Makefile.am
+++ b/src/pq/Makefile.am
@@ -4,7 +4,7 @@ lib_LTLIBRARIES = \
4 libtalerpq.la 4 libtalerpq.la
5 5
6libtalerpq_la_SOURCES = \ 6libtalerpq_la_SOURCES = \
7 db_pq.c 7 db_pq.c db_pq.h
8 8
9libtalerpq_la_LIBADD = \ 9libtalerpq_la_LIBADD = \
10 -lgnunetutil \ 10 -lgnunetutil \
diff --git a/src/pq/db_pq.c b/src/pq/db_pq.c
index 2864f3475..069827579 100644
--- a/src/pq/db_pq.c
+++ b/src/pq/db_pq.c
@@ -22,7 +22,7 @@
22 */ 22 */
23#include "platform.h" 23#include "platform.h"
24#include <gnunet/gnunet_util_lib.h> 24#include <gnunet/gnunet_util_lib.h>
25#include "taler_db_lib.h" 25#include "db_pq.h"
26 26
27 27
28/** 28/**
diff --git a/src/include/taler_db_lib.h b/src/pq/db_pq.h
index 6e2b2b2c0..6e2b2b2c0 100644
--- a/src/include/taler_db_lib.h
+++ b/src/pq/db_pq.h
diff --git a/src/util/amount.c b/src/util/amount.c
index 8bd899bf5..bb5bf0d5b 100644
--- a/src/util/amount.c
+++ b/src/util/amount.c
@@ -13,9 +13,8 @@
13 You should have received a copy of the GNU General Public License along with 13 You should have received a copy of the GNU General Public License along with
14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> 14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
15*/ 15*/
16
17/** 16/**
18 * @file amount.c 17 * @file util/amount.c
19 * @brief Common utility functions to deal with units of currency 18 * @brief Common utility functions to deal with units of currency
20 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 19 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
21 * @author Florian Dold 20 * @author Florian Dold
@@ -23,8 +22,6 @@
23 */ 22 */
24#include "platform.h" 23#include "platform.h"
25#include "taler_util.h" 24#include "taler_util.h"
26#include <gnunet/gnunet_common.h>
27#include <gnunet/gnunet_util_lib.h>
28#include <gcrypt.h> 25#include <gcrypt.h>
29 26
30#define AMOUNT_FRAC_BASE 1000000 27#define AMOUNT_FRAC_BASE 1000000
diff --git a/src/util/crypto.c b/src/util/crypto.c
index 8ce3ade2c..12f452085 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -14,11 +14,12 @@
14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> 14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
15*/ 15*/
16/** 16/**
17 * @file crypto.c 17 * @file util/crypto.c
18 * @brief Cryptographic utility functions 18 * @brief Cryptographic utility functions
19 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 19 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
20 * @author Florian Dold 20 * @author Florian Dold
21 * @author Benedikt Mueller 21 * @author Benedikt Mueller
22 * @author Christian Grothoff
22 */ 23 */
23#include "platform.h" 24#include "platform.h"
24#include "taler_util.h" 25#include "taler_util.h"
diff --git a/src/util/json.c b/src/util/json.c
index 252def394..f686d84a1 100644
--- a/src/util/json.c
+++ b/src/util/json.c
@@ -13,13 +13,11 @@
13 You should have received a copy of the GNU General Public License along with 13 You should have received a copy of the GNU General Public License along with
14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> 14 TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
15*/ 15*/
16
17/** 16/**
18 * @file util/json.c 17 * @file util/json.c
19 * @brief helper functions for JSON processing using libjansson 18 * @brief helper functions for JSON processing using libjansson
20 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 19 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
21 */ 20 */
22
23#include "platform.h" 21#include "platform.h"
24#include <gnunet/gnunet_util_lib.h> 22#include <gnunet/gnunet_util_lib.h>
25#include "taler_util.h" 23#include "taler_util.h"
@@ -49,6 +47,7 @@
49 if (cond) { WARN_JSON(error); goto EXITIF_exit; } \ 47 if (cond) { WARN_JSON(error); goto EXITIF_exit; } \
50 } while (0) 48 } while (0)
51 49
50
52/** 51/**
53 * Convert a TALER amount to a JSON 52 * Convert a TALER amount to a JSON
54 * object. 53 * object.
@@ -60,6 +59,7 @@ json_t *
60TALER_JSON_from_amount (struct TALER_Amount amount) 59TALER_JSON_from_amount (struct TALER_Amount amount)
61{ 60{
62 json_t *j; 61 json_t *j;
62
63 j = json_pack ("{s: s, s:I, s:I}", 63 j = json_pack ("{s: s, s:I, s:I}",
64 "currency", amount.currency, 64 "currency", amount.currency,
65 "value", (json_int_t) amount.value, 65 "value", (json_int_t) amount.value,