2 This file is part of GNUnet.
3 Copyright (C) 2013, 2014 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU 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.
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.
16 * @file scalarproduct/gnunet-service-scalarproduct.h
17 * @brief scalarproduct service P2P messages
18 * @author Christian M. Fuchs
19 * @author Christian Grothoff
21 #ifndef GNUNET_SERVICE_SCALARPRODUCT_H
22 #define GNUNET_SERVICE_SCALARPRODUCT_H
25 GNUNET_NETWORK_STRUCT_BEGIN
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.
35 struct ServiceRequestMessage
38 * Type is #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SESSION_INITIALIZATION
40 struct GNUNET_MessageHeader header;
43 * For alignment. Always zero.
48 * The transaction/session key used to identify a session
50 struct GNUNET_HashCode session_id;
55 struct GNUNET_CRYPTO_PaillierPublicKey public_key;
61 * Vector of Pallier-encrypted values sent by Alice to Bob
62 * (after set intersection). Alice may send messages of this
63 * type repeatedly to transmit all values.
65 struct AliceCryptodataMessage
68 * Type is #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_CRYPTODATA
70 struct GNUNET_MessageHeader header;
73 * How many elements we appended to this message? In NBO.
75 uint32_t contained_element_count GNUNET_PACKED;
78 * struct GNUNET_CRYPTO_PaillierCiphertext[contained_element_count]
84 * Message type passed from responding service Bob to responding
85 * service Alice to complete a request and allow Alice to compute the
86 * result. If Bob's reply does not fit into this one message, the
87 * conversation may be continued with `struct BobCryptodataMultipartMessage`
88 * messages afterwards.
90 struct BobCryptodataMessage
93 * GNUNET message header with type
94 * #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_CRYPTODATA.
96 struct GNUNET_MessageHeader header;
99 * How many elements this individual message delivers (in NBO).
101 uint32_t contained_element_count GNUNET_PACKED;
104 * followed by s | s' | k[i][perm]
110 * Multipart Message type passed between to supply additional elements
111 * for the peer. Send from Bob to Alice with additional elements
112 * of k[i][perm] after his `struct BobCryptodataMessage *`.
113 * Once all k-values have been transmitted, Bob is finished and
114 * Alice can transmit the final result to the client.
116 struct BobCryptodataMultipartMessage
119 * GNUNET message header
121 struct GNUNET_MessageHeader header;
124 * How many elements we supply within this message? In NBO.
126 uint32_t contained_element_count GNUNET_PACKED;
129 * Followed by `struct
130 * GNUNET_CRYPTO_PaillierCiphertext[contained_element_count]`
136 GNUNET_NETWORK_STRUCT_END