|
28 | 28 | #include "JsonTranslator.h"
|
29 | 29 | #include "MeshCryptoInterface.h"
|
30 | 30 |
|
31 |
| -using EspnowProtocolInterpreter::espnowHashKeyLength; |
32 |
| -namespace TypeCast = MeshTypeConversionFunctions; |
| 31 | +namespace |
| 32 | +{ |
| 33 | + using EspnowProtocolInterpreter::hashKeyLength; |
| 34 | + namespace TypeCast = MeshTypeConversionFunctions; |
| 35 | +} |
33 | 36 |
|
34 |
| -EncryptedConnectionData::EncryptedConnectionData(const uint8_t peerStaMac[6], const uint8_t peerApMac[6], const uint64_t peerSessionKey, const uint64_t ownSessionKey, const uint8_t hashKey[espnowHashKeyLength]) |
| 37 | +EncryptedConnectionData::EncryptedConnectionData(const uint8_t peerStaMac[6], const uint8_t peerApMac[6], const uint64_t peerSessionKey, const uint64_t ownSessionKey, const uint8_t hashKey[hashKeyLength]) |
35 | 38 | : _peerSessionKey(peerSessionKey), _ownSessionKey(ownSessionKey)
|
36 | 39 | {
|
37 | 40 | std::copy_n(peerStaMac, 6, _peerStaMac);
|
38 | 41 | std::copy_n(peerApMac, 6, _peerApMac);
|
39 |
| - std::copy_n(hashKey, espnowHashKeyLength, _hashKey); |
| 42 | + std::copy_n(hashKey, hashKeyLength, _hashKey); |
40 | 43 | }
|
41 | 44 |
|
42 |
| -EncryptedConnectionData::EncryptedConnectionData(const uint8_t peerStaMac[6], const uint8_t peerApMac[6], const uint64_t peerSessionKey, const uint64_t ownSessionKey, const uint32_t duration, const uint8_t hashKey[espnowHashKeyLength]) |
| 45 | +EncryptedConnectionData::EncryptedConnectionData(const uint8_t peerStaMac[6], const uint8_t peerApMac[6], const uint64_t peerSessionKey, const uint64_t ownSessionKey, const uint32_t duration, const uint8_t hashKey[hashKeyLength]) |
43 | 46 | : EncryptedConnectionData(peerStaMac, peerApMac, peerSessionKey, ownSessionKey, hashKey)
|
44 | 47 | {
|
45 | 48 | setRemainingDuration(duration);
|
@@ -106,16 +109,16 @@ bool EncryptedConnectionData::connectedTo(const uint8_t *peerMac) const
|
106 | 109 | return false;
|
107 | 110 | }
|
108 | 111 |
|
109 |
| -void EncryptedConnectionData::setHashKey(const uint8_t hashKey[espnowHashKeyLength]) |
| 112 | +void EncryptedConnectionData::setHashKey(const uint8_t hashKey[hashKeyLength]) |
110 | 113 | {
|
111 | 114 | assert(hashKey != nullptr);
|
112 | 115 |
|
113 |
| - std::copy_n(hashKey, espnowHashKeyLength, _hashKey); |
| 116 | + std::copy_n(hashKey, hashKeyLength, _hashKey); |
114 | 117 | }
|
115 | 118 |
|
116 | 119 | uint8_t *EncryptedConnectionData::getHashKey(uint8_t *resultArray) const
|
117 | 120 | {
|
118 |
| - std::copy_n(_hashKey, espnowHashKeyLength, resultArray); |
| 121 | + std::copy_n(_hashKey, hashKeyLength, resultArray); |
119 | 122 | return resultArray;
|
120 | 123 | }
|
121 | 124 |
|
@@ -146,7 +149,7 @@ uint64_t EncryptedConnectionData::incrementSessionKey(const uint64_t sessionKey,
|
146 | 149 |
|
147 | 150 | void EncryptedConnectionData::incrementOwnSessionKey()
|
148 | 151 | {
|
149 |
| - setOwnSessionKey(incrementSessionKey(getOwnSessionKey(), _hashKey, EspnowProtocolInterpreter::espnowHashKeyLength)); |
| 152 | + setOwnSessionKey(incrementSessionKey(getOwnSessionKey(), _hashKey, EspnowProtocolInterpreter::hashKeyLength)); |
150 | 153 | }
|
151 | 154 |
|
152 | 155 | void EncryptedConnectionData::setDesync(const bool desync) { _desync = desync; }
|
|
0 commit comments