diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2016-07-06 14:56:14 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-07-06 14:56:14 +0200 |
commit | 4deee5eb1247b46d04c4ab8eeba52ca4e4db0567 (patch) | |
tree | 0ce15be1f4ca4bd52a62d6418fd6b1e7f5f5f5b8 /internals.h | |
parent | 39ff8cfaa4c0d90bfcd1f2a4a21f6bd498faec93 (diff) |
start with brandt.c
Diffstat (limited to 'internals.h')
-rw-r--r-- | internals.h | 81 |
1 files changed, 65 insertions, 16 deletions
diff --git a/internals.h b/internals.h index 1e6eb18..7dab0d6 100644 --- a/internals.h +++ b/internals.h @@ -25,22 +25,71 @@ #include <gcrypt.h> -struct AuctionData { - uint16_t n; /** The amount of bidders/agents */ - uint16_t k; /** The amount of possible prices */ - uint16_t i; /** Own agents index, only used when bidding */ - uint16_t b; /** Own bid */ - - gcry_mpi_t x; /** Own private additive key share */ - gcry_mpi_point_t *y; /** public multiplicative key shares, size: n */ - gcry_mpi_point_t Y; /** Shared public key */ - - gcry_mpi_point_t **alpha; /** alphas, size: n*k */ - gcry_mpi_point_t **beta; /** betas, size: n*k */ - - gcry_mpi_point_t ***gamma; /** gamma, size: n*n*k */ - gcry_mpi_point_t ***delta; /** delta, size: n*n*k */ - gcry_mpi_point_t ***phi; /** phi, size: n*n*k */ +#include "brandt.h" + + +enum rounds { + msg_init, + msg_bid, + msg_outcome, + msg_decrypt, + msg_last +}; + + +/** + * This struct describes an auction and has to be followed by #description_len + * bytes of arbitrary data where the description of the item to be sold is + * stored. */ +struct AuctionDescr { + /** The length of the description in bytes directly following this struct */ + uint32_t description_len; + + /** Auction type. 0 means first price Auction, >= 0 means M+1st price + * auction with an amount of m items being sold. */ + uint16_t m; + + /** Outcome type. 0 means private outcome, everything else means public + * outcome. */ + uint16_t outcome_public; + + /** The amount of possible prices */ + uint16_t price_range; +}; + + +struct BRANDT_Auction { + struct AuctionDescr *desc; /** pointer to the auction information */ + + BRANDT_CbBroadcast bcast; /** broadcast callback */ + BRANDT_CbUnicast ucast; /** unicast callback */ + BRANDT_CbResult result; /** result reporting callback */ + + int seller_mode; /** If 0 we are bidding, selling otherwise */ + enum rounds cur_round; /** The round we expect messages from */ + gcry_mpi_t round_progress; /** Stores which round messages were received */ + + uint16_t n; /** The amount of bidders/agents */ + uint16_t k; /** The amount of possible prices */ + uint16_t i; /** Own agents index, only used when bidding */ + uint16_t b; /** Own bid */ + + gcry_mpi_t x; /** Own private additive key share */ + gcry_mpi_point_t *y; /** public multiplicative key shares, size: n */ + gcry_mpi_point_t Y; /** Shared public key */ + + gcry_mpi_point_t **alpha; /** alphas, size: n*k */ + gcry_mpi_point_t **beta; /** betas, size: n*k */ + + gcry_mpi_point_t **gamma2; /** gamma2, for public outcome, size: n*k */ + gcry_mpi_point_t ***gamma3; /** gamma3, for private outcome, size: n*n*k */ + gcry_mpi_point_t **delta2; /** delta2, for public outcome, size: n*k */ + gcry_mpi_point_t ***delta3; /** delta3, for private outcome, size: n*n*k */ + gcry_mpi_point_t **phi2; /** phi2, for public outcome, size: n*k */ + gcry_mpi_point_t ***phi3; /** phi3, for private outcome, size: n*n*k */ + + gcry_mpi_point_t *tmpa1; /** used for temporary storage, size: k */ + gcry_mpi_point_t *tmpb1; /** used for temporary storage, size: k */ }; #endif /* ifndef _BRANDT_INTERNALS_H */ |