aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-10-31 17:56:56 +0100
committerChristian Grothoff <christian@grothoff.org>2021-10-31 17:56:56 +0100
commit3eae999efc0cb923aebd2bf7214c5f4093217d4f (patch)
tree9581fa718e127a79779ee1a095d4e017549f2b5e /src/include
parentde8e0907aadecf4f97c0eb8230217751f3fd44a1 (diff)
distinguish between blind and non-blind denomination signatures
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_crypto_lib.h64
-rw-r--r--src/include/taler_exchange_service.h2
-rw-r--r--src/include/taler_exchangedb_plugin.h6
-rw-r--r--src/include/taler_json_lib.h29
-rw-r--r--src/include/taler_pq_lib.h25
5 files changed, 116 insertions, 10 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index af567ba02..69acfa0b3 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -524,6 +524,34 @@ struct TALER_DenominationSignature
/**
+ * @brief Type for *blinded* denomination signatures for Taler.
+ * Must be unblinded before it becomes valid.
+ */
+struct TALER_BlindedDenominationSignature
+{
+
+ /**
+ * Type of the signature.
+ */
+ enum TALER_DenominationCipher cipher;
+
+ /**
+ * Details, depending on @e cipher.
+ */
+ union
+ {
+
+ /**
+ * If we use #TALER_DENOMINATION_RSA in @a cipher.
+ */
+ struct GNUNET_CRYPTO_RsaSignature *blinded_rsa_signature;
+
+ } details;
+
+};
+
+
+/**
* @brief Type of public signing keys for verifying blindly signed coins.
*/
struct TALER_DenominationPublicKey
@@ -663,6 +691,16 @@ TALER_denom_sig_free (struct TALER_DenominationSignature *denom_sig);
/**
+ * Free internals of @a denom_sig, but not @a denom_sig itself.
+ *
+ * @param[in] denom_sig signature to free
+ */
+void
+TALER_blinded_denom_sig_free (
+ struct TALER_BlindedDenominationSignature *denom_sig);
+
+
+/**
* Compute the hash of the given @a denom_pub.
*
* @param denom_pub public key to hash
@@ -698,6 +736,19 @@ TALER_denom_sig_deep_copy (struct TALER_DenominationSignature *denom_dst,
/**
+ * Make a (deep) copy of the given @a denom_src to
+ * @a denom_dst.
+ *
+ * @param[out] denom_dst target to copy to
+ * @param denom_str public key to copy
+ */
+void
+TALER_blinded_denom_sig_deep_copy (
+ struct TALER_BlindedDenominationSignature *denom_dst,
+ const struct TALER_BlindedDenominationSignature *denom_src);
+
+
+/**
* Compare two denomination public keys.
*
* @param denom1 first key
@@ -1014,11 +1065,12 @@ TALER_planchet_prepare (const struct TALER_DenominationPublicKey *dk,
* @return #GNUNET_OK on success
*/
enum GNUNET_GenericReturnValue
-TALER_planchet_to_coin (const struct TALER_DenominationPublicKey *dk,
- const struct GNUNET_CRYPTO_RsaSignature *blind_sig,
- const struct TALER_PlanchetSecretsP *ps,
- const struct TALER_CoinPubHash *c_hash,
- struct TALER_FreshCoin *coin);
+TALER_planchet_to_coin (
+ const struct TALER_DenominationPublicKey *dk,
+ const struct TALER_BlindedDenominationSignature *blind_sig,
+ const struct TALER_PlanchetSecretsP *ps,
+ const struct TALER_CoinPubHash *c_hash,
+ struct TALER_FreshCoin *coin);
/* ****************** Refresh crypto primitives ************* */
@@ -1215,7 +1267,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh);
* @return signature, the value inside the structure will be NULL on failure,
* see @a ec for details about the failure
*/
-struct TALER_DenominationSignature
+struct TALER_BlindedDenominationSignature
TALER_CRYPTO_helper_denom_sign (
struct TALER_CRYPTO_DenominationHelper *dh,
const struct TALER_DenominationHash *h_denom_pub,
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 6daa120d4..361956cbe 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1387,7 +1387,7 @@ typedef void
(*TALER_EXCHANGE_Withdraw2Callback) (
void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr,
- const struct GNUNET_CRYPTO_RsaSignature *blind_sig);
+ const struct TALER_BlindedDenominationSignature *blind_sig);
/**
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index aa67092ee..17df75281 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -696,9 +696,9 @@ struct TALER_EXCHANGEDB_CollectableBlindcoin
{
/**
- * Our signature over the (blinded) coin.
+ * Our (blinded) signature over the (blinded) coin.
*/
- struct TALER_DenominationSignature sig;
+ struct TALER_BlindedDenominationSignature sig;
/**
* Hash of the denomination key (which coin was generated).
@@ -1616,7 +1616,7 @@ struct TALER_EXCHANGEDB_RefreshRevealedCoin
/**
* Signature generated by the exchange over the coin (in blinded format).
*/
- struct TALER_DenominationSignature coin_sig;
+ struct TALER_BlindedDenominationSignature coin_sig;
};
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index e381a7a10..26df1f113 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -160,6 +160,21 @@ TALER_JSON_pack_denom_sig (
/**
* Generate packer instruction for a JSON field of type
+ * blinded denomination signature (that needs to be
+ * unblinded before it becomes valid).
+ *
+ * @param name name of the field to add to the object
+ * @param sig signature
+ * @return json pack specification
+ */
+struct GNUNET_JSON_PackSpec
+TALER_JSON_pack_blinded_denom_sig (
+ const char *name,
+ const struct TALER_BlindedDenominationSignature *sig);
+
+
+/**
+ * Generate packer instruction for a JSON field of type
* amount.
*
* @param name name of the field to add to the object
@@ -328,6 +343,20 @@ TALER_JSON_spec_denom_sig (const char *field,
/**
+ * Generate line in parser specification for a
+ * blinded denomination signature.
+ *
+ * @param field name of the field
+ * @param sig the blinded signature to initialize
+ * @return corresponding field spec
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_blinded_denom_sig (
+ const char *field,
+ struct TALER_BlindedDenominationSignature *sig);
+
+
+/**
* The expected field stores a possibly internationalized string.
* Internationalization means that there is another field "$name_i18n"
* which is an object where the keys are languages. If this is
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h
index 07057722a..6e69cdf6d 100644
--- a/src/include/taler_pq_lib.h
+++ b/src/include/taler_pq_lib.h
@@ -78,6 +78,18 @@ TALER_PQ_query_param_denom_sig (
/**
+ * Generate query parameter for a blinded denomination signature. Internally,
+ * the various attributes of the signature will be serialized into on
+ * variable-size BLOB.
+ *
+ * @param x pointer to the query parameter to pass
+ */
+struct GNUNET_PQ_QueryParam
+TALER_PQ_query_param_blinded_denom_sig (
+ const struct TALER_BlindedDenominationSignature *denom_sig);
+
+
+/**
* Generate query parameter for a JSON object (stored as a string
* in the DB). Note that @a x must really be a JSON object or array,
* passing just a value (string, integer) is not supported and will
@@ -169,6 +181,19 @@ TALER_PQ_result_spec_denom_sig (const char *name,
/**
+ * Blinded denomination signature expected.
+ *
+ * @param name name of the field in the table
+ * @param[out] denom_sig where to store the denomination signature
+ * @return array entry for the result specification to use
+ */
+struct GNUNET_PQ_ResultSpec
+TALER_PQ_result_spec_blinded_denom_sig (
+ const char *name,
+ struct TALER_BlindedDenominationSignature *denom_sig);
+
+
+/**
* json_t expected.
*
* @param name name of the field in the table