diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_crypto_lib.h | 54 | ||||
-rw-r--r-- | src/include/taler_json_lib.h | 44 | ||||
-rw-r--r-- | src/include/taler_mint_service.h | 1 | ||||
-rw-r--r-- | src/include/taler_mintdb_lib.h | 1 | ||||
-rw-r--r-- | src/include/taler_mintdb_plugin.h | 18 | ||||
-rw-r--r-- | src/include/taler_pq_lib.h | 40 | ||||
-rw-r--r-- | src/include/taler_signatures.h | 26 | ||||
-rw-r--r-- | src/include/taler_util.h | 2 |
8 files changed, 82 insertions, 104 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index 0ab05f5d..f2c73faa 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -17,6 +17,7 @@ * @file include/taler_crypto_lib.h * @brief taler-specific crypto functions * @author Sree Harsha Totakura <sreeharsha@totakura.in> + * @author Christian Grothoff <christian@grothoff.org> */ #ifndef TALER_CRYPTO_LIB_H #define TALER_CRYPTO_LIB_H @@ -100,7 +101,7 @@ struct TALER_MerchantPrivateKeyP struct TALER_TransferPublicKeyP { /** - * Taler uses ECDSA for transfer keys. + * Taler uses ECDHE for transfer keys. */ struct GNUNET_CRYPTO_EcdhePublicKey ecdhe_pub; }; @@ -113,7 +114,7 @@ struct TALER_TransferPublicKeyP struct TALER_TransferPrivateKeyP { /** - * Taler uses ECDSA for melting session keys. + * Taler uses ECDHE for melting session keys. */ struct GNUNET_CRYPTO_EcdhePrivateKey ecdhe_priv; }; @@ -196,37 +197,28 @@ struct TALER_MasterSignatureP /** * @brief Type of public keys for Taler coins. The same key material is used - * for ECDSA and ECDHE operations. + * for EdDSA and ECDHE operations. */ -union TALER_CoinSpendPublicKeyP +struct TALER_CoinSpendPublicKeyP { /** - * Taler uses ECDSA for coins when signing deposit requests. + * Taler uses EdDSA for coins when signing deposit requests. */ - struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_pub; + struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub; - /** - * Taler uses ECDH(E) for coin linkage during refresh operations. - */ - struct GNUNET_CRYPTO_EcdhePublicKey ecdhe_pub; }; /** * @brief Type of private keys for Taler coins. The same key material is used - * for ECDSA and ECDHE operations. + * for EdDSA and ECDHE operations. */ -union TALER_CoinSpendPrivateKeyP +struct TALER_CoinSpendPrivateKeyP { /** - * Taler uses ECDSA for coins when signing deposit requests. - */ - struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_priv; - - /** - * Taler uses ECDHE for coin linkage during refresh operations. + * Taler uses EdDSA for coins when signing deposit requests. */ - struct GNUNET_CRYPTO_EcdhePrivateKey ecdhe_priv; + struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv; }; @@ -236,9 +228,9 @@ union TALER_CoinSpendPrivateKeyP struct TALER_CoinSpendSignatureP { /** - * Taler uses ECDSA for coins. + * Taler uses EdDSA for coins. */ - struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature; + struct GNUNET_CRYPTO_EddsaSignature eddsa_signature; }; @@ -302,7 +294,7 @@ struct TALER_CoinPublicInfo /** * The coin's public key. */ - union TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_CoinSpendPublicKeyP coin_pub; /** * Public key representing the denomination of the coin @@ -383,7 +375,7 @@ struct TALER_RefreshLinkDecrypted /** * Private key of the coin. */ - union TALER_CoinSpendPrivateKeyP coin_priv; + struct TALER_CoinSpendPrivateKeyP coin_priv; /** * Blinding key. @@ -416,7 +408,7 @@ struct TALER_RefreshLinkEncrypted /** * Encrypted private key of the coin. */ - char coin_priv_enc[sizeof (union TALER_CoinSpendPrivateKeyP)]; + char coin_priv_enc[sizeof (struct TALER_CoinSpendPrivateKeyP)]; }; @@ -427,7 +419,7 @@ struct TALER_RefreshLinkEncrypted * private key and the coin's public key. * * @param secret_enc encrypted link secret - * @param transfer_priv transfer private key + * @param trans_priv transfer private key * @param coin_pub coin public key * @param[out] secret set to the shared secret * @return #GNUNET_OK on success, #GNUNET_SYSERR on error @@ -435,7 +427,7 @@ struct TALER_RefreshLinkEncrypted int TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc, const struct TALER_TransferPrivateKeyP *trans_priv, - const union TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_LinkSecretP *secret); @@ -445,7 +437,7 @@ TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc, * public key and the coin's private key. * * @param secret_enc encrypted link secret - * @param transfer_pub transfer public key + * @param trans_pub transfer public key * @param coin_priv coin private key * @param[out] secret set to the shared secret * @return #GNUNET_OK on success, #GNUNET_SYSERR on error @@ -453,7 +445,7 @@ TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc, int TALER_link_decrypt_secret2 (const struct TALER_EncryptedLinkSecretP *secret_enc, const struct TALER_TransferPublicKeyP *trans_pub, - const union TALER_CoinSpendPrivateKeyP *coin_priv, + const struct TALER_CoinSpendPrivateKeyP *coin_priv, struct TALER_LinkSecretP *secret); @@ -463,14 +455,14 @@ TALER_link_decrypt_secret2 (const struct TALER_EncryptedLinkSecretP *secret_enc, * * @param secret link secret to encrypt * @param coin_pub coin public key - * @param transfer_priv[out] set to transfer private key - * @param transfer_pub[out] set to transfer public key + * @param[out] trans_priv set to transfer private key + * @param[out] trans_pub set to transfer public key * @param[out] secret_enc set to the encryptd @a secret * @return #GNUNET_OK on success, #GNUNET_SYSERR on error */ int TALER_link_encrypt_secret (const struct TALER_LinkSecretP *secret, - const union TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_TransferPrivateKeyP *trans_priv, struct TALER_TransferPublicKeyP *trans_pub, struct TALER_EncryptedLinkSecretP *secret_enc); diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index 7e095568..ede2a20e 100644 --- a/src/include/taler_json_lib.h +++ b/src/include/taler_json_lib.h @@ -65,18 +65,6 @@ TALER_json_from_eddsa_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpo /** - * Convert a signature (with purpose) to a JSON object representation. - * - * @param purpose purpose of the signature - * @param signature the signature - * @return the JSON reporesentation of the signature with purpose - */ -json_t * -TALER_json_from_ecdsa_sig (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, - const struct GNUNET_CRYPTO_EcdsaSignature *signature); - - -/** * Convert RSA public key to JSON. * * @param pk public key to convert @@ -109,17 +97,6 @@ TALER_json_from_data (const void *data, size_t size); /** - * Convert binary hash to a JSON string with the base32crockford - * encoding. - * - * @param hc binary data - * @return json string that encodes @a hc - */ -json_t * -TALER_json_from_hash (const struct GNUNET_HashCode *hc); - - -/** * Parse given JSON object to Amount * * @param json the json object representing Amount @@ -154,6 +131,27 @@ TALER_json_to_data (json_t *json, void *out, size_t out_size); + +/** + * Convert JSON to RSA public key. + * + * @param pk JSON encoding to convert + * @return corresponding public key + */ +struct GNUNET_CRYPTO_rsa_PublicKey * +TALER_json_to_rsa_public_key (json_t *json); + + +/** + * Convert JSON to RSA signature. + * + * @param pk JSON encoding to convert + * @return corresponding signature + */ +struct GNUNET_CRYPTO_rsa_Signature * +TALER_json_to_rsa_signature (json_t *json); + + /** * Check if the given wire format JSON object is correctly formatted * diff --git a/src/include/taler_mint_service.h b/src/include/taler_mint_service.h index 4c71c002..4fd9a281 100644 --- a/src/include/taler_mint_service.h +++ b/src/include/taler_mint_service.h @@ -22,7 +22,6 @@ #define _TALER_MINT_SERVICE_H #include "taler_util.h" -#include <jansson.h> /** * @brief Handle to this library context diff --git a/src/include/taler_mintdb_lib.h b/src/include/taler_mintdb_lib.h index 646693de..739194a4 100644 --- a/src/include/taler_mintdb_lib.h +++ b/src/include/taler_mintdb_lib.h @@ -23,7 +23,6 @@ #ifndef TALER_MINTDB_LIB_H #define TALER_MINTDB_LIB_H -#include <gnunet/gnunet_util_lib.h> #include "taler_signatures.h" /** diff --git a/src/include/taler_mintdb_plugin.h b/src/include/taler_mintdb_plugin.h index ffa1b13d..6cc8fd76 100644 --- a/src/include/taler_mintdb_plugin.h +++ b/src/include/taler_mintdb_plugin.h @@ -23,8 +23,6 @@ #define TALER_MINTDB_PLUGIN_H #include <gnunet/gnunet_util_lib.h> -#include "taler_util.h" -#include "taler_signatures.h" #include "taler_mintdb_lib.h" @@ -685,7 +683,9 @@ struct TALER_MINTDB_Plugin /** * Insert a incoming transaction into reserves. New reserves are - * also created through this function. + * also created through this function. Note that this API call + * starts (and stops) its own transaction scope (so the application + * must not do so). * * @param cls the @e cls of this struct with the plugin-specific state * @param db the database connection handle @@ -704,7 +704,7 @@ struct TALER_MINTDB_Plugin const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *balance, const char *details, - const struct GNUNET_TIME_Absolute expiry); + struct GNUNET_TIME_Absolute expiry); /** @@ -1066,7 +1066,7 @@ struct TALER_MINTDB_Plugin struct TALER_MINTDB_LinkDataList * (*get_link_data_list) (void *cls, struct TALER_MINTDB_Session *sesssion, - const union TALER_CoinSpendPublicKeyP *coin_pub); + const struct TALER_CoinSpendPublicKeyP *coin_pub); /** @@ -1083,7 +1083,7 @@ struct TALER_MINTDB_Plugin /** * Obtain shared secret and transfer public key from the public key of * the coin. This information and the link information returned by - * #TALER_db_get_link() enable the owner of an old coin to determine + * @e get_link_data_list() enable the owner of an old coin to determine * the private keys of the new coins after the melt. * * @@ -1099,7 +1099,7 @@ struct TALER_MINTDB_Plugin int (*get_transfer) (void *cls, struct TALER_MINTDB_Session *sesssion, - const union TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_CoinSpendPublicKeyP *coin_pub, struct TALER_TransferPublicKeyP *transfer_pub, struct TALER_EncryptedLinkSecretP *shared_secret_enc); @@ -1111,7 +1111,7 @@ struct TALER_MINTDB_Plugin * @param sesssion database connection * @param lock lock operation * @return #GNUNET_YES if known, - * #GNUENT_NO if not, + * #GNUNET_NO if not, * #GNUNET_SYSERR on internal error */ int @@ -1147,7 +1147,7 @@ struct TALER_MINTDB_Plugin struct TALER_MINTDB_TransactionList * (*get_coin_transactions) (void *cls, struct TALER_MINTDB_Session *sesssion, - const union TALER_CoinSpendPublicKeyP *coin_pub); + const struct TALER_CoinSpendPublicKeyP *coin_pub); /** diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h index 148385c8..d030d9b7 100644 --- a/src/include/taler_pq_lib.h +++ b/src/include/taler_pq_lib.h @@ -108,7 +108,7 @@ struct TALER_PQ_QueryParam /** * End of query parameter specification. */ -#define TALER_PQ_QUERY_PARAM_END { TALER_PQ_QF_END, NULL, 0 } +#define TALER_PQ_query_param_end { TALER_PQ_QF_END, NULL, 0 } /** * Generate fixed-size query parameter with size given explicitly. @@ -116,7 +116,7 @@ struct TALER_PQ_QueryParam * @param x pointer to the query parameter to pass * @param s number of bytes of @a x to use for the query */ -#define TALER_PQ_QUERY_PARAM_PTR_SIZED(x,s) { TALER_PQ_QF_FIXED_BLOB, (x), (s) } +#define TALER_PQ_query_param_fixed_size(x,s) { TALER_PQ_QF_FIXED_BLOB, (x), (s) } /** @@ -125,7 +125,7 @@ struct TALER_PQ_QueryParam * * @param x pointer to the query parameter to pass. */ -#define TALER_PQ_QUERY_PARAM_PTR(x) { TALER_PQ_QF_VARSIZE_BLOB, x, sizeof (*(x)) } +#define TALER_PQ_query_param_auto_from_type(x) { TALER_PQ_QF_VARSIZE_BLOB, x, sizeof (*(x)) } /** @@ -137,7 +137,7 @@ struct TALER_PQ_QueryParam * @param x pointer to the query parameter to pass */ struct TALER_PQ_QueryParam -TALER_PQ_QUERY_PARAM_AMOUNT_NBO(const struct TALER_AmountNBO *x); +TALER_PQ_query_param_amount_nbo(const struct TALER_AmountNBO *x); /** @@ -149,7 +149,7 @@ TALER_PQ_QUERY_PARAM_AMOUNT_NBO(const struct TALER_AmountNBO *x); * @param x pointer to the query parameter to pass */ struct TALER_PQ_QueryParam -TALER_PQ_QUERY_PARAM_AMOUNT(const struct TALER_Amount *x); +TALER_PQ_query_param_amount(const struct TALER_Amount *x); /** @@ -159,7 +159,7 @@ TALER_PQ_QUERY_PARAM_AMOUNT(const struct TALER_Amount *x); * @param x the query parameter to pass. */ struct TALER_PQ_QueryParam -TALER_PQ_QUERY_PARAM_RSA_PUBLIC_KEY(const struct GNUNET_CRYPTO_rsa_PublicKey *x); +TALER_PQ_query_param_rsa_public_key(const struct GNUNET_CRYPTO_rsa_PublicKey *x); /** @@ -169,7 +169,7 @@ TALER_PQ_QUERY_PARAM_RSA_PUBLIC_KEY(const struct GNUNET_CRYPTO_rsa_PublicKey *x) * @param x the query parameter to pass */ struct TALER_PQ_QueryParam -TALER_PQ_QUERY_PARAM_RSA_SIGNATURE(const struct GNUNET_CRYPTO_rsa_Signature *x); +TALER_PQ_query_param_rsa_signature(const struct GNUNET_CRYPTO_rsa_Signature *x); /** @@ -179,7 +179,7 @@ TALER_PQ_QUERY_PARAM_RSA_SIGNATURE(const struct GNUNET_CRYPTO_rsa_Signature *x); * @param x pointer to the query parameter to pass */ struct TALER_PQ_QueryParam -TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME(struct GNUNET_TIME_Absolute x); +TALER_PQ_query_param_absolute_time(const struct GNUNET_TIME_Absolute *x); /** @@ -277,7 +277,7 @@ struct TALER_PQ_ResultSpec * * @return array last entry for the result specification to use */ -#define TALER_PQ_RESULT_SPEC_END { TALER_PQ_RF_END, NULL, 0, NULL, NULL } +#define TALER_PQ_result_spec_end { TALER_PQ_RF_END, NULL, 0, NULL, NULL } /** * We expect a fixed-size result, with size given explicitly @@ -287,7 +287,7 @@ struct TALER_PQ_ResultSpec * @param s number of bytes we should use in @a dst * @return array entry for the result specification to use */ -#define TALER_PQ_RESULT_SPEC_SIZED(name, dst, s) { TALER_PQ_RF_FIXED_BLOB, (void *) (dst), (s), (name), NULL } +#define TALER_PQ_result_spec_fixed_size(name, dst, s) { TALER_PQ_RF_FIXED_BLOB, (void *) (dst), (s), (name), NULL } /** @@ -297,7 +297,7 @@ struct TALER_PQ_ResultSpec * @param dst point to where to store the result, type fits expected result size * @return array entry for the result specification to use */ -#define TALER_PQ_RESULT_SPEC(name, dst) { TALER_PQ_RF_VARSIZE_BLOB, (void *) dst, sizeof (*(dst)), name, NULL } +#define TALER_PQ_result_spec_auto_from_type(name, dst) { TALER_PQ_RF_FIXED_BLOB, (void *) (dst), sizeof (*(dst)), name, NULL } /** @@ -309,9 +309,9 @@ struct TALER_PQ_ResultSpec * @return array entry for the result specification to use */ struct TALER_PQ_ResultSpec -TALER_PQ_RESULT_SPEC_VAR (const char *name, - void **dst, - size_t *sptr); +TALER_PQ_result_spec_variable_size (const char *name, + void **dst, + size_t *sptr); /** @@ -322,7 +322,7 @@ TALER_PQ_RESULT_SPEC_VAR (const char *name, * @return array entry for the result specification to use */ struct TALER_PQ_ResultSpec -TALER_PQ_RESULT_SPEC_AMOUNT_NBO (const char *name, +TALER_PQ_result_spec_amount_nbo (const char *name, struct TALER_AmountNBO *amount); @@ -334,7 +334,7 @@ TALER_PQ_RESULT_SPEC_AMOUNT_NBO (const char *name, * @return array entry for the result specification to use */ struct TALER_PQ_ResultSpec -TALER_PQ_RESULT_SPEC_AMOUNT (const char *name, +TALER_PQ_result_spec_amount (const char *name, struct TALER_Amount *amount); @@ -346,7 +346,7 @@ TALER_PQ_RESULT_SPEC_AMOUNT (const char *name, * @return array entry for the result specification to use */ struct TALER_PQ_ResultSpec -TALER_PQ_RESULT_SPEC_RSA_PUBLIC_KEY (const char *name, +TALER_PQ_result_spec_rsa_public_key (const char *name, struct GNUNET_CRYPTO_rsa_PublicKey **rsa); @@ -358,7 +358,7 @@ TALER_PQ_RESULT_SPEC_RSA_PUBLIC_KEY (const char *name, * @return array entry for the result specification to use */ struct TALER_PQ_ResultSpec -TALER_PQ_RESULT_SPEC_RSA_SIGNATURE (const char *name, +TALER_PQ_result_spec_rsa_signature (const char *name, struct GNUNET_CRYPTO_rsa_Signature **sig); @@ -370,7 +370,7 @@ TALER_PQ_RESULT_SPEC_RSA_SIGNATURE (const char *name, * @return array entry for the result specification to use */ struct TALER_PQ_ResultSpec -TALER_PQ_RESULT_SPEC_ABSOLUTE_TIME (const char *name, +TALER_PQ_result_spec_absolute_time (const char *name, struct GNUNET_TIME_Absolute *at); @@ -394,7 +394,7 @@ TALER_PQ_exec_prepared (PGconn *db_conn, * is returned. * * @param result result to process - * @param[in|out] rs result specification to extract for + * @param[in,out] rs result specification to extract for * @param row row from the result to extract * @return * #GNUNET_YES if all results could be extracted diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index de6dbfc2..bc34c32e 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -123,16 +123,6 @@ /** - * ECDSA test signature. - */ -#define TALER_SIGNATURE_CLIENT_TEST_ECDSA 1300 - -/** - * ECDSA test signature. - */ -#define TALER_SIGNATURE_MINT_TEST_ECDSA 1301 - -/** * EdDSA test signature. */ #define TALER_SIGNATURE_CLIENT_TEST_EDDSA 1302 @@ -207,7 +197,7 @@ struct TALER_DepositRequestPS { /** * Purpose must be #TALER_SIGNATURE_WALLET_COIN_DEPOSIT. - * Used for an ECDSA signature with the `union TALER_CoinSpendPublicKeyP`. + * Used for an EdDSA signature with the `struct TALER_CoinSpendPublicKeyP`. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; @@ -283,9 +273,9 @@ struct TALER_DepositRequestPS /** * The coin's public key. This is the value that must have been * signed (blindly) by the Mint. The deposit request is to be - * signed by the corresponding private key (using ECDSA). + * signed by the corresponding private key (using EdDSA). */ - union TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_CoinSpendPublicKeyP coin_pub; }; @@ -341,9 +331,9 @@ struct TALER_DepositConfirmationPS /** * The coin's public key. This is the value that must have been * signed (blindly) by the Mint. The deposit request is to be - * signed by the corresponding private key (using ECDSA). + * signed by the corresponding private key (using EdDSA). */ - union TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_CoinSpendPublicKeyP coin_pub; /** * The Merchant's public key. Allows the merchant to later refund @@ -363,7 +353,7 @@ struct TALER_RefreshMeltCoinAffirmationPS { /** * Purpose is #TALER_SIGNATURE_WALLET_COIN_MELT. - * Used for an ECDSA signature with the `union TALER_CoinSpendPublicKeyP`. + * Used for an EdDSA signature with the `struct TALER_CoinSpendPublicKeyP`. */ struct GNUNET_CRYPTO_EccSignaturePurpose purpose; @@ -396,9 +386,9 @@ struct TALER_RefreshMeltCoinAffirmationPS /** * The coin's public key. This is the value that must have been * signed (blindly) by the Mint. The deposit request is to be - * signed by the corresponding private key (using ECDSA). + * signed by the corresponding private key (using EdDSA). */ - union TALER_CoinSpendPublicKeyP coin_pub; + struct TALER_CoinSpendPublicKeyP coin_pub; }; diff --git a/src/include/taler_util.h b/src/include/taler_util.h index cad89968..c9db9f78 100644 --- a/src/include/taler_util.h +++ b/src/include/taler_util.h @@ -108,7 +108,7 @@ TALER_config_get_denom (struct GNUNET_CONFIGURATION_Handle *cfg, * @return a pointer to the dir path (to be freed by the caller) */ char * -TALER_os_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind); +TALER_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind); /** |