From 57c90547840ea2a073c950116303c54f9ef976f1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 26 Dec 2020 15:55:34 +0100 Subject: implement #6161 --- src/exchangedb/plugin_exchangedb_postgres.c | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/exchangedb/plugin_exchangedb_postgres.c') diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 23e947875..4f49a219e 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1555,6 +1555,13 @@ postgres_get_session (void *cls) ") VALUES " "($1, $2);", 2), + /* used in #postgres_insert_signkey_revocation() */ + GNUNET_PQ_make_prepare ("lookup_signkey_revocation", + "SELECT " + " master_sig" + " FROM signkey_revocations" + " WHERE exchange_pub=$1;", + 1), /* used in #postgres_insert_signkey() */ GNUNET_PQ_make_prepare ("insert_signkey", "INSERT INTO exchange_sign_keys " @@ -8491,6 +8498,46 @@ postgres_insert_signkey_revocation ( } +/** + * Obtain information about a revoked online signing key. + * + * @param cls closure + * @param session a session (can be NULL) + * @param exchange_pub exchange online signing key + * @param[out] master_sig set to signature affirming the revocation (if revoked) + * @return transaction status code + */ +static enum GNUNET_DB_QueryStatus +postgres_lookup_signkey_revocation ( + void *cls, + struct TALER_EXCHANGEDB_Session *session, + const struct TALER_ExchangePublicKeyP *exchange_pub, + struct TALER_MasterSignatureP *master_sig) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_auto_from_type (exchange_pub), + GNUNET_PQ_query_param_end + }; + struct GNUNET_PQ_ResultSpec rs[] = { + TALER_PQ_result_spec_auto_from_type ("master_sig", + master_sig), + GNUNET_PQ_result_spec_end + }; + + (void) cls; + if (NULL == session) + session = postgres_get_session (pg); + if (NULL == session) + return GNUNET_DB_STATUS_HARD_ERROR; + + return GNUNET_PQ_eval_prepared_singleton_select (session->conn, + "lookup_signkey_revocation", + params, + rs); +} + + /** * Lookup information about current denomination key. * -- cgit v1.2.3