Skip to content

Commit 3c8de6e

Browse files
committed
Clarify pool ownership
1 parent 199e957 commit 3c8de6e

2 files changed

Lines changed: 35 additions & 13 deletions

File tree

TODO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
TODO: Update docs for new configurable items in config file and in client CLI
2+
13
TODO: Put .out files in a sub-directory
24

35
TODO: Error message if --client or --hub does not exist in configuration
46

5-
TODO: Add pool thresholds to configuration (and document this)
6-
77
TODO: Cleanup Shamir's Secret Sharing (SSS) code (no back-and-forth conversion to RawShare)
88

99
TODO: Move code coverage data files to subdirectory

docs/developer-guide.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,16 @@ The `Block` class has the following attributes:
192192
| data | bytes | The bytes in the block. |
193193
| used | bitarray | A bit for each byte in the block to indicate whether the byte is used (allocated). |
194194

195+
Once data is used (allocated), it is copied to a `Fragment` object;
196+
the original data is zeroed out in the `Block`.
197+
In some rare circumstances (having to do with error handling) a `Fragment` object
198+
can be put back into a `Block` in which case the data is copied back.
199+
200+
195201
### Class `Pool` ###
196202

197203
The class `Pool` represents a pool of Pre-Shared Random Data (PSRD) from which the DSKE code
198204
make do allocations (see class `Allocation` below).
199-
Once data is allocated, it is zeroed out in the `Pool`.
200205
Each pool has an owner (local or remote); the concept of pool ownership is explained below.
201206
The pools implemented as a sequence of PSRD blocks (`Block` objects).
202207

@@ -208,7 +213,6 @@ The `Pool` class has the following attributes:
208213
| blocks | List[Block] | A list of blocks in the pool. |
209214
| owner | local or remote | The owner of the pool (explained below). |
210215

211-
212216
### Class `Fragment`
213217

214218
The class `Fragment` represents a contiguous sequence of bytes within a block that have been
@@ -238,20 +242,38 @@ the `Allocation` class has the following attributes:
238242
|-|-|-|
239243
| fragments | List[Fragment] | The list of fragments that the allocation is composed of. |
240244

241-
242245
### The concept of block ownership
243246

244247
When a hub and a client share a block of Pre-Shared Random Data (PSRD) there is a `Block` object
245248
on the hub side and a `Block` object with the same random data on the client side.
246249
The hub and the client use their blocks to allocate secrets that are shared with their peer.
247250
These shared secrets are used for encryption and authentication of DSKE protocol messages.
248251

249-
In the code, allocating a shared secret means creating an `Allocation` object.
250-
This marks some bytes in some blocks as being allocated and consumed.
251-
Sharing a secret means sending the some information about the `Allocation` object to the peer:
252-
which bytes in which blocks have been allocated, but not the byte values themselves.
253-
The peer then uses this information to create a corresponding `Allocation` object with
254-
identical byte values.
252+
Both the client-side and the hub-side do allocate `Allocation` objects from `Pool` objects for
253+
the purpose of authenticating messages (HTTP requests and responses) and for encrypting key share
254+
data.
255+
256+
When one party sends a message to another party, the sender makes an allocation from it's local
257+
pool of PSRD.
258+
The sender uses the allocation to sign and possibly encrypt part of the message.
259+
The sender also sends the meta-data of the allocation to the receiver.
260+
does the allocation and sends
261+
When the receiver receives the meta-data, it allocates the exact same bytes from the
262+
receiver's copy of the PSRD.
263+
The receiver then uses the allocation to verify the signature and potentially decrypt part of
264+
the message.
265+
266+
In certain scenarios, there can be a race condition where the client and the hub both try to
267+
send a message at roughly the same time.
268+
Typically, the client sends a new HTTP request when the hub is still sending a response for
269+
the previous HTTP request.
270+
In such a race condition there is a risk of the client and the hub trying to allocate the exact
271+
same byte in the PSRD for two different purposes.
272+
273+
We introduced the concent of pool ownership to solve this problem.
274+
Each node has _two_ pools: a locally owned pool and a pool owned by the peer.
275+
Each node always makes allocations from the locally owned pool for sent messages.
276+
And each node always makes allocations from the pool owned by the peer for received messages.
255277

256278
## Message authentication
257279

@@ -260,9 +282,9 @@ it uses its own authentication and encryption mechanisms instead of relying on T
260282

261283
In-band DSKE protocol messages are signed using PSRD data for authentication.
262284

263-
The client signs outgoing HTTP request messages and the hub verifies the signature on incoming
285+
The _client_ signs outgoing HTTP request messages and the hub verifies the signature on incoming
264286
HTTP request messages.
265-
The hub signs outgoing HTTP response message and the client verifies the signature on incoming
287+
The _hub_ signs outgoing HTTP response message and the client verifies the signature on incoming
266288
HTTP response messages.
267289

268290
The sender of an HTTP message signs outgoing HTTP messages as follows:

0 commit comments

Comments
 (0)