1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-24 19:42:27 +03:00

- Make connectionQueue(), latestTransmissionOutcomes() and latestTransmissionSuccessful() methods static in order to match the underlying data storage.

- Make it possible to transfer elements directly between connectionQueues.

- Add defaultBSSID value.

- Fix bug where encrypted Espnow-connections expired 1 ms too late.

- Add MutexTracker::captureBan() functionality and use it in the espnowReceiveCallbackWrapper method to ensure a consistent mutex environment there.

- Rename acceptRequest to acceptRequests since several requests can be accepted, not just one.

- Reorganize EspnowMeshBackend.cpp.

- Split sendEspnowResponses() method into sendEspnowResponses() and sendPeerRequestConfirmations().

- Add sendStoredEspnowMessages() method to provide the same functionality as the previous version of sendEspnowResponses().

- Add logic for handling peerRequestConfirmations received at the same time as a peer request is being made, to avoid lockups when there are simultaneous cyclic peer requests.

- Add logic for handling simultaneous reciprocal peer requests.

- Include MAC addresses in HMAC calculations for peer requests and use HMAC for all unencrypted peer request messages, to make sure we receive valid MAC combinations.

- Add asserts to ensure ESP-NOW encryption integrity during code changes.

- Add estimatedMaxDuration argument to performEspnowMaintainance and related methods.

- Add methods to EncryptedConnectionData for setting peer MAC.

- Remove createEncryptionRequestMessage function from JsonTranslator since it is not used, to increase clarity.

- Add encryptedConnectionsSoftLimit() and related functionality.

- Add mutex to protect connectionQueue usage during attemptTransmission.

- Add _ongoingPeerRequestMac variable.

- Add reservedEncryptedConnections() method.

- Add TransmissionOutcomesUpdateHook() callback.

- Add constConnectionQueue() method to allow connectionQueue usage while connectionQueue mutex is active.

- Rearrange attemptAutoEncryptingTransmission argument order to increase efficiency.

- Add functionality for serializing the unencrypted ESP-NOW connection.

- Add some constness.

- Improve comments.

- Improve documentation.

- Update keywords.txt.
This commit is contained in:
Anders
2019-10-31 22:25:12 +01:00
parent b0ef9195b5
commit f8ec4f1c72
23 changed files with 981 additions and 533 deletions

View File

@ -30,6 +30,7 @@
namespace JsonTranslator
{
const String jsonConnectionState = "{\"connectionState\":{";
const String jsonPassword = "\"password\":";
const String jsonOwnSessionKey = "\"ownSK\":";
const String jsonPeerSessionKey = "\"peerSK\":";
@ -39,6 +40,8 @@ namespace JsonTranslator
const String jsonNonce = "\"nonce\":";
const String jsonHmac = "\"hmac\":";
const String jsonDesync = "\"desync\":";
const String jsonUnencryptedMessageID = "\"uMessageID\":";
const String jsonMeshMessageCount = "\"mMessageCount\":";
String createJsonPair(const String &valueIdentifier, const String &value);
String createJsonEndPair(const String &valueIdentifier, const String &value);
@ -47,12 +50,11 @@ namespace JsonTranslator
String createHmac(const String &message, const uint8_t *hashKey, uint8_t hashKeyLength);
bool verifyHmac(const String &message, const String &messageHmac, const uint8_t *hashKey, uint8_t hashKeyLength);
bool verifyHmac(const String &encryptionRequestHmacMessage, const uint8_t *hashKey, uint8_t hashKeyLength);
bool verifyEncryptionRequestHmac(const String &encryptionRequestHmacMessage, const uint8_t *requesterStaMac, const uint8_t *requesterApMac, const uint8_t *hashKey, uint8_t hashKeyLength);
String createEncryptedConnectionInfo(const String &requestNonce, const String &authenticationPassword, uint64_t ownSessionKey, uint64_t peerSessionKey);
String createEncryptedConnectionInfo(const String &infoHeader, const String &requestNonce, const String &authenticationPassword, uint64_t ownSessionKey, uint64_t peerSessionKey);
String createEncryptionRequestIntro(const String &requestHeader, uint32_t duration = 0);
String createEncryptionRequestEnding(const String &requestNonce);
String createEncryptionRequestMessage(const String &requestHeader, const String &requestNonce, uint32_t duration = 0);
String createEncryptionRequestHmacMessage(const String &requestHeader, const String &requestNonce, const uint8_t *hashKey, uint8_t hashKeyLength, uint32_t duration = 0);
/**
@ -76,6 +78,7 @@ namespace JsonTranslator
*/
int32_t getEndIndex(const String &jsonString, int32_t searchStartIndex);
bool getConnectionState(const String &jsonString, String &result);
/**
* Stores the value of the password field within jsonString into the result variable.
* No changes to the result variable are made if jsonString does not contain a password.
@ -104,6 +107,8 @@ namespace JsonTranslator
bool getNonce(const String &jsonString, String &result);
bool getHmac(const String &jsonString, String &result);
bool getDesync(const String &jsonString, bool &result);
bool getUnencryptedMessageID(const String &jsonString, uint32_t &result);
bool getMeshMessageCount(const String &jsonString, uint16_t &result);
}
#endif