|
| 1 | +# HIDE Protocol Communication Layer |
| 2 | +We implement an extra communication layer between the I2C layer and the application layer, which we refer to as the HIDE protocol. The HIDE protocol ensures that all messages maintain confidentiality, integrity, authenticity, and non-replayability. We require all messages sent between the AP and the Component to use HIDE. |
| 3 | + |
| 4 | +HIDE effectively turns each application message into a three-way challenge-response handshake. The sender first initiates a message request. The receiver will then send a random, encrypted challenge. The sender will then decrypt the challenge, solve it, and encrypt the challenge response to be sent along with the actual message. To solve the challenge nonce, the sender must perform a bitwise XOR of `0x55` with each byte in the challenge nonce. |
| 5 | + |
| 6 | +We use the Authenticated Encryption (AE) cipher, [Ascon-128](https://ascon.iaik.tugraz.at/), for our cryptographic scheme. We chose Ascon since it was selected in the NIST Lightweight Cryptography competition and has a masked software implementation that has been tested against various power analysis and hardware attacks. |
| 7 | + |
| 8 | +We use Ascon's associated data feature to validate each message that uses encryption. The associated data is 8 bytes long, with the first 4 bytes being the component ID, the fifth byte being the HIDE message magic byte, and the last three bytes being null bytes. |
| 9 | + |
| 10 | +Each direction of communication uses a different symmetric encryption key, meaning there are two encryption keys: |
| 11 | + |
| 12 | +- $K_{AP,C}$ is the key for messages sent from the Application Processor to the Component. |
| 13 | +- $K_{C,AP}$ is the key for messages sent from the Component to the AP. |
| 14 | + |
| 15 | +Every AP and Component built from the same deployment will share the same keys. This allows any Component to communicate with an AP from the same deployment. |
| 16 | + |
| 17 | +## HIDE Secure Protocol |
| 18 | + |
| 19 | +```{.mermaid loc=img #fig:hide-secure caption="HIDE secure communications protocol"} |
| 20 | +sequenceDiagram |
| 21 | + participant AP as Device A<br />Application Processor<br />(or Component) |
| 22 | + participant C as Device B<br />Component<br />(or Application Processor) |
| 23 | +
|
| 24 | + AP ->> C: HIDE_PKT_REQ_SECURE |
| 25 | +
|
| 26 | + Note over C: Generates a challenge nonce |
| 27 | +
|
| 28 | + C ->> AP: (HIDE_PKT_CHAL_SEND) |
| 29 | + C -->> AP: (Unencrypted): Ascon Nonce A |
| 30 | + C -->> AP: (Encrypted): Challenge Nonce |
| 31 | + C -->> AP: (Encrypted): Random bytes |
| 32 | + C -->> AP: (Unencrypted): Ascon Tag |
| 33 | +
|
| 34 | + Note over AP: Receives, decrypts, and <br/>solves the challenge nonce |
| 35 | +
|
| 36 | + AP ->> C: (HIDE_PKT_CHAL_RESP) |
| 37 | + AP -->> C: (Unencrypted): Ascon Nonce B |
| 38 | + AP -->> C: (Encrypted): Solved Challenge Nonce |
| 39 | + AP -->> C: (Encrypted): Message, padded with random bytes |
| 40 | + AP -->> C: (Unencrypted): Ascon Tag |
| 41 | +
|
| 42 | + alt Challenge Nonce Solve is Incorrect |
| 43 | + Note over C: Reset transaction |
| 44 | + end |
| 45 | +``` |
| 46 | + |
| 47 | +If at any point the encryption or decryption of a HIDE message using the Ascon cipher fails (such as invalidation due to message bit-flips or incorrect associated data), our secure communication functions will return an error. |
| 48 | + |
| 49 | +Messages sent using HIDE can have a length up to 80 bytes. When HIDE interfaces are being used in the post boot code, the message length is limited to 64 bytes and the message length is encoded as an 8-bit integer in the first byte of the message. The remaining bytes are padded with random bytes. MISC messages are also limited to 64 bytes in length. |
| 50 | + |
| 51 | +### HIDE_PKT_REQ_SECURE |
| 52 | +Sent by any device to initial a secure communication session with another device. This packet is unencrypted and contains the magic bytes corresponding to a secure request. |
| 53 | + |
| 54 | +| Name | Offset | Size (bytes) | Content | |
| 55 | +| --------- | ------ | ------------ | ----------- | |
| 56 | +| Magic | `0x00` | 10 | `\x40` * 10 | |
| 57 | + |
| 58 | +### HIDE_PKT_CHAL_SEND |
| 59 | +Sent by the receiver of a secure request to initiate the challenge-response handshake. This packet contains the Ascon Nonce, the encrypted challenge nonce, and random bytes for padding. |
| 60 | + |
| 61 | +| Name | Offset | Size (bytes) | Content | |
| 62 | +| ------------------------- | ------ | ------------ | ----------- | |
| 63 | +| Ascon Nonce | `0x00` | 16 | `\x?? * 16` | |
| 64 | +| Encrypted Challenge Nonce | `0x10` | 16 | `\x?? * 16` | |
| 65 | +| Encrypted Random Bytes | `0x20` | 80 | `\x?? * 80` | |
| 66 | +| Ascon Tag | `0x70` | 16 | `\x?? * 16` | |
| 67 | + |
| 68 | +> [!WARNING] |
| 69 | +> Ascon Nonce should be randomly uniquely generated for all messages |
| 70 | +
|
| 71 | +### CHAL_RESP |
| 72 | +Sent by the sender of a secure request to complete the challenge-response handshake. This packet contains the Ascon Nonce, the encrypted solved challenge nonce, and the message to be sent. |
| 73 | + |
| 74 | +| Name | Offset | Size (bytes) | Content | |
| 75 | +| -------------------------- | ------ | ------------ | ----------- | |
| 76 | +| Ascon Nonce | `0x00` | 16 | `\x?? * 16` | |
| 77 | +| Encrypted Solved Nonce | `0x10` | 16 | `\x?? * 16` | |
| 78 | +| Encrypted Message + Random | `0x20` | 80 | `\x?? * 80` | |
| 79 | +| Ascon Tag | `0x70` | 16 | `\x?? * 16` | |
| 80 | + |
| 81 | +> [!WARNING] |
| 82 | +> Ascon Nonce should be randomly uniquely generated for all messages |
| 83 | +
|
| 84 | +## HIDE List Protocol |
| 85 | + |
| 86 | +As part of the MISC system, we also must implement functionality to list all Components connected to the AP. We would use the HIDE secure protocol to enumerate I2C addresses and discover components, however, the HIDE secure protocol uses a Component's full ID as associated data during the encryption and decryption process. During this discovery process, we do not know the full ID of any Component with the exception of the Components which are provisioned for the AP. Even then, we cannot use these provisioned Component IDs in the case that a different valid Component shares the same I2C address. So, we decided to implement an extension to the HIDE protocol, which we refer to as the HIDE list protocol. This is only supported when the AP is communicating with a Component. |
| 87 | + |
| 88 | +The AP will send an unencrypted request packet which contains the magic bytes corresponding to a list request. The Component will then respond immediately with its 4-byte Component ID. |
| 89 | + |
| 90 | +```{.mermaid loc=img #fig:hide-list caption="HIDE list protocol"} |
| 91 | +sequenceDiagram |
| 92 | + participant AP as Application Processor |
| 93 | + AP ->> C: (Unencrypted): HIDE_PKT_REQ_LIST |
| 94 | + C ->> AP: (Unencrypted): Component ID |
| 95 | + participant C as Component |
| 96 | +``` |
0 commit comments