LE Server
An algorithm for decoding received messages and resync execution.
![](https://cyberuslabs.com/wp-content/uploads/2021/04/le_server.png)
Points’ description:
- LE Server module is initialized.
- The callback for receiving the decrypted messages is initialized.
- Looper is handling the upcoming messages from IoT Devices. The received message consists of 3 fields: caller id, MAC, payload
- Checks if the messages sender LE instance is already saved
- For new senders, there are created 2 identical LE Instances initiated with the secret key provided in point 1. One will serve as the backup buffer, and the other as the current LE state
- For already stored senders the LE states are retrieved
- Payload (the actual message) is decrypted and the MAC value is returned
- Program checks if the MAC received from the sender and the one returned from the decryption match
- Sends back the ‘success’ message
- Passes the decrypted message to the callback provided in point 2
- In case MAC’s do not match, we use the backup buffer retrieved in point 5.
- Signature check is performed like in point 8. but this time on the MAC returned from the backup buffer
- If MAC still does not match. The hard reset mechanism is employed;
- The information about the reset mechanism is sent back to the sender.