aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_crypto_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r--src/include/gnunet_crypto_lib.h83
1 files changed, 38 insertions, 45 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/**