aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-12-19 18:43:38 +0100
committerChristian Grothoff <christian@grothoff.org>2020-12-19 18:43:38 +0100
commit3636ea628d051cf2ba7a9038c50528c561d0aeaa (patch)
tree87664b904950052e8b6997a371ed5ecb1ea4b310 /src/include
parent74d7528e6bd53cf5acc939c63a5be74a001e5ce1 (diff)
downloadgnunet-3636ea628d051cf2ba7a9038c50528c561d0aeaa.tar.gz
gnunet-3636ea628d051cf2ba7a9038c50528c561d0aeaa.zip
change GNUNET_DISK_fn_write() to always do atomic writes and to NOT overwrite existing files; also change the return value to not return the size of the written file but GNUNET_OK on success, and integrate creating the directory if needed; breaks API, hence bumping libgnunetutil version
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_common.h2
-rw-r--r--src/include/gnunet_configuration_lib.h59
-rw-r--r--src/include/gnunet_crypto_lib.h30
-rw-r--r--src/include/gnunet_disk_lib.h46
4 files changed, 71 insertions, 66 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index bc2055709..b5af1146d 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -345,7 +345,7 @@ struct GNUNET_AsyncScopeSave
345 * #GNUNET_NO to stop iteration with no error, 345 * #GNUNET_NO to stop iteration with no error,
346 * #GNUNET_SYSERR to abort iteration with error! 346 * #GNUNET_SYSERR to abort iteration with error!
347 */ 347 */
348typedef int 348typedef enum GNUNET_GenericReturnValue
349(*GNUNET_FileNameCallback) (void *cls, 349(*GNUNET_FileNameCallback) (void *cls,
350 const char *filename); 350 const char *filename);
351 351
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index b4e7f7d8f..ad55c1b9a 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -82,7 +82,7 @@ GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg);
82 * @param filename name of the configuration file, NULL to load defaults 82 * @param filename name of the configuration file, NULL to load defaults
83 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 83 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
84 */ 84 */
85int 85enum GNUNET_GenericReturnValue
86GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, 86GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
87 const char *filename); 87 const char *filename);
88 88
@@ -95,7 +95,7 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
95 * @param defaults_d directory with the defaults 95 * @param defaults_d directory with the defaults
96 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 96 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
97 */ 97 */
98int 98enum GNUNET_GenericReturnValue
99GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, 99GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg,
100 const char *defaults_d); 100 const char *defaults_d);
101 101
@@ -120,7 +120,7 @@ GNUNET_CONFIGURATION_default (void);
120 * @param filename name of the configuration file 120 * @param filename name of the configuration file
121 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 121 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
122 */ 122 */
123int 123enum GNUNET_GenericReturnValue
124GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, 124GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
125 const char *filename); 125 const char *filename);
126 126
@@ -149,7 +149,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
149 * when we come across them 149 * when we come across them
150 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 150 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
151 */ 151 */
152int 152enum GNUNET_GenericReturnValue
153GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, 153GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
154 const char *mem, 154 const char *mem,
155 size_t size, 155 size_t size,
@@ -163,19 +163,20 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
163 * @param filename where to write the configuration 163 * @param filename where to write the configuration
164 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 164 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
165 */ 165 */
166int 166enum GNUNET_GenericReturnValue
167GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, 167GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
168 const char *filename); 168 const char *filename);
169 169
170 170
171/** 171/**
172 * Write only configuration entries that have been changed to configuration file 172 * Write only configuration entries that have been changed to configuration file
173 *
173 * @param cfg_default default configuration 174 * @param cfg_default default configuration
174 * @param cfg_new new configuration 175 * @param cfg_new new configuration
175 * @param filename where to write the configuration diff between default and new 176 * @param filename where to write the configuration diff between default and new
176 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 177 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
177 */ 178 */
178int 179enum GNUNET_GenericReturnValue
179GNUNET_CONFIGURATION_write_diffs (const struct 180GNUNET_CONFIGURATION_write_diffs (const struct
180 GNUNET_CONFIGURATION_Handle *cfg_default, 181 GNUNET_CONFIGURATION_Handle *cfg_default,
181 const struct 182 const struct
@@ -204,7 +205,7 @@ GNUNET_CONFIGURATION_get_diff (const struct
204 * @param cfg configuration to inspect 205 * @param cfg configuration to inspect
205 * @return #GNUNET_NO if clean, #GNUNET_YES if dirty, #GNUNET_SYSERR on error (i.e. last save failed) 206 * @return #GNUNET_NO if clean, #GNUNET_YES if dirty, #GNUNET_SYSERR on error (i.e. last save failed)
206 */ 207 */
207int 208enum GNUNET_GenericReturnValue
208GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); 209GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg);
209 210
210 211
@@ -215,7 +216,7 @@ GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg);
215 * @param cfg the configuration 216 * @param cfg the configuration
216 * @return status code 217 * @return status code
217 */ 218 */
218typedef int 219typedef enum GNUNET_GenericReturnValue
219(*GNUNET_CONFIGURATION_Callback)(void *cls, 220(*GNUNET_CONFIGURATION_Callback)(void *cls,
220 const struct GNUNET_CONFIGURATION_Handle *cfg); 221 const struct GNUNET_CONFIGURATION_Handle *cfg);
221 222
@@ -231,7 +232,7 @@ typedef int
231 * @return #GNUNET_SYSERR if parsing the configuration failed, 232 * @return #GNUNET_SYSERR if parsing the configuration failed,
232 * otherwise return value from @a cb. 233 * otherwise return value from @a cb.
233 */ 234 */
234int 235enum GNUNET_GenericReturnValue
235GNUNET_CONFIGURATION_parse_and_run (const char *filename, 236GNUNET_CONFIGURATION_parse_and_run (const char *filename,
236 GNUNET_CONFIGURATION_Callback cb, 237 GNUNET_CONFIGURATION_Callback cb,
237 void *cb_cls); 238 void *cb_cls);
@@ -311,7 +312,7 @@ GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg,
311 * @param number where to store the numeric value of the option 312 * @param number where to store the numeric value of the option
312 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 313 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
313 */ 314 */
314int 315enum GNUNET_GenericReturnValue
315GNUNET_CONFIGURATION_get_value_number (const struct 316GNUNET_CONFIGURATION_get_value_number (const struct
316 GNUNET_CONFIGURATION_Handle *cfg, 317 GNUNET_CONFIGURATION_Handle *cfg,
317 const char *section, 318 const char *section,
@@ -328,7 +329,7 @@ GNUNET_CONFIGURATION_get_value_number (const struct
328 * @param number where to store the floating value of the option 329 * @param number where to store the floating value of the option
329 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 330 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
330 */ 331 */
331int 332enum GNUNET_GenericReturnValue
332GNUNET_CONFIGURATION_get_value_float (const struct 333GNUNET_CONFIGURATION_get_value_float (const struct
333 GNUNET_CONFIGURATION_Handle *cfg, 334 GNUNET_CONFIGURATION_Handle *cfg,
334 const char *section, 335 const char *section,
@@ -345,7 +346,7 @@ GNUNET_CONFIGURATION_get_value_float (const struct
345 * @param time set to the time value stored in the configuration 346 * @param time set to the time value stored in the configuration
346 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 347 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
347 */ 348 */
348int 349enum GNUNET_GenericReturnValue
349GNUNET_CONFIGURATION_get_value_time (const struct 350GNUNET_CONFIGURATION_get_value_time (const struct
350 GNUNET_CONFIGURATION_Handle *cfg, 351 GNUNET_CONFIGURATION_Handle *cfg,
351 const char *section, 352 const char *section,
@@ -362,7 +363,7 @@ GNUNET_CONFIGURATION_get_value_time (const struct
362 * @param size set to the size in bytes as stored in the configuration 363 * @param size set to the size in bytes as stored in the configuration
363 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 364 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
364 */ 365 */
365int 366enum GNUNET_GenericReturnValue
366GNUNET_CONFIGURATION_get_value_size (const struct 367GNUNET_CONFIGURATION_get_value_size (const struct
367 GNUNET_CONFIGURATION_Handle *cfg, 368 GNUNET_CONFIGURATION_Handle *cfg,
368 const char *section, 369 const char *section,
@@ -378,7 +379,7 @@ GNUNET_CONFIGURATION_get_value_size (const struct
378 * @param option option of interest 379 * @param option option of interest
379 * @return #GNUNET_YES if so, #GNUNET_NO if not. 380 * @return #GNUNET_YES if so, #GNUNET_NO if not.
380 */ 381 */
381int 382enum GNUNET_GenericReturnValue
382GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, 383GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
383 const char *section, 384 const char *section,
384 const char *option); 385 const char *option);
@@ -394,12 +395,12 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
394 * value, or NULL if option is not specified 395 * value, or NULL if option is not specified
395 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 396 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
396 */ 397 */
397int 398enum GNUNET_GenericReturnValue
398GNUNET_CONFIGURATION_get_value_string (const struct 399GNUNET_CONFIGURATION_get_value_string (
399 GNUNET_CONFIGURATION_Handle *cfg, 400 const struct GNUNET_CONFIGURATION_Handle *cfg,
400 const char *section, 401 const char *section,
401 const char *option, 402 const char *option,
402 char **value); 403 char **value);
403 404
404 405
405/** 406/**
@@ -413,7 +414,7 @@ GNUNET_CONFIGURATION_get_value_string (const struct
413 * value, or NULL if option is not specified 414 * value, or NULL if option is not specified
414 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 415 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
415 */ 416 */
416int 417enum GNUNET_GenericReturnValue
417GNUNET_CONFIGURATION_get_value_filename (const struct 418GNUNET_CONFIGURATION_get_value_filename (const struct
418 GNUNET_CONFIGURATION_Handle *cfg, 419 GNUNET_CONFIGURATION_Handle *cfg,
419 const char *section, 420 const char *section,
@@ -466,7 +467,7 @@ GNUNET_CONFIGURATION_iterate_section_values (const struct
466 * or NULL if option is not specified and no default given 467 * or NULL if option is not specified and no default given
467 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 468 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
468 */ 469 */
469int 470enum GNUNET_GenericReturnValue
470GNUNET_CONFIGURATION_get_value_choice (const struct 471GNUNET_CONFIGURATION_get_value_choice (const struct
471 GNUNET_CONFIGURATION_Handle *cfg, 472 GNUNET_CONFIGURATION_Handle *cfg,
472 const char *section, 473 const char *section,
@@ -483,7 +484,7 @@ GNUNET_CONFIGURATION_get_value_choice (const struct
483 * @param option option of interest 484 * @param option option of interest
484 * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR 485 * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR
485 */ 486 */
486int 487enum GNUNET_GenericReturnValue
487GNUNET_CONFIGURATION_get_value_yesno (const struct 488GNUNET_CONFIGURATION_get_value_yesno (const struct
488 GNUNET_CONFIGURATION_Handle *cfg, 489 GNUNET_CONFIGURATION_Handle *cfg,
489 const char *section, 490 const char *section,
@@ -502,7 +503,7 @@ GNUNET_CONFIGURATION_get_value_yesno (const struct
502 * #GNUNET_NO is the value does not exist 503 * #GNUNET_NO is the value does not exist
503 * #GNUNET_SYSERR on decoding error 504 * #GNUNET_SYSERR on decoding error
504 */ 505 */
505int 506enum GNUNET_GenericReturnValue
506GNUNET_CONFIGURATION_get_data (const struct GNUNET_CONFIGURATION_Handle *cfg, 507GNUNET_CONFIGURATION_get_data (const struct GNUNET_CONFIGURATION_Handle *cfg,
507 const char *section, 508 const char *section,
508 const char *option, 509 const char *option,
@@ -527,9 +528,9 @@ GNUNET_CONFIGURATION_get_data (const struct GNUNET_CONFIGURATION_Handle *cfg,
527 * @return $-expanded string 528 * @return $-expanded string
528 */ 529 */
529char * 530char *
530GNUNET_CONFIGURATION_expand_dollar (const struct 531GNUNET_CONFIGURATION_expand_dollar (
531 GNUNET_CONFIGURATION_Handle *cfg, 532 const struct GNUNET_CONFIGURATION_Handle *cfg,
532 char *orig); 533 char *orig);
533 534
534 535
535/** 536/**
@@ -573,7 +574,7 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg,
573 * @return #GNUNET_OK on success, 574 * @return #GNUNET_OK on success,
574 * #GNUNET_SYSERR if the filename is not in the list 575 * #GNUNET_SYSERR if the filename is not in the list
575 */ 576 */
576int 577enum GNUNET_GenericReturnValue
577GNUNET_CONFIGURATION_remove_value_filename (struct 578GNUNET_CONFIGURATION_remove_value_filename (struct
578 GNUNET_CONFIGURATION_Handle *cfg, 579 GNUNET_CONFIGURATION_Handle *cfg,
579 const char *section, 580 const char *section,
@@ -592,7 +593,7 @@ GNUNET_CONFIGURATION_remove_value_filename (struct
592 * @return #GNUNET_OK on success, 593 * @return #GNUNET_OK on success,
593 * #GNUNET_SYSERR if the filename already in the list 594 * #GNUNET_SYSERR if the filename already in the list
594 */ 595 */
595int 596enum GNUNET_GenericReturnValue
596GNUNET_CONFIGURATION_append_value_filename (struct 597GNUNET_CONFIGURATION_append_value_filename (struct
597 GNUNET_CONFIGURATION_Handle *cfg, 598 GNUNET_CONFIGURATION_Handle *cfg,
598 const char *section, 599 const char *section,
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 6dc56f0e4..5521dad3c 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -1023,7 +1023,7 @@ GNUNET_CRYPTO_hmac_derive_key (
1023 * @param ... pair of void * & size_t for context chunks, terminated by NULL 1023 * @param ... pair of void * & size_t for context chunks, terminated by NULL
1024 * @return #GNUNET_YES on success 1024 * @return #GNUNET_YES on success
1025 */ 1025 */
1026int 1026enum GNUNET_GenericReturnValue
1027GNUNET_CRYPTO_hkdf (void *result, 1027GNUNET_CRYPTO_hkdf (void *result,
1028 size_t out_len, 1028 size_t out_len,
1029 int xtr_algo, 1029 int xtr_algo,
@@ -1049,7 +1049,7 @@ GNUNET_CRYPTO_hkdf (void *result,
1049 * @param argp va_list of void * & size_t pairs for context chunks 1049 * @param argp va_list of void * & size_t pairs for context chunks
1050 * @return #GNUNET_YES on success 1050 * @return #GNUNET_YES on success
1051 */ 1051 */
1052int 1052enum GNUNET_GenericReturnValue
1053GNUNET_CRYPTO_hkdf_v (void *result, 1053GNUNET_CRYPTO_hkdf_v (void *result,
1054 size_t out_len, 1054 size_t out_len,
1055 int xtr_algo, 1055 int xtr_algo,
@@ -1072,7 +1072,7 @@ GNUNET_CRYPTO_hkdf_v (void *result,
1072 * @param argp va_list of void * & size_t pairs for context chunks 1072 * @param argp va_list of void * & size_t pairs for context chunks
1073 * @return #GNUNET_YES on success 1073 * @return #GNUNET_YES on success
1074 */ 1074 */
1075int 1075enum GNUNET_GenericReturnValue
1076GNUNET_CRYPTO_kdf_v (void *result, 1076GNUNET_CRYPTO_kdf_v (void *result,
1077 size_t out_len, 1077 size_t out_len,
1078 const void *xts, 1078 const void *xts,
@@ -1116,7 +1116,7 @@ GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
1116 * @param ... void * & size_t pairs for context chunks 1116 * @param ... void * & size_t pairs for context chunks
1117 * @return #GNUNET_YES on success 1117 * @return #GNUNET_YES on success
1118 */ 1118 */
1119int 1119enum GNUNET_GenericReturnValue
1120GNUNET_CRYPTO_kdf (void *result, 1120GNUNET_CRYPTO_kdf (void *result,
1121 size_t out_len, 1121 size_t out_len,
1122 const void *xts, 1122 const void *xts,
@@ -1215,7 +1215,7 @@ GNUNET_CRYPTO_eddsa_public_key_to_string (
1215 * @param pub where to store the public key 1215 * @param pub where to store the public key
1216 * @return #GNUNET_OK on success 1216 * @return #GNUNET_OK on success
1217 */ 1217 */
1218int 1218enum GNUNET_GenericReturnValue
1219GNUNET_CRYPTO_ecdsa_public_key_from_string ( 1219GNUNET_CRYPTO_ecdsa_public_key_from_string (
1220 const char *enc, 1220 const char *enc,
1221 size_t enclen, 1221 size_t enclen,
@@ -1245,7 +1245,7 @@ GNUNET_CRYPTO_eddsa_private_key_from_string (
1245 * @param pub where to store the public key 1245 * @param pub where to store the public key
1246 * @return #GNUNET_OK on success 1246 * @return #GNUNET_OK on success
1247 */ 1247 */
1248int 1248enum GNUNET_GenericReturnValue
1249GNUNET_CRYPTO_eddsa_public_key_from_string ( 1249GNUNET_CRYPTO_eddsa_public_key_from_string (
1250 const char *enc, 1250 const char *enc,
1251 size_t enclen, 1251 size_t enclen,
@@ -1267,7 +1267,7 @@ GNUNET_CRYPTO_eddsa_public_key_from_string (
1267 * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but 1267 * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but
1268 * we found an existing file, #GNUNET_SYSERR on failure 1268 * we found an existing file, #GNUNET_SYSERR on failure
1269 */ 1269 */
1270int 1270enum GNUNET_GenericReturnValue
1271GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename, 1271GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename,
1272 int do_create, 1272 int do_create,
1273 struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey); 1273 struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey);
@@ -1606,7 +1606,7 @@ GNUNET_CRYPTO_ecc_dlog_release (struct GNUNET_CRYPTO_EccDlogContext *dlc);
1606 * @param key_material where to write the key material (xyG) 1606 * @param key_material where to write the key material (xyG)
1607 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1607 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1608 */ 1608 */
1609int 1609enum GNUNET_GenericReturnValue
1610GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, 1610GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1611 const struct GNUNET_CRYPTO_EcdhePublicKey *pub, 1611 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1612 struct GNUNET_HashCode *key_material); 1612 struct GNUNET_HashCode *key_material);
@@ -1622,7 +1622,7 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1622 * @param key_material where to write the key material H(h(x)yG) 1622 * @param key_material where to write the key material H(h(x)yG)
1623 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1623 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1624 */ 1624 */
1625int 1625enum GNUNET_GenericReturnValue
1626GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, 1626GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1627 const struct GNUNET_CRYPTO_EcdhePublicKey *pub, 1627 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1628 struct GNUNET_HashCode *key_material); 1628 struct GNUNET_HashCode *key_material);
@@ -1637,7 +1637,7 @@ GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1637 * @param key_material where to write the key material H(h(x)yG) 1637 * @param key_material where to write the key material H(h(x)yG)
1638 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1638 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1639 */ 1639 */
1640int 1640enum GNUNET_GenericReturnValue
1641GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, 1641GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1642 const struct GNUNET_CRYPTO_EcdhePublicKey *pub, 1642 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
1643 struct GNUNET_HashCode *key_material); 1643 struct GNUNET_HashCode *key_material);
@@ -1653,7 +1653,7 @@ GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1653 * @param key_material where to write the key material H(yX)=H(h(x)yG) 1653 * @param key_material where to write the key material H(yX)=H(h(x)yG)
1654 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1654 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1655 */ 1655 */
1656int 1656enum GNUNET_GenericReturnValue
1657GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, 1657GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1658 const struct GNUNET_CRYPTO_EddsaPublicKey *pub, 1658 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
1659 struct GNUNET_HashCode *key_material); 1659 struct GNUNET_HashCode *key_material);
@@ -1668,7 +1668,7 @@ GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1668 * @param key_material where to write the key material H(yX)=H(h(x)yG) 1668 * @param key_material where to write the key material H(yX)=H(h(x)yG)
1669 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1669 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1670 */ 1670 */
1671int 1671enum GNUNET_GenericReturnValue
1672GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, 1672GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1673 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, 1673 const struct GNUNET_CRYPTO_EcdsaPublicKey *pub,
1674 struct GNUNET_HashCode *key_material); 1674 struct GNUNET_HashCode *key_material);
@@ -1689,7 +1689,7 @@ GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv,
1689 * @param[out] sig where to write the signature 1689 * @param[out] sig where to write the signature
1690 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1690 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1691 */ 1691 */
1692int 1692enum GNUNET_GenericReturnValue
1693GNUNET_CRYPTO_eddsa_sign_ ( 1693GNUNET_CRYPTO_eddsa_sign_ (
1694 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, 1694 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
1695 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, 1695 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
@@ -1736,7 +1736,7 @@ GNUNET_CRYPTO_eddsa_sign_ (
1736 * @param[out] sig where to write the signature 1736 * @param[out] sig where to write the signature
1737 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 1737 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
1738 */ 1738 */
1739int 1739enum GNUNET_GenericReturnValue
1740GNUNET_CRYPTO_ecdsa_sign_ ( 1740GNUNET_CRYPTO_ecdsa_sign_ (
1741 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, 1741 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
1742 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, 1742 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
@@ -2333,7 +2333,7 @@ GNUNET_CRYPTO_rsa_unblind (const struct GNUNET_CRYPTO_RsaSignature *sig,
2333 * @param public_key public key of the signer 2333 * @param public_key public key of the signer
2334 * @returns #GNUNET_YES if ok, #GNUNET_NO if RSA key is malicious, #GNUNET_SYSERR if signature 2334 * @returns #GNUNET_YES if ok, #GNUNET_NO if RSA key is malicious, #GNUNET_SYSERR if signature
2335 */ 2335 */
2336int 2336enum GNUNET_GenericReturnValue
2337GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, 2337GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash,
2338 const struct GNUNET_CRYPTO_RsaSignature *sig, 2338 const struct GNUNET_CRYPTO_RsaSignature *sig,
2339 const struct GNUNET_CRYPTO_RsaPublicKey *public_key); 2339 const struct GNUNET_CRYPTO_RsaPublicKey *public_key);
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index 3f29dc2e4..b794088c4 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -251,7 +251,7 @@ enum GNUNET_DISK_PipeEnd
251 * @param h handle to check 251 * @param h handle to check
252 * @return #GNUNET_YES if invalid, #GNUNET_NO if valid 252 * @return #GNUNET_YES if invalid, #GNUNET_NO if valid
253 */ 253 */
254int 254enum GNUNET_GenericReturnValue
255GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h); 255GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h);
256 256
257 257
@@ -263,7 +263,7 @@ GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h);
263 * @return #GNUNET_YES if yes, #GNUNET_NO if not a file, #GNUNET_SYSERR if something 263 * @return #GNUNET_YES if yes, #GNUNET_NO if not a file, #GNUNET_SYSERR if something
264 * else (will print an error message in that case, too). 264 * else (will print an error message in that case, too).
265 */ 265 */
266int 266enum GNUNET_GenericReturnValue
267GNUNET_DISK_file_test (const char *fil); 267GNUNET_DISK_file_test (const char *fil);
268 268
269 269
@@ -304,7 +304,7 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle *h,
304 * and return #GNUNET_SYSERR for directories. 304 * and return #GNUNET_SYSERR for directories.
305 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success 305 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
306 */ 306 */
307int 307enum GNUNET_GenericReturnValue
308GNUNET_DISK_file_size (const char *filename, 308GNUNET_DISK_file_size (const char *filename,
309 uint64_t *size, 309 uint64_t *size,
310 int include_symbolic_links, 310 int include_symbolic_links,
@@ -326,7 +326,7 @@ GNUNET_DISK_file_size (const char *filename,
326 * @param ino set to the inode ID 326 * @param ino set to the inode ID
327 * @return #GNUNET_OK on success 327 * @return #GNUNET_OK on success
328 */ 328 */
329int 329enum GNUNET_GenericReturnValue
330GNUNET_DISK_file_get_identifiers (const char *filename, 330GNUNET_DISK_file_get_identifiers (const char *filename,
331 uint64_t *dev, 331 uint64_t *dev,
332 uint64_t *ino); 332 uint64_t *ino);
@@ -385,7 +385,7 @@ GNUNET_DISK_file_open (const char *fn,
385 * @param size where to write size of the file 385 * @param size where to write size of the file
386 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 386 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
387 */ 387 */
388int 388enum GNUNET_GenericReturnValue
389GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, 389GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh,
390 off_t *size); 390 off_t *size);
391 391
@@ -447,7 +447,7 @@ GNUNET_DISK_pipe_from_fd (enum GNUNET_DISK_PipeFlags pf,
447 * @param p pipe 447 * @param p pipe
448 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 448 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
449 */ 449 */
450int 450enum GNUNET_GenericReturnValue
451GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p); 451GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p);
452 452
453 453
@@ -458,7 +458,7 @@ GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p);
458 * @param end which end of the pipe to close 458 * @param end which end of the pipe to close
459 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 459 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
460 */ 460 */
461int 461enum GNUNET_GenericReturnValue
462GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, 462GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p,
463 enum GNUNET_DISK_PipeEnd end); 463 enum GNUNET_DISK_PipeEnd end);
464 464
@@ -485,7 +485,7 @@ GNUNET_DISK_pipe_detach_end (struct GNUNET_DISK_PipeHandle *p,
485 * @param h file handle 485 * @param h file handle
486 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 486 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
487 */ 487 */
488int 488enum GNUNET_GenericReturnValue
489GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h); 489GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h);
490 490
491 491
@@ -609,16 +609,19 @@ GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle *h,
609 609
610 610
611/** 611/**
612 * Write a buffer to a file. If the file is longer than 612 * Write a buffer to a file atomically. The directory is created if
613 * the given buffer size, it will be truncated. 613 * necessary. Fail if @a filename already exists or if not exactly @a buf
614 * with @a buf_size bytes could be written to @a filename.
614 * 615 *
615 * @param fn file name 616 * @param fn file name
616 * @param buffer the data to write 617 * @param buffer the data to write
617 * @param n number of bytes to write 618 * @param n number of bytes to write
618 * @param mode file permissions 619 * @param mode file permissions
619 * @return number of bytes written on success, #GNUNET_SYSERR on error 620 * @return #GNUNET_OK on success,
621 * #GNUNET_NO if a file existed under @a filename
622 * #GNUNET_SYSERR on failure
620 */ 623 */
621ssize_t 624enum GNUNET_GenericReturnValue
622GNUNET_DISK_fn_write (const char *fn, 625GNUNET_DISK_fn_write (const char *fn,
623 const void *buffer, 626 const void *buffer,
624 size_t n, 627 size_t n,
@@ -632,7 +635,7 @@ GNUNET_DISK_fn_write (const char *fn,
632 * @param dst destination file name 635 * @param dst destination file name
633 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 636 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
634 */ 637 */
635int 638enum GNUNET_GenericReturnValue
636GNUNET_DISK_file_copy (const char *src, 639GNUNET_DISK_file_copy (const char *src,
637 const char *dst); 640 const char *dst);
638 641
@@ -659,7 +662,7 @@ GNUNET_DISK_directory_scan (const char *dir_name,
659 * @returns #GNUNET_OK on success, #GNUNET_SYSERR on failure, 662 * @returns #GNUNET_OK on success, #GNUNET_SYSERR on failure,
660 * #GNUNET_NO if directory exists but is not writeable 663 * #GNUNET_NO if directory exists but is not writeable
661 */ 664 */
662int 665enum GNUNET_GenericReturnValue
663GNUNET_DISK_directory_create_for_file (const char *filename); 666GNUNET_DISK_directory_create_for_file (const char *filename);
664 667
665 668
@@ -675,8 +678,9 @@ GNUNET_DISK_directory_create_for_file (const char *filename);
675 * @return #GNUNET_YES if yes, #GNUNET_NO if not; #GNUNET_SYSERR if it 678 * @return #GNUNET_YES if yes, #GNUNET_NO if not; #GNUNET_SYSERR if it
676 * does not exist or `stat`ed 679 * does not exist or `stat`ed
677 */ 680 */
678int 681enum GNUNET_GenericReturnValue
679GNUNET_DISK_directory_test (const char *fil, int is_readable); 682GNUNET_DISK_directory_test (const char *fil,
683 int is_readable);
680 684
681 685
682/** 686/**
@@ -685,7 +689,7 @@ GNUNET_DISK_directory_test (const char *fil, int is_readable);
685 * @param filename the file to remove 689 * @param filename the file to remove
686 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 690 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
687 */ 691 */
688int 692enum GNUNET_GenericReturnValue
689GNUNET_DISK_directory_remove (const char *filename); 693GNUNET_DISK_directory_remove (const char *filename);
690 694
691 695
@@ -707,7 +711,7 @@ GNUNET_DISK_purge_cfg_dir (const char *cfg_filename,
707 * @param dir the directory to create 711 * @param dir the directory to create
708 * @returns #GNUNET_SYSERR on failure, #GNUNET_OK otherwise 712 * @returns #GNUNET_SYSERR on failure, #GNUNET_OK otherwise
709 */ 713 */
710int 714enum GNUNET_GenericReturnValue
711GNUNET_DISK_directory_create (const char *dir); 715GNUNET_DISK_directory_create (const char *dir);
712 716
713 717
@@ -725,7 +729,7 @@ GNUNET_DISK_filename_canonicalize (char *fn);
725 * @param user new owner of the file 729 * @param user new owner of the file
726 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 730 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
727 */ 731 */
728int 732enum GNUNET_GenericReturnValue
729GNUNET_DISK_file_change_owner (const char *filename, 733GNUNET_DISK_file_change_owner (const char *filename,
730 const char *user); 734 const char *user);
731 735
@@ -758,7 +762,7 @@ GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h,
758 * @param h mapping handle 762 * @param h mapping handle
759 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 763 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
760 */ 764 */
761int 765enum GNUNET_GenericReturnValue
762GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h); 766GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h);
763 767
764 768
@@ -768,7 +772,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h);
768 * @param h handle to an open file 772 * @param h handle to an open file
769 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise 773 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
770 */ 774 */
771int 775enum GNUNET_GenericReturnValue
772GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h); 776GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h);
773 777
774 778