gnunet-service-scalarproduct-ecc.h 3.1 KB

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