summaryrefslogtreecommitdiffstats
path: root/third_party/prio/prio/server.h
blob: ce549013ae974f448683e15b1dde5a9203d494d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (c) 2018, Henry Corrigan-Gibbs
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef __SERVER_H__
#define __SERVER_H__

#include "mparray.h"
#include "prg.h"
#include "share.h"

struct prio_total_share
{
  PrioServerId idx;
  MPArray data_shares;
};

struct prio_server
{
  const_PrioConfig cfg;
  PrioServerId idx;

  // Sever's private decryption key
  PrivateKey priv_key;

  // The accumulated data values from the clients.
  MPArray data_shares;

  // PRG used to generate randomness for checking the client
  // data packets. Both servers initialize this PRG with the
  // same shared seed.
  PRG prg;
};

struct prio_verifier
{
  PrioServer s;

  PrioPacketClient clientp;
  MPArray data_sharesB;
  MPArray h_pointsB;

  mp_int share_fR;
  mp_int share_gR;
  mp_int share_hR;
  mp_int share_out;
};

struct prio_packet_verify1
{
  mp_int share_d;
  mp_int share_e;
};

struct prio_packet_verify2
{
  mp_int share_out;
};

#endif /* __SERVER_H__ */