diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-12-19 18:43:38 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-12-19 18:43:38 +0100 |
commit | 3636ea628d051cf2ba7a9038c50528c561d0aeaa (patch) | |
tree | 87664b904950052e8b6997a371ed5ecb1ea4b310 /src/include/gnunet_crypto_lib.h | |
parent | 74d7528e6bd53cf5acc939c63a5be74a001e5ce1 (diff) | |
download | gnunet-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/gnunet_crypto_lib.h')
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 30 |
1 files changed, 15 insertions, 15 deletions
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 | */ |
1026 | int | 1026 | enum GNUNET_GenericReturnValue |
1027 | GNUNET_CRYPTO_hkdf (void *result, | 1027 | GNUNET_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 | */ |
1052 | int | 1052 | enum GNUNET_GenericReturnValue |
1053 | GNUNET_CRYPTO_hkdf_v (void *result, | 1053 | GNUNET_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 | */ |
1075 | int | 1075 | enum GNUNET_GenericReturnValue |
1076 | GNUNET_CRYPTO_kdf_v (void *result, | 1076 | GNUNET_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 | */ |
1119 | int | 1119 | enum GNUNET_GenericReturnValue |
1120 | GNUNET_CRYPTO_kdf (void *result, | 1120 | GNUNET_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 | */ |
1218 | int | 1218 | enum GNUNET_GenericReturnValue |
1219 | GNUNET_CRYPTO_ecdsa_public_key_from_string ( | 1219 | GNUNET_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 | */ |
1248 | int | 1248 | enum GNUNET_GenericReturnValue |
1249 | GNUNET_CRYPTO_eddsa_public_key_from_string ( | 1249 | GNUNET_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 | */ |
1270 | int | 1270 | enum GNUNET_GenericReturnValue |
1271 | GNUNET_CRYPTO_ecdsa_key_from_file (const char *filename, | 1271 | GNUNET_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 | */ |
1609 | int | 1609 | enum GNUNET_GenericReturnValue |
1610 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1610 | GNUNET_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 | */ |
1625 | int | 1625 | enum GNUNET_GenericReturnValue |
1626 | GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | 1626 | GNUNET_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 | */ |
1640 | int | 1640 | enum GNUNET_GenericReturnValue |
1641 | GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 1641 | GNUNET_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 | */ |
1656 | int | 1656 | enum GNUNET_GenericReturnValue |
1657 | GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1657 | GNUNET_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 | */ |
1671 | int | 1671 | enum GNUNET_GenericReturnValue |
1672 | GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1672 | GNUNET_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 | */ |
1692 | int | 1692 | enum GNUNET_GenericReturnValue |
1693 | GNUNET_CRYPTO_eddsa_sign_ ( | 1693 | GNUNET_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 | */ |
1739 | int | 1739 | enum GNUNET_GenericReturnValue |
1740 | GNUNET_CRYPTO_ecdsa_sign_ ( | 1740 | GNUNET_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 | */ |
2336 | int | 2336 | enum GNUNET_GenericReturnValue |
2337 | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, | 2337 | GNUNET_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); |