towards making code compile again
This commit is contained in:
parent
986a89ea4f
commit
bda9e3ad94
@ -754,7 +754,9 @@ TALER_MINT_DB_transaction (PGconn *db_conn)
|
|||||||
result = PQexec(db_conn, "BEGIN");
|
result = PQexec(db_conn, "BEGIN");
|
||||||
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Can't start transaction: %s\n", PQresultErrorMessage (result));
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"Can't start transaction: %s\n",
|
||||||
|
PQresultErrorMessage (result));
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
@ -775,28 +777,36 @@ TALER_MINT_DB_insert_refresh_order (PGconn *db_conn,
|
|||||||
const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub)
|
const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub)
|
||||||
{
|
{
|
||||||
uint16_t newcoin_index_nbo = htons (newcoin_index);
|
uint16_t newcoin_index_nbo = htons (newcoin_index);
|
||||||
struct TALER_DB_QueryParam params[] = {
|
char *buf;
|
||||||
TALER_DB_QUERY_PARAM_PTR(&newcoin_index_nbo),
|
size_t buf_size;
|
||||||
TALER_DB_QUERY_PARAM_PTR(session_pub),
|
PGresult *result;
|
||||||
TALER_DB_QUERY_PARAM_PTR(denom_pub),
|
|
||||||
TALER_DB_QUERY_PARAM_END
|
|
||||||
};
|
|
||||||
|
|
||||||
PGresult *result = TALER_DB_exec_prepared (db_conn, "insert_refresh_order", params);
|
buf_size = GNUNET_CRYPTO_rsa_public_key_encode (denom_pub,
|
||||||
|
&buf);
|
||||||
|
|
||||||
|
{
|
||||||
|
struct TALER_DB_QueryParam params[] = {
|
||||||
|
TALER_DB_QUERY_PARAM_PTR (&newcoin_index_nbo),
|
||||||
|
TALER_DB_QUERY_PARAM_PTR (session_pub),
|
||||||
|
TALER_DB_QUERY_PARAM_PTR_SIZED (buf, buf_size),
|
||||||
|
TALER_DB_QUERY_PARAM_END
|
||||||
|
};
|
||||||
|
result = TALER_DB_exec_prepared (db_conn,
|
||||||
|
"insert_refresh_order",
|
||||||
|
params);
|
||||||
|
}
|
||||||
|
GNUNET_free (buf);
|
||||||
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
break_db_err (result);
|
break_db_err (result);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != strcmp ("1", PQcmdTuples (result)))
|
if (0 != strcmp ("1", PQcmdTuples (result)))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
@ -817,7 +827,9 @@ TALER_MINT_DB_get_refresh_session (PGconn *db_conn,
|
|||||||
|
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Query failed: %s\n", PQresultErrorMessage (result));
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"Query failed: %s\n",
|
||||||
|
PQresultErrorMessage (result));
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
@ -885,7 +897,9 @@ TALER_MINT_DB_get_known_coin (PGconn *db_conn,
|
|||||||
|
|
||||||
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
if (PGRES_TUPLES_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Query failed: %s\n", PQresultErrorMessage (result));
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"Query failed: %s\n",
|
||||||
|
PQresultErrorMessage (result));
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
@ -915,11 +929,13 @@ TALER_MINT_DB_get_known_coin (PGconn *db_conn,
|
|||||||
|
|
||||||
/* extract the expended amount of the coin */
|
/* extract the expended amount of the coin */
|
||||||
|
|
||||||
if (GNUNET_OK != TALER_DB_extract_amount (result, 0,
|
if (GNUNET_OK !=
|
||||||
"expended_value",
|
TALER_DB_extract_amount (result,
|
||||||
"expended_fraction",
|
0,
|
||||||
"expended_currency",
|
"expended_value",
|
||||||
&known_coin->expended_balance))
|
"expended_fraction",
|
||||||
|
"expended_currency",
|
||||||
|
&known_coin->expended_balance))
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
@ -943,7 +959,9 @@ TALER_MINT_DB_get_known_coin (PGconn *db_conn,
|
|||||||
if (GNUNET_NO == res)
|
if (GNUNET_NO == res)
|
||||||
{
|
{
|
||||||
known_coin->is_refreshed = GNUNET_NO;
|
known_coin->is_refreshed = GNUNET_NO;
|
||||||
memset (&known_coin->refresh_session_pub, 0, sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
|
memset (&known_coin->refresh_session_pub,
|
||||||
|
0,
|
||||||
|
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1201,7 +1219,8 @@ TALER_MINT_DB_insert_refresh_commit_coin (PGconn *db_conn,
|
|||||||
int
|
int
|
||||||
TALER_MINT_DB_get_refresh_commit_link (PGconn *db_conn,
|
TALER_MINT_DB_get_refresh_commit_link (PGconn *db_conn,
|
||||||
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub,
|
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub,
|
||||||
int cnc_index, int oldcoin_index,
|
int cnc_index,
|
||||||
|
int oldcoin_index,
|
||||||
struct RefreshCommitLink *cc)
|
struct RefreshCommitLink *cc)
|
||||||
{
|
{
|
||||||
uint16_t cnc_index_nbo = htons (cnc_index);
|
uint16_t cnc_index_nbo = htons (cnc_index);
|
||||||
@ -1255,7 +1274,8 @@ TALER_MINT_DB_get_refresh_commit_link (PGconn *db_conn,
|
|||||||
int
|
int
|
||||||
TALER_MINT_DB_get_refresh_commit_coin (PGconn *db_conn,
|
TALER_MINT_DB_get_refresh_commit_coin (PGconn *db_conn,
|
||||||
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub,
|
const struct GNUNET_CRYPTO_EddsaPublicKey *refresh_session_pub,
|
||||||
int cnc_index, int newcoin_index,
|
int cnc_index,
|
||||||
|
int newcoin_index,
|
||||||
struct RefreshCommitCoin *cc)
|
struct RefreshCommitCoin *cc)
|
||||||
{
|
{
|
||||||
uint16_t cnc_index_nbo = htons (cnc_index);
|
uint16_t cnc_index_nbo = htons (cnc_index);
|
||||||
@ -1305,12 +1325,15 @@ TALER_MINT_DB_get_refresh_commit_coin (PGconn *db_conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
struct GNUNET_CRYPTO_rsa_PublicKey *
|
||||||
TALER_MINT_DB_get_refresh_order (PGconn *db_conn,
|
TALER_MINT_DB_get_refresh_order (PGconn *db_conn,
|
||||||
uint16_t newcoin_index,
|
uint16_t newcoin_index,
|
||||||
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub,
|
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub)
|
||||||
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub)
|
|
||||||
{
|
{
|
||||||
|
char *buf;
|
||||||
|
size_t buf_size;
|
||||||
|
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
|
||||||
uint16_t newcoin_index_nbo = htons (newcoin_index);
|
uint16_t newcoin_index_nbo = htons (newcoin_index);
|
||||||
|
|
||||||
struct TALER_DB_QueryParam params[] = {
|
struct TALER_DB_QueryParam params[] = {
|
||||||
@ -1325,31 +1348,30 @@ TALER_MINT_DB_get_refresh_order (PGconn *db_conn,
|
|||||||
{
|
{
|
||||||
break_db_err (result);
|
break_db_err (result);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == PQntuples (result))
|
if (0 == PQntuples (result))
|
||||||
{
|
{
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_NO;
|
/* FIXME: may want to distinguish between different error cases! */
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_assert (1 == PQntuples (result));
|
GNUNET_assert (1 == PQntuples (result));
|
||||||
|
|
||||||
struct TALER_DB_ResultSpec rs[] = {
|
struct TALER_DB_ResultSpec rs[] = {
|
||||||
TALER_DB_RESULT_SPEC("denom_pub", denom_pub),
|
TALER_DB_RESULT_SPEC_VAR ("denom_pub", &buf, &buf_size),
|
||||||
TALER_DB_RESULT_SPEC_END
|
TALER_DB_RESULT_SPEC_END
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GNUNET_OK != TALER_DB_extract_result (result, rs, 0))
|
if (GNUNET_OK != TALER_DB_extract_result (result, rs, 0))
|
||||||
{
|
{
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_OK;
|
denom_pub = GNUNET_CRYPTO_rsa_public_key_decode (buf, buf_size);
|
||||||
|
GNUNET_free (buf);
|
||||||
|
return denom_pub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1360,34 +1382,43 @@ TALER_MINT_DB_insert_refresh_collectable (PGconn *db_conn,
|
|||||||
const struct GNUNET_CRYPTO_rsa_Signature *ev_sig)
|
const struct GNUNET_CRYPTO_rsa_Signature *ev_sig)
|
||||||
{
|
{
|
||||||
uint16_t newcoin_index_nbo = htons (newcoin_index);
|
uint16_t newcoin_index_nbo = htons (newcoin_index);
|
||||||
struct TALER_DB_QueryParam params[] = {
|
char *buf;
|
||||||
TALER_DB_QUERY_PARAM_PTR(session_pub),
|
size_t buf_size;
|
||||||
TALER_DB_QUERY_PARAM_PTR(&newcoin_index_nbo),
|
PGresult *result;
|
||||||
TALER_DB_QUERY_PARAM_PTR(ev_sig),
|
|
||||||
TALER_DB_QUERY_PARAM_END
|
|
||||||
};
|
|
||||||
|
|
||||||
PGresult *result = TALER_DB_exec_prepared (db_conn, "insert_refresh_collectable", params);
|
|
||||||
|
|
||||||
|
buf_size = GNUNET_CRYPTO_rsa_signature_encode (ev_sig,
|
||||||
|
&buf);
|
||||||
|
{
|
||||||
|
struct TALER_DB_QueryParam params[] = {
|
||||||
|
TALER_DB_QUERY_PARAM_PTR(session_pub),
|
||||||
|
TALER_DB_QUERY_PARAM_PTR(&newcoin_index_nbo),
|
||||||
|
TALER_DB_QUERY_PARAM_PTR_SIZED(buf, buf_size),
|
||||||
|
TALER_DB_QUERY_PARAM_END
|
||||||
|
};
|
||||||
|
result = TALER_DB_exec_prepared (db_conn,
|
||||||
|
"insert_refresh_collectable",
|
||||||
|
params);
|
||||||
|
}
|
||||||
|
GNUNET_free (buf);
|
||||||
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
break_db_err (result);
|
break_db_err (result);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
struct GNUNET_CRYPTO_rsa_Signature *
|
||||||
TALER_MINT_DB_get_refresh_collectable (PGconn *db_conn,
|
TALER_MINT_DB_get_refresh_collectable (PGconn *db_conn,
|
||||||
uint16_t newcoin_index,
|
uint16_t newcoin_index,
|
||||||
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub,
|
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub)
|
||||||
struct GNUNET_CRYPTO_rsa_Signature *ev_sig)
|
|
||||||
{
|
{
|
||||||
|
struct GNUNET_CRYPTO_rsa_Signature *ev_sig;
|
||||||
|
char *buf;
|
||||||
|
size_t buf_size;
|
||||||
uint16_t newcoin_index_nbo = htons (newcoin_index);
|
uint16_t newcoin_index_nbo = htons (newcoin_index);
|
||||||
|
|
||||||
struct TALER_DB_QueryParam params[] = {
|
struct TALER_DB_QueryParam params[] = {
|
||||||
@ -1402,19 +1433,20 @@ TALER_MINT_DB_get_refresh_collectable (PGconn *db_conn,
|
|||||||
{
|
{
|
||||||
break_db_err (result);
|
break_db_err (result);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_SYSERR;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == PQntuples (result))
|
if (0 == PQntuples (result))
|
||||||
{
|
{
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_NO;
|
/* FIXME: may want to distinguish between different error cases! */
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_assert (1 == PQntuples (result));
|
GNUNET_assert (1 == PQntuples (result));
|
||||||
|
|
||||||
struct TALER_DB_ResultSpec rs[] = {
|
struct TALER_DB_ResultSpec rs[] = {
|
||||||
TALER_DB_RESULT_SPEC("ev_sig", ev_sig),
|
TALER_DB_RESULT_SPEC_VAR("ev_sig", &buf, &buf_size),
|
||||||
TALER_DB_RESULT_SPEC_END
|
TALER_DB_RESULT_SPEC_END
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1422,11 +1454,14 @@ TALER_MINT_DB_get_refresh_collectable (PGconn *db_conn,
|
|||||||
{
|
{
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return GNUNET_OK;
|
ev_sig = GNUNET_CRYPTO_rsa_signature_decode (buf,
|
||||||
|
buf_size);
|
||||||
|
GNUNET_free (buf);
|
||||||
|
return ev_sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1439,16 +1474,23 @@ TALER_MINT_DB_insert_refresh_melt (PGconn *db_conn,
|
|||||||
const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub)
|
const struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub)
|
||||||
{
|
{
|
||||||
uint16_t oldcoin_index_nbo = htons (oldcoin_index);
|
uint16_t oldcoin_index_nbo = htons (oldcoin_index);
|
||||||
struct TALER_DB_QueryParam params[] = {
|
char *buf;
|
||||||
TALER_DB_QUERY_PARAM_PTR(session_pub),
|
size_t buf_size;
|
||||||
TALER_DB_QUERY_PARAM_PTR(&oldcoin_index_nbo),
|
PGresult *result;
|
||||||
TALER_DB_QUERY_PARAM_PTR(coin_pub),
|
|
||||||
TALER_DB_QUERY_PARAM_PTR(denom_pub),
|
|
||||||
TALER_DB_QUERY_PARAM_END
|
|
||||||
};
|
|
||||||
|
|
||||||
PGresult *result = TALER_DB_exec_prepared (db_conn, "insert_refresh_melt", params);
|
|
||||||
|
|
||||||
|
buf_size = GNUNET_CRYPTO_rsa_public_key_encode (denom_pub,
|
||||||
|
&buf);
|
||||||
|
{
|
||||||
|
struct TALER_DB_QueryParam params[] = {
|
||||||
|
TALER_DB_QUERY_PARAM_PTR(session_pub),
|
||||||
|
TALER_DB_QUERY_PARAM_PTR(&oldcoin_index_nbo),
|
||||||
|
TALER_DB_QUERY_PARAM_PTR(coin_pub),
|
||||||
|
TALER_DB_QUERY_PARAM_PTR_SIZED(buf, buf_size),
|
||||||
|
TALER_DB_QUERY_PARAM_END
|
||||||
|
};
|
||||||
|
result = TALER_DB_exec_prepared (db_conn, "insert_refresh_melt", params);
|
||||||
|
}
|
||||||
|
GNUNET_free (buf);
|
||||||
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
break_db_err (result);
|
break_db_err (result);
|
||||||
@ -1541,12 +1583,16 @@ TALER_db_get_link (PGconn *db_conn,
|
|||||||
for (i = 0; i < PQntuples (result); i++)
|
for (i = 0; i < PQntuples (result); i++)
|
||||||
{
|
{
|
||||||
struct LinkDataEnc link_data_enc;
|
struct LinkDataEnc link_data_enc;
|
||||||
struct GNUNET_CRYPTO_rsa__PublicKey *denom_pub;
|
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub;
|
||||||
struct GNUNET_CRYPTO_rsa_Signature *sig;
|
struct GNUNET_CRYPTO_rsa_Signature *sig;
|
||||||
|
char *pk_buf;
|
||||||
|
size_t pk_buf_size;
|
||||||
|
char *sig_buf;
|
||||||
|
size_t sig_buf_size;
|
||||||
struct TALER_DB_ResultSpec rs[] = {
|
struct TALER_DB_ResultSpec rs[] = {
|
||||||
TALER_DB_RESULT_SPEC("link_vector_enc", &link_data_enc),
|
TALER_DB_RESULT_SPEC("link_vector_enc", &link_data_enc),
|
||||||
TALER_DB_RESULT_SPEC("denom_pub", &denom_pub),
|
TALER_DB_RESULT_SPEC_VAR("denom_pub", &pk_buf, &pk_buf_size),
|
||||||
TALER_DB_RESULT_SPEC("ev_sig", &ev_sig),
|
TALER_DB_RESULT_SPEC_VAR("ev_sig", &sig_buf, &sig_buf_size),
|
||||||
TALER_DB_RESULT_SPEC_END
|
TALER_DB_RESULT_SPEC_END
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1556,13 +1602,36 @@ TALER_db_get_link (PGconn *db_conn,
|
|||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
|
sig = GNUNET_CRYPTO_rsa_signature_decode (sig_buf,
|
||||||
if (GNUNET_OK != (res = link_iter (cls, &link_data_enc, &denom_pub, &ev_sig)))
|
sig_buf_size);
|
||||||
|
denom_pub = GNUNET_CRYPTO_rsa_public_key_decode (pk_buf,
|
||||||
|
pk_buf_size);
|
||||||
|
GNUNET_free (pk_buf);
|
||||||
|
GNUNET_free (sig_buf);
|
||||||
|
if ( (NULL == sig) ||
|
||||||
|
(NULL == denom_pub) )
|
||||||
|
{
|
||||||
|
PQclear (result);
|
||||||
|
if (NULL != denom_pub)
|
||||||
|
GNUNET_CRYPTO_rsa_public_key_free (denom_pub);
|
||||||
|
if (NULL != sig)
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (sig);
|
||||||
|
GNUNET_break (0);
|
||||||
|
return GNUNET_SYSERR;
|
||||||
|
}
|
||||||
|
if (GNUNET_OK != (res = link_iter (cls,
|
||||||
|
&link_data_enc,
|
||||||
|
denom_pub,
|
||||||
|
sig)))
|
||||||
{
|
{
|
||||||
GNUNET_assert (GNUNET_SYSERR != res);
|
GNUNET_assert (GNUNET_SYSERR != res);
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (sig);
|
||||||
|
GNUNET_CRYPTO_rsa_public_key_free (denom_pub);
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (sig);
|
||||||
|
GNUNET_CRYPTO_rsa_public_key_free (denom_pub);
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
@ -1742,6 +1811,7 @@ TALER_MINT_DB_insert_deposit (PGconn *db_conn,
|
|||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TALER_MINT_DB_get_deposit (PGconn *db_conn,
|
TALER_MINT_DB_get_deposit (PGconn *db_conn,
|
||||||
const struct GNUNET_CRYPTO_EddsaPublicKey *coin_pub,
|
const struct GNUNET_CRYPTO_EddsaPublicKey *coin_pub,
|
||||||
@ -1776,25 +1846,33 @@ TALER_MINT_DB_get_deposit (PGconn *db_conn,
|
|||||||
|
|
||||||
{
|
{
|
||||||
deposit = GNUNET_malloc (sizeof (struct Deposit)); /* Without wire data */
|
deposit = GNUNET_malloc (sizeof (struct Deposit)); /* Without wire data */
|
||||||
|
char *sig_buf;
|
||||||
|
size_t sig_buf_size;
|
||||||
|
char *dk_buf;
|
||||||
|
size_t dk_buf_size;
|
||||||
struct TALER_DB_ResultSpec rs[] = {
|
struct TALER_DB_ResultSpec rs[] = {
|
||||||
TALER_DB_RESULT_SPEC ("coin_pub", &deposit->coin_pub),
|
TALER_DB_RESULT_SPEC ("coin_pub", &deposit->coin_pub),
|
||||||
TALER_DB_RESULT_SPEC ("denom_pub", &deposit->denom_pub),
|
TALER_DB_RESULT_SPEC_VAR ("denom_pub", &dk_buf, &dk_buf_size),
|
||||||
TALER_DB_RESULT_SPEC ("coin_sig", &deposit->coin_sig),
|
TALER_DB_RESULT_SPEC_VAR ("coin_sig", &sig_buf, &sig_buf_size),
|
||||||
TALER_DB_RESULT_SPEC ("transaction_id", &deposit->transaction_id),
|
TALER_DB_RESULT_SPEC ("transaction_id", &deposit->transaction_id),
|
||||||
TALER_DB_RESULT_SPEC ("merchant_pub", &deposit->merchant_pub),
|
TALER_DB_RESULT_SPEC ("merchant_pub", &deposit->merchant_pub),
|
||||||
TALER_DB_RESULT_SPEC ("h_contract", &deposit->h_contract),
|
TALER_DB_RESULT_SPEC ("h_contract", &deposit->h_contract),
|
||||||
TALER_DB_RESULT_SPEC ("h_wire", &deposit->h_wire),
|
TALER_DB_RESULT_SPEC ("h_wire", &deposit->h_wire),
|
||||||
TALER_DB_RESULT_SPEC_END
|
TALER_DB_RESULT_SPEC_END
|
||||||
};
|
};
|
||||||
EXITIF (GNUNET_OK != TALER_DB_extract_result (result, rs, 0));
|
EXITIF (GNUNET_OK !=
|
||||||
EXITIF (GNUNET_OK != TALER_DB_extract_amount_nbo (result, 0,
|
TALER_DB_extract_result (result, rs, 0));
|
||||||
"amount_value",
|
EXITIF (GNUNET_OK !=
|
||||||
"amount_fraction",
|
TALER_DB_extract_amount_nbo (result, 0,
|
||||||
"amount_currency",
|
"amount_value",
|
||||||
&deposit->amount));
|
"amount_fraction",
|
||||||
deposit->purpose.purpose = htonl (TALER_SIGNATURE_DEPOSIT);
|
"amount_currency",
|
||||||
deposit->purpose.size = htonl (sizeof (struct Deposit)
|
&deposit->amount));
|
||||||
- offsetof (struct Deposit, purpose));
|
deposit->coin_sig = GNUNET_CRYPTO_rsa_signature_decode (sig_buf,
|
||||||
|
sig_buf_size);
|
||||||
|
deposit->denom_pub = GNUNET_CRYPTO_rsa_public_key_decode (dk_buf,
|
||||||
|
dk_buf_size);
|
||||||
|
// deposit->purpose = htonl (TALER_SIGNATURE_DEPOSIT); // FIXME: struct Deposit not nice
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear (result);
|
PQclear (result);
|
||||||
|
@ -154,11 +154,10 @@ TALER_MINT_DB_create_refresh_session (PGconn *db_conn,
|
|||||||
*session_pub);
|
*session_pub);
|
||||||
|
|
||||||
|
|
||||||
int
|
struct GNUNET_CRYPTO_rsa_PublicKey *
|
||||||
TALER_MINT_DB_get_refresh_order (PGconn *db_conn,
|
TALER_MINT_DB_get_refresh_order (PGconn *db_conn,
|
||||||
uint16_t newcoin_index,
|
uint16_t newcoin_index,
|
||||||
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub,
|
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub);
|
||||||
struct GNUNET_CRYPTO_rsa_PublicKey *denom_pub);
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -167,11 +166,12 @@ TALER_MINT_DB_insert_refresh_collectable (PGconn *db_conn,
|
|||||||
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub,
|
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub,
|
||||||
const struct GNUNET_CRYPTO_rsa_Signature *ev_sig);
|
const struct GNUNET_CRYPTO_rsa_Signature *ev_sig);
|
||||||
|
|
||||||
int
|
|
||||||
|
struct GNUNET_CRYPTO_rsa_Signature *
|
||||||
TALER_MINT_DB_get_refresh_collectable (PGconn *db_conn,
|
TALER_MINT_DB_get_refresh_collectable (PGconn *db_conn,
|
||||||
uint16_t newcoin_index,
|
uint16_t newcoin_index,
|
||||||
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub,
|
const struct GNUNET_CRYPTO_EddsaPublicKey *session_pub);
|
||||||
struct GNUNET_CRYPTO_rsa_Signature *ev_sig);
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -821,11 +821,10 @@ helper_refresh_reveal_send_response (struct MHD_Connection *connection,
|
|||||||
sizeof (struct GNUNET_CRYPTO_rsa_Signature *));
|
sizeof (struct GNUNET_CRYPTO_rsa_Signature *));
|
||||||
for (newcoin_index = 0; newcoin_index < refresh_session->num_newcoins; newcoin_index++)
|
for (newcoin_index = 0; newcoin_index < refresh_session->num_newcoins; newcoin_index++)
|
||||||
{
|
{
|
||||||
res = TALER_MINT_DB_get_refresh_collectable (db_conn,
|
sigs[newcoin_index] = TALER_MINT_DB_get_refresh_collectable (db_conn,
|
||||||
newcoin_index,
|
newcoin_index,
|
||||||
refresh_session_pub,
|
refresh_session_pub);
|
||||||
&sigs[newcoin_index]);
|
if (NULL == sigs[newcoin_index])
|
||||||
if (GNUNET_OK != res)
|
|
||||||
{
|
{
|
||||||
// FIXME: return 'internal error'
|
// FIXME: return 'internal error'
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
@ -1014,8 +1013,8 @@ TALER_MINT_db_execute_refresh_reveal (struct MHD_Connection *connection,
|
|||||||
// FIXME: return error code!
|
// FIXME: return error code!
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
}
|
}
|
||||||
res = TALER_MINT_DB_get_refresh_order (db_conn, j, refresh_session_pub, &denom_pub);
|
denom_pub = TALER_MINT_DB_get_refresh_order (db_conn, j, refresh_session_pub);
|
||||||
if (GNUNET_OK != res)
|
if (NULL == denom_pub)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
// FIXME: return error code!
|
// FIXME: return error code!
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "taler-mint-httpd_responses.h"
|
#include "taler-mint-httpd_responses.h"
|
||||||
#include "taler_json_lib.h"
|
#include "taler_json_lib.h"
|
||||||
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -393,7 +394,7 @@ TALER_MINT_reply_refresh_commit_success (struct MHD_Connection *connection,
|
|||||||
int
|
int
|
||||||
TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
|
TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
|
||||||
unsigned int num_newcoins,
|
unsigned int num_newcoins,
|
||||||
const struct GNUNET_CRYPTO_rsa_Signature *sigs)
|
const struct GNUNET_CRYPTO_rsa_Signature **sigs)
|
||||||
{
|
{
|
||||||
int newcoin_index;
|
int newcoin_index;
|
||||||
json_t *root;
|
json_t *root;
|
||||||
@ -406,7 +407,7 @@ TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
|
|||||||
json_object_set_new (root, "ev_sigs", list);
|
json_object_set_new (root, "ev_sigs", list);
|
||||||
for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++)
|
for (newcoin_index = 0; newcoin_index < num_newcoins; newcoin_index++)
|
||||||
{
|
{
|
||||||
buf_size = GNUNET_CRYPTO_rsa_signature_encode (&sigs[newcoin_index],
|
buf_size = GNUNET_CRYPTO_rsa_signature_encode (sigs[newcoin_index],
|
||||||
&buf);
|
&buf);
|
||||||
json_array_append_new (list,
|
json_array_append_new (list,
|
||||||
TALER_JSON_from_data (buf,
|
TALER_JSON_from_data (buf,
|
||||||
|
@ -209,7 +209,7 @@ TALER_MINT_reply_refresh_melt_success (struct MHD_Connection *connection,
|
|||||||
int
|
int
|
||||||
TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
|
TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
|
||||||
unsigned int num_newcoins,
|
unsigned int num_newcoins,
|
||||||
const struct GNUNET_CRYPTO_rsa_Signature *sigs);
|
const struct GNUNET_CRYPTO_rsa_Signature **sigs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,6 +28,11 @@
|
|||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "mint.h"
|
#include "mint.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FIXME: allow user to specify (within reason).
|
||||||
|
*/
|
||||||
|
#define RSA_KEYSIZE 2048
|
||||||
|
|
||||||
#define HASH_CUTOFF 20
|
#define HASH_CUTOFF 20
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -434,8 +439,8 @@ static void
|
|||||||
create_denomkey_issue (struct CoinTypeParams *params,
|
create_denomkey_issue (struct CoinTypeParams *params,
|
||||||
struct TALER_MINT_DenomKeyIssuePriv *dki)
|
struct TALER_MINT_DenomKeyIssuePriv *dki)
|
||||||
{
|
{
|
||||||
GNUNET_assert (NULL != (dki->denom_priv = GNUNET_CRYPTO_rsa_private_key_create ()));
|
GNUNET_assert (NULL != (dki->denom_priv = GNUNET_CRYPTO_rsa_private_key_create (RSA_KEYSIZE)));
|
||||||
dki->issue.denom_pub = GNUNET_CRYPTO_rsa_private_key_get_get_public (dki->denom_priv);
|
dki->issue.denom_pub = GNUNET_CRYPTO_rsa_private_key_get_public (dki->denom_priv);
|
||||||
dki->issue.master = *master_pub;
|
dki->issue.master = *master_pub;
|
||||||
dki->issue.start = GNUNET_TIME_absolute_hton (params->anchor);
|
dki->issue.start = GNUNET_TIME_absolute_hton (params->anchor);
|
||||||
dki->issue.expire_withdraw =
|
dki->issue.expire_withdraw =
|
||||||
|
Loading…
Reference in New Issue
Block a user