diff options
Diffstat (limited to 'src/scalarproduct/gnunet-service-scalarproduct-ecc.h')
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct-ecc.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc.h b/src/scalarproduct/gnunet-service-scalarproduct-ecc.h new file mode 100644 index 000000000..0a222a208 --- /dev/null +++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2015 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | 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 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file scalarproduct/gnunet-service-scalarproduct-ecc.h | ||
22 | * @brief scalarproduct service P2P messages | ||
23 | * @author Christian M. Fuchs | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef GNUNET_SERVICE_SCALARPRODUCT_ECC_H | ||
27 | #define GNUNET_SERVICE_SCALARPRODUCT_ECC_H | ||
28 | |||
29 | |||
30 | GNUNET_NETWORK_STRUCT_BEGIN | ||
31 | |||
32 | /** | ||
33 | * Message type passed from requesting service Alice to responding | ||
34 | * service Bob to initiate a request and make Bob participate in our | ||
35 | * protocol. Afterwards, Bob is expected to perform the set | ||
36 | * intersection with Alice. Once that has succeeded, Alice will | ||
37 | * send a `struct AliceCryptodataMessage *`. Bob is not expected | ||
38 | * to respond via CADET in the meantime. | ||
39 | */ | ||
40 | struct EccServiceRequestMessage | ||
41 | { | ||
42 | /** | ||
43 | * Type is #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_SESSION_INITIALIZATION | ||
44 | */ | ||
45 | struct GNUNET_MessageHeader header; | ||
46 | |||
47 | /** | ||
48 | * For alignment. Always zero. | ||
49 | */ | ||
50 | uint32_t reserved; | ||
51 | |||
52 | /** | ||
53 | * The transaction/session key used to identify a session | ||
54 | */ | ||
55 | struct GNUNET_HashCode session_id; | ||
56 | |||
57 | }; | ||
58 | |||
59 | |||
60 | /** | ||
61 | * Vector of ECC-encrypted values sent by Alice to Bob | ||
62 | * (after set intersection). Alice may send messages of this | ||
63 | * type repeatedly to transmit all values. | ||
64 | */ | ||
65 | struct EccAliceCryptodataMessage | ||
66 | { | ||
67 | /** | ||
68 | * Type is #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_ALICE_CRYPTODATA | ||
69 | */ | ||
70 | struct GNUNET_MessageHeader header; | ||
71 | |||
72 | /** | ||
73 | * How many elements we appended to this message? In NBO. | ||
74 | */ | ||
75 | uint32_t contained_element_count GNUNET_PACKED; | ||
76 | |||
77 | /** | ||
78 | * struct GNUNET_CRYPTO_EccPoint[contained_element_count] | ||
79 | */ | ||
80 | }; | ||
81 | |||
82 | |||
83 | /** | ||
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. | ||
89 | */ | ||
90 | struct EccBobCryptodataMessage | ||
91 | { | ||
92 | /** | ||
93 | * GNUNET message header with type | ||
94 | * #GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ECC_BOB_CRYPTODATA. | ||
95 | */ | ||
96 | struct GNUNET_MessageHeader header; | ||
97 | |||
98 | /** | ||
99 | * How many elements this individual message delivers (in NBO), | ||
100 | * always TWO. | ||
101 | */ | ||
102 | uint32_t contained_element_count GNUNET_PACKED; | ||
103 | |||
104 | /** | ||
105 | * The product of the g_i^{b_i} values. | ||
106 | */ | ||
107 | struct GNUNET_CRYPTO_EccPoint prod_g_i_b_i; | ||
108 | |||
109 | /** | ||
110 | * The product of the h_i^{b_i} values. | ||
111 | */ | ||
112 | struct GNUNET_CRYPTO_EccPoint prod_h_i_b_i; | ||
113 | |||
114 | }; | ||
115 | |||
116 | |||
117 | GNUNET_NETWORK_STRUCT_END | ||
118 | |||
119 | |||
120 | #endif | ||