aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-11 21:43:28 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-11 21:43:34 +0200
commit90ff9edfa9c5fcfa3a36d1653ff105e89b888e21 (patch)
tree780a2071f5072c8e8e044db741eb295c3f3ea2a7 /src/include
parent3bcfe59f1ce533246bda271f00b3ee957cae304d (diff)
downloadgnunet-90ff9edfa9c5fcfa3a36d1653ff105e89b888e21.tar.gz
gnunet-90ff9edfa9c5fcfa3a36d1653ff105e89b888e21.zip
fixing #6149
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_crypto_lib.h83
-rw-r--r--src/include/gnunet_disk_lib.h29
-rw-r--r--src/include/gnunet_identity_service.h30
3 files changed, 56 insertions, 86 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index ba992ed56..a5a50e749 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -1210,40 +1210,44 @@ GNUNET_CRYPTO_eddsa_public_key_from_string (
1210 1210
1211/** 1211/**
1212 * @ingroup crypto 1212 * @ingroup crypto
1213 * Create a new private key by reading it from a file. If the 1213 * @brief Create a new private key by reading it from a file.
1214 * files does not exist, create a new key and write it to the 1214 *
1215 * file. Caller must free return value. Note that this function 1215 * If the files does not exist and @a do_create is set, creates a new key and
1216 * can not guarantee that another process might not be trying 1216 * write it to the file.
1217 * the same operation on the same file at the same time. 1217 *
1218 * If the contents of the file 1218 * If the contents of the file are invalid, an error is returned.
1219 * are invalid the old file is deleted and a fresh key is
1220 * created.
1221 * 1219 *
1222 * @param filename name of file to use to store the key 1220 * @param filename name of file to use to store the key
1223 * @return new private key, NULL on error (for example, 1221 * @param do_create should a file be created?
1224 * permission denied); free using #GNUNET_free 1222 * @param[out] pkey set to the private key from @a filename on success
1223 * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but
1224 * we found an existing file, #GNUNET_SYSERR on failure
1225 */ 1225 */
1226struct GNUNET_CRYPTO_EcdsaPrivateKey * 1226int
1227GNUNET_CRYPTO_ecdsa_key_create_from_file (const char *filename); 1227GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename,
1228 int do_create,
1229 struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey);
1228 1230
1229 1231
1230/** 1232/**
1231 * @ingroup crypto 1233 * @ingroup crypto
1232 * Create a new private key by reading it from a file. If the 1234 * @brief Create a new private key by reading it from a file.
1233 * files does not exist, create a new key and write it to the 1235 *
1234 * file. Caller must free return value. Note that this function 1236 * If the files does not exist and @a do_create is set, creates a new key and
1235 * can not guarantee that another process might not be trying 1237 * write it to the file.
1236 * the same operation on the same file at the same time. 1238 *
1237 * If the contents of the file 1239 * If the contents of the file are invalid, an error is returned.
1238 * are invalid the old file is deleted and a fresh key is
1239 * created.
1240 * 1240 *
1241 * @param filename name of file to use to store the key 1241 * @param filename name of file to use to store the key
1242 * @return new private key, NULL on error (for example, 1242 * @param do_create should a file be created?
1243 * permission denied); free using #GNUNET_free 1243 * @param[out] pkey set to the private key from @a filename on success
1244 * @return #GNUNET_OK on success, #GNUNET_NO if @a do_create was set but
1245 * we found an existing file, #GNUNET_SYSERR on failure
1244 */ 1246 */
1245struct GNUNET_CRYPTO_EddsaPrivateKey * 1247int
1246GNUNET_CRYPTO_eddsa_key_create_from_file (const char *filename); 1248GNUNET_CRYPTO_eddsa_key_from_file (const char *filename,
1249 int do_create,
1250 struct GNUNET_CRYPTO_EddsaPrivateKey *pkey);
1247 1251
1248 1252
1249/** 1253/**
@@ -1268,22 +1272,22 @@ GNUNET_CRYPTO_eddsa_key_create_from_configuration (
1268 1272
1269/** 1273/**
1270 * @ingroup crypto 1274 * @ingroup crypto
1271 * Create a new private key. Caller must free return value. 1275 * Create a new private key.
1272 * 1276 *
1273 * @return fresh private key; free using #GNUNET_free 1277 * @param[out] pk private key to initialize
1274 */ 1278 */
1275struct GNUNET_CRYPTO_EcdsaPrivateKey * 1279void
1276GNUNET_CRYPTO_ecdsa_key_create (void); 1280GNUNET_CRYPTO_ecdsa_key_create (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk);
1277 1281
1278 1282
1279/** 1283/**
1280 * @ingroup crypto 1284 * @ingroup crypto
1281 * Create a new private key. Caller must free return value. 1285 * Create a new private key.
1282 * 1286 *
1283 * @return fresh private key; free using #GNUNET_free 1287 * @param[out] pk private key to initialize
1284 */ 1288 */
1285struct GNUNET_CRYPTO_EddsaPrivateKey * 1289void
1286GNUNET_CRYPTO_eddsa_key_create (void); 1290GNUNET_CRYPTO_eddsa_key_create (struct GNUNET_CRYPTO_EddsaPrivateKey *pk);
1287 1291
1288 1292
1289/** 1293/**
@@ -1291,20 +1295,9 @@ GNUNET_CRYPTO_eddsa_key_create (void);
1291 * Create a new private key. Clear with #GNUNET_CRYPTO_ecdhe_key_clear(). 1295 * Create a new private key. Clear with #GNUNET_CRYPTO_ecdhe_key_clear().
1292 * 1296 *
1293 * @param[out] pk set to fresh private key; 1297 * @param[out] pk set to fresh private key;
1294 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
1295 */ 1298 */
1296int 1299void
1297GNUNET_CRYPTO_ecdhe_key_create2 (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); 1300GNUNET_CRYPTO_ecdhe_key_create (struct GNUNET_CRYPTO_EcdhePrivateKey *pk);
1298
1299
1300/**
1301 * @ingroup crypto
1302 * Create a new private key. Caller must free return value.
1303 *
1304 * @return fresh private key; free using #GNUNET_free
1305 */
1306struct GNUNET_CRYPTO_EcdhePrivateKey *
1307GNUNET_CRYPTO_ecdhe_key_create (void);
1308 1301
1309 1302
1310/** 1303/**
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index b79be5f70..f43cf8943 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -691,35 +691,6 @@ GNUNET_DISK_directory_create (const char *dir);
691 691
692 692
693/** 693/**
694 * Lock a part of a file.
695 *
696 * @param fh file handle
697 * @param lock_start absolute position from where to lock
698 * @param lock_end absolute position until where to lock
699 * @param excl #GNUNET_YES for an exclusive lock
700 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
701 */
702int
703GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh,
704 off_t lock_start,
705 off_t lock_end, int excl);
706
707
708/**
709 * Unlock a part of a file.
710 *
711 * @param fh file handle
712 * @param unlock_start absolute position from where to unlock
713 * @param unlock_end absolute position until where to unlock
714 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
715 */
716int
717GNUNET_DISK_file_unlock (struct GNUNET_DISK_FileHandle *fh,
718 off_t unlock_start,
719 off_t unlock_end);
720
721
722/**
723 * @brief Removes special characters as ':' from a filename. 694 * @brief Removes special characters as ':' from a filename.
724 * @param fn the filename to canonicalize 695 * @param fn the filename to canonicalize
725 */ 696 */
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h
index 674176e0e..e09e2f196 100644
--- a/src/include/gnunet_identity_service.h
+++ b/src/include/gnunet_identity_service.h
@@ -137,10 +137,11 @@ GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
137 * NULL if the user just deleted the ego and it 137 * NULL if the user just deleted the ego and it
138 * must thus no longer be used 138 * must thus no longer be used
139 */ 139 */
140typedef void (*GNUNET_IDENTITY_Callback) (void *cls, 140typedef void
141 struct GNUNET_IDENTITY_Ego *ego, 141(*GNUNET_IDENTITY_Callback) (void *cls,
142 void **ctx, 142 struct GNUNET_IDENTITY_Ego *ego,
143 const char *name); 143 void **ctx,
144 const char *name);
144 145
145 146
146/** 147/**
@@ -180,7 +181,9 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id,
180 * @param cls closure 181 * @param cls closure
181 * @param emsg NULL on success, otherwise an error message 182 * @param emsg NULL on success, otherwise an error message
182 */ 183 */
183typedef void (*GNUNET_IDENTITY_Continuation) (void *cls, const char *emsg); 184typedef void
185(*GNUNET_IDENTITY_Continuation) (void *cls,
186 const char *emsg);
184 187
185 188
186/** 189/**
@@ -218,7 +221,8 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h);
218 * @param pk private key, NULL on error 221 * @param pk private key, NULL on error
219 * @param emsg error message, NULL on success 222 * @param emsg error message, NULL on success
220 */ 223 */
221typedef void (*GNUNET_IDENTITY_CreateContinuation) ( 224typedef void
225(*GNUNET_IDENTITY_CreateContinuation) (
222 void *cls, 226 void *cls,
223 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 227 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk,
224 const char *emsg); 228 const char *emsg);
@@ -294,9 +298,9 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op);
294 * @param cls closure 298 * @param cls closure
295 * @param ego NULL on error / ego not found 299 * @param ego NULL on error / ego not found
296 */ 300 */
297typedef void (*GNUNET_IDENTITY_EgoCallback) ( 301typedef void
298 void *cls, 302(*GNUNET_IDENTITY_EgoCallback) (void *cls,
299 const struct GNUNET_IDENTITY_Ego *ego); 303 const struct GNUNET_IDENTITY_Ego *ego);
300 304
301/** 305/**
302 * Handle for ego lookup. 306 * Handle for ego lookup.
@@ -335,7 +339,8 @@ GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el);
335 * @param ego NULL on error / ego not found 339 * @param ego NULL on error / ego not found
336 * @param ego_name NULL on error, name of the ego otherwise 340 * @param ego_name NULL on error, name of the ego otherwise
337 */ 341 */
338typedef void (*GNUNET_IDENTITY_EgoSuffixCallback) ( 342typedef void
343(*GNUNET_IDENTITY_EgoSuffixCallback) (
339 void *cls, 344 void *cls,
340 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, 345 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv,
341 const char *ego_name); 346 const char *ego_name);
@@ -373,8 +378,9 @@ GNUNET_IDENTITY_ego_lookup_by_suffix (const struct
373 * @param el handle for lookup to abort 378 * @param el handle for lookup to abort
374 */ 379 */
375void 380void
376GNUNET_IDENTITY_ego_lookup_by_suffix_cancel (struct 381GNUNET_IDENTITY_ego_lookup_by_suffix_cancel (
377 GNUNET_IDENTITY_EgoSuffixLookup *el); 382 struct GNUNET_IDENTITY_EgoSuffixLookup *el);
383
378 384
379#if 0 /* keep Emacsens' auto-indent happy */ 385#if 0 /* keep Emacsens' auto-indent happy */
380{ 386{