slightly better error generation on /refresh/reveal errors

This commit is contained in:
Christian Grothoff 2015-03-13 09:49:47 +01:00
parent 2f70806cfa
commit 968e4aa68f
4 changed files with 84 additions and 16 deletions

12
INSTALL
View File

@ -1,7 +1,7 @@
Installation Instructions Installation Instructions
************************* *************************
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
Inc. Inc.
Copying and distribution of this file, with or without modification, Copying and distribution of this file, with or without modification,
@ -12,8 +12,8 @@ without warranty of any kind.
Basic Installation Basic Installation
================== ==================
Briefly, the shell command `./configure && make && make install' Briefly, the shell commands `./configure; make; make install' should
should configure, build, and install this package. The following configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented `INSTALL' file but do not implement all of the features documented
@ -309,10 +309,9 @@ causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf limitation. Until the limitation is lifted, you can use an Autoconf bug. Until the bug is fixed you can use this workaround:
this workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation `configure' Invocation
====================== ======================
@ -368,3 +367,4 @@ operates.
`configure' also accepts some other, not widely useful, options. Run `configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details. `configure --help' for more details.

View File

@ -732,8 +732,12 @@ check_commitment (struct MHD_Connection *connection,
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"transfer keys do not match\n"); "transfer keys do not match\n");
return (MHD_YES == TALER_MINT_reply_external_error (connection, /* FIXME: return more specific error with original signature (#3712) */
"Transfer private key missmatch")) return (MHD_YES ==
TALER_MINT_reply_refresh_reveal_missmatch (connection,
off,
j,
"transfer key"))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
} }
@ -757,8 +761,9 @@ check_commitment (struct MHD_Connection *connection,
&shared_secret)) &shared_secret))
{ {
GNUNET_break (0); GNUNET_break (0);
return (MHD_YES == TALER_MINT_reply_internal_error (connection, return (MHD_YES ==
"Decryption error")) TALER_MINT_reply_internal_error (connection,
"Decryption error"))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
} }
@ -773,8 +778,12 @@ check_commitment (struct MHD_Connection *connection,
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"shared secrets do not match\n"); "shared secrets do not match\n");
return (MHD_YES == TALER_MINT_reply_external_error (connection, /* FIXME: return more specific error with original signature (#3712) */
"Shared secret missmatch")) return (MHD_YES ==
TALER_MINT_reply_refresh_reveal_missmatch (connection,
off,
j,
"transfer secret"))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
} }
} }
@ -843,9 +852,12 @@ check_commitment (struct MHD_Connection *connection,
"blind envelope does not match for kappa=%u, old=%d\n", "blind envelope does not match for kappa=%u, old=%d\n",
off, off,
(int) j); (int) j);
/* FIXME: return more specific error with exact offset */ /* FIXME: return more specific error with original signature (#3712) */
return (MHD_YES == TALER_MINT_reply_external_error (connection, return (MHD_YES ==
"Envelope missmatch")) TALER_MINT_reply_refresh_reveal_missmatch (connection,
off,
j,
"envelope"))
? GNUNET_NO : GNUNET_SYSERR; ? GNUNET_NO : GNUNET_SYSERR;
} }
GNUNET_free (buf); GNUNET_free (buf);

View File

@ -189,7 +189,6 @@ TALER_MINT_reply_external_error (struct MHD_Connection *connection,
} }
/** /**
* Send a response indicating an error committing a * Send a response indicating an error committing a
* transaction (concurrent interference). * transaction (concurrent interference).
@ -716,6 +715,39 @@ TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
} }
/**
* Send a response for a failed "/refresh/reveal", where the
* revealed value(s) do not match the original commitment.
*
* FIXME: should also include the client's signature over
* the original reveal operation and the data that was signed
* over eventually... (#3712)
*
* @param connection the connection to send the response to
* @param off offset in the array of kappa-commitments where
* the missmatch was detected
* @param j index of the coin for which the missmatch was
* detected
* @param missmatch_object name of the object that was
* bogus (i.e. "transfer key").
* @return a MHD result code
*/
int
TALER_MINT_reply_refresh_reveal_missmatch (struct MHD_Connection *connection,
unsigned int off,
unsigned int j,
const char *missmatch_object)
{
return TALER_MINT_reply_json_pack (connection,
MHD_HTTP_BAD_REQUEST,
"{s:s, s:i, s:i, s:s}",
"error", "commitment violation",
"offset", (int) off,
"index", (int) j,
"object", missmatch_object);
}
/** /**
* Send a response for "/refresh/link". * Send a response for "/refresh/link".
* *

View File

@ -297,6 +297,30 @@ TALER_MINT_reply_refresh_reveal_success (struct MHD_Connection *connection,
struct GNUNET_CRYPTO_rsa_Signature **sigs); struct GNUNET_CRYPTO_rsa_Signature **sigs);
/**
* Send a response for a failed "/refresh/reveal", where the
* revealed value(s) do not match the original commitment.
*
* FIXME: should also include the client's signature over
* the original reveal operation and the data that was signed
* over eventually... (#3712)
*
* @param connection the connection to send the response to
* @param off offset in the array of kappa-commitments where
* the missmatch was detected
* @param j index of the coin for which the missmatch was
* detected
* @param missmatch_object name of the object that was
* bogus (i.e. "transfer key").
* @return a MHD result code
*/
int
TALER_MINT_reply_refresh_reveal_missmatch (struct MHD_Connection *connection,
unsigned int off,
unsigned int j,
const char *missmatch_object);
/** /**
* Send a response for "/refresh/link". * Send a response for "/refresh/link".
* *