Skip to content

Commit f9bf3c5

Browse files
committed
Formally propose a transport-agnostic Cerberus
1 parent e64588f commit f9bf3c5

File tree

1 file changed

+149
-0
lines changed

1 file changed

+149
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
* Name: Transport_Agnosticism
2+
* Date: 2021-04-02
3+
* Pull Request: [#16](https://github.com/opencomputeproject/Security/pull/16)
4+
5+
# Objective
6+
7+
Cerberus currently mandates that its messages be exchanged over an MCTP bus,
8+
using a Microsoft-specific PCI vendor ID. This is a limitation for depoyments
9+
that might want to speak Cerberus over a completely different bus, such as
10+
SPI, I3C, exotic busses like NVME, or over plain old TCP or UDP for the
11+
purposes of conformance testing.
12+
13+
This RFC describes a "transport agnostic" model for Cerberus with the following
14+
goals:
15+
- The existing MCTP binding of the protocol works with minimal (or no) changes.
16+
- Cerberus can be used over an arbitrary transport layer without directly
17+
implementing special support for it in a generic Cerberus library.
18+
- References to MCTP in the Cerberus Challenge Protocol specification will be
19+
moved to an appendix, describing it as a possible option for transporting
20+
Cerberus.
21+
22+
# Proposal
23+
24+
"Transport agnostic" Cerberus specifies an *admissible transport* as any protocol
25+
or bus that satisfies a set of properties. These properties reflect the
26+
properties of MCTP already used by Cerberus.
27+
28+
1. An admissible transport is a mechanism for sending a *message* (a dynamically-\
29+
sized byffer of bytes) from one (not necesarily addressable) endpoint to
30+
another. In other words, the admissible transport is responsible for removing
31+
frames from packets and assembling them in sequence.
32+
33+
2. Each endpoint has a known *maximum message length*, measured in bytes. The
34+
transport is responsible for negotiating this parameter for each device a
35+
Cerberus device intends to speak to. This parameter must be made available
36+
to the Cerberus protocol but Cerberus itself does not negotiate it. This
37+
paramter must be at least 64 bytes.
38+
39+
3. Each message is either the request or response half of a Cerberus command, as
40+
defined in the Challenge Protocol. To uniquely identify the type of an
41+
incoming message, the binding of Cerberus to the admissible transport must
42+
specify a *transport-specific header* that contains at a minimum the folling
43+
parameters. How they are encoded is irrelevant to Cerberus, beyond that they
44+
be computable without recieving the entire incoming message:
45+
- The command type byte (as specified in the Challenge Protocol).
46+
- A single bit: whther this message is the request or response half of the
47+
command.
48+
- The length of the incoming message, in bytes.
49+
- Addressing information that determines which device sent the message
50+
(the actual contents of this information is irrelevant to Cerberus).
51+
52+
4. Messages are "addressed", in two respects:
53+
a. A server can take a request and reply to the original sender with a
54+
response, and a client can match up requests and their responses.
55+
b. Cerberus can use addressing information of unspecified format to
56+
construct requests to a specific device (this opaque addressing
57+
information could be present in a PCD, for example).
58+
59+
By construction, MCTP almost fulills the above requirements: it provides framing
60+
of a message of arbitrary size, and the PCIe Vendor command provides a location
61+
for the transport-specific header. Note that Cerberus itself performs the
62+
size negotiation at the moment, so that would be moved out of the Challenge
63+
Protocol and into the transport layer.
64+
65+
The above list is everything Cerberus needs: Cerberus can be spoken over any
66+
admissible transport with not change to the actual bytes present in the
67+
encoded messages.
68+
69+
# Specification Changelist
70+
71+
This RFC seeks the following changes to the Challenge Protocol spec:
72+
73+
- Chapter 3 (Protocol and Hierarchy) should be replaced with the list of
74+
requirements given above. We do not recommend using the above text
75+
exactly; instead, the new Chapter 3 should carefully elaborate each point,
76+
to make it possible for third parties to evaluate whether their chosen
77+
transport layer is admissible.
78+
79+
- The current contents of Chapter 3 should be moved into an appendix, provided
80+
as an example admissible transport layer for I2C connections. The same should
81+
be done for Section 8.1, which describes a legacy protocol built on top of
82+
SMBus.
83+
84+
- The first few sections of Chapter 6 should be modified to not reference MTCP,
85+
and instead refer to the abstract Cerberus header (request bit, type, length)
86+
derived from the transport-specific header.
87+
88+
- The MCTP-specific errors in Section 6.5 should be either removed, or made
89+
transport agnostic. For example, the packet/message length overflow errors
90+
should be handled at the transport protocol layer: in the case that a device
91+
sends a too-large packet, Cerberus should not be notified at all.
92+
93+
- Mentions of MCTP in Section 6.7 should be removed. The maximum message/packet
94+
size fields should be removed, since the transport layer should negotiate
95+
these while establishing a session, and pass the maximum message size field
96+
along to Cerberus.
97+
98+
- The same should be done for Section 6.13.
99+
100+
- The same should also be done for Section 6.18. Since the response makes
101+
reference to payload sizes, we recommend that, instead of replying with
102+
multiple messages of maximum size, we add a "continue" bit to the Get Log
103+
response. When this bit is set, the client must send another request, with
104+
the offset field increased by the length of the Get Log log contents field.
105+
106+
- The same applies to Sections 6.20, 6.23, and 6.31.
107+
108+
# Implementation Guidance
109+
110+
Manticore currently implements the above proposal via the following procedure:
111+
1. Recieve a vtable from the library user that provides a function for blocking
112+
until a request arrives from somewhere.
113+
114+
2. When that function returns, Manticore's machinery calls a different function
115+
in the vtable for parsing the parts of the transport-specific header it needs
116+
to select a message parser and handler (request bit and type byte).
117+
118+
3. Manticore calls into the appropriate parser, which calls a third function in
119+
the vtable that provides a `read(2)` interface over the message payload to
120+
parse the message.
121+
122+
4. Pass the parsed message into the appropriate request handler, which constructs
123+
a response.
124+
125+
5. Manticore then calls a fourth function in the vtable, passing along the type
126+
of the response, that instructs the transport to prepare for a response. Note
127+
that the original request contained addressing information that the vtable
128+
tracks and re-uses for addressing the reply.
129+
130+
6. The transport encodes a response header; Manticore's serializer calls into a
131+
`write(2)` interface to encode the response. The transport may packetize
132+
the response as its internal buffer fills up.
133+
134+
7. Manticore calls the final, sixth function to flush the response, sending the
135+
final packet.
136+
137+
As the author understands it, this is somewhat close to how the Microsoft
138+
implementation handles messages, although it calls the MCTP library directly
139+
rather than virtually.
140+
141+
Manticore's vtable interface can he found at
142+
https://github.com/lowRISC/manticore/blob/e7a532/src/net.rs#L126.
143+
144+
# Future Work
145+
146+
Transport security. This proposal does not cover removing the USB-C-based
147+
transport security from the Cerberus protocol, but we hope to give those
148+
details a similar treatment so that Cerberus can be spoken over transports
149+
which provide their own security such as TLS, QUIC, etc.

0 commit comments

Comments
 (0)