glitch in the license text detected by hyazinthe, thank you!
[oweals/gnunet.git] / src / scalarproduct / gnunet-service-scalarproduct-ecc.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2015 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      Affero General Public License for more details.
14  */
15 /**
16  * @file scalarproduct/gnunet-service-scalarproduct-ecc.h
17  * @brief scalarproduct service  P2P messages
18  * @author Christian M. Fuchs
19  * @author Christian Grothoff
20  */
21 #ifndef GNUNET_SERVICE_SCALARPRODUCT_ECC_H
22 #define GNUNET_SERVICE_SCALARPRODUCT_ECC_H
23
24
25 GNUNET_NETWORK_STRUCT_BEGIN
26
27 /**
28  * Message type passed from requesting service Alice to responding
29  * service Bob to initiate a request and make Bob participate in our
30  * protocol.  Afterwards, Bob is expected to perform the set
31  * intersection with Alice. Once that has succeeded, Alice will
32  * send a `struct AliceCryptodataMessage *`.  Bob is not expected
33  * to respond via CADET in the meantime.
34  */
35 struct EccServiceRequestMessage
36 {
37   /**
38    * Type is #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_SESSION_INITIALIZATION
39    */
40   struct GNUNET_MessageHeader header;
41
42   /**
43    * For alignment. Always zero.
44    */
45   uint32_t reserved;
46
47   /**
48    * The transaction/session key used to identify a session
49    */
50   struct GNUNET_HashCode session_id;
51
52 };
53
54
55 /**
56  * Vector of ECC-encrypted values sent by Alice to Bob
57  * (after set intersection).  Alice may send messages of this
58  * type repeatedly to transmit all values.
59  */
60 struct EccAliceCryptodataMessage
61 {
62   /**
63    * Type is #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_ALICE_CRYPTODATA
64    */
65   struct GNUNET_MessageHeader header;
66
67   /**
68    * How many elements we appended to this message? In NBO.
69    */
70   uint32_t contained_element_count GNUNET_PACKED;
71
72   /**
73    * struct GNUNET_CRYPTO_EccPoint[contained_element_count]
74    */
75 };
76
77
78 /**
79  * Message type passed from responding service Bob to responding
80  * service Alice to complete a request and allow Alice to compute the
81  * result.  If Bob's reply does not fit into this one message, the
82  * conversation may be continued with `struct BobCryptodataMultipartMessage`
83  * messages afterwards.
84  */
85 struct EccBobCryptodataMessage
86 {
87   /**
88    * GNUNET message header with type
89    * #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_BOB_CRYPTODATA.
90    */
91   struct GNUNET_MessageHeader header;
92
93   /**
94    * How many elements this individual message delivers (in NBO),
95    * always TWO.
96    */
97   uint32_t contained_element_count GNUNET_PACKED;
98
99   /**
100    * The product of the g_i^{b_i} values.
101    */
102   struct GNUNET_CRYPTO_EccPoint prod_g_i_b_i;
103
104   /**
105    * The product of the h_i^{b_i} values.
106    */
107   struct GNUNET_CRYPTO_EccPoint prod_h_i_b_i;
108
109 };
110
111
112 GNUNET_NETWORK_STRUCT_END
113
114
115 #endif