|
|
@ -398,7 +398,6 @@ namespace garlic |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint16_t keyID = bufbe16toh (buf); buf += 2; // keyID
|
|
|
|
uint16_t keyID = bufbe16toh (buf); buf += 2; // keyID
|
|
|
|
bool newKey = flag & ECIESX25519_NEXT_KEY_REQUEST_REVERSE_KEY_FLAG; |
|
|
|
bool newKey = flag & ECIESX25519_NEXT_KEY_REQUEST_REVERSE_KEY_FLAG; |
|
|
|
m_SendReverseKey = true; |
|
|
|
|
|
|
|
if (!m_NextReceiveRatchet) |
|
|
|
if (!m_NextReceiveRatchet) |
|
|
|
m_NextReceiveRatchet.reset (new DHRatchet ()); |
|
|
|
m_NextReceiveRatchet.reset (new DHRatchet ()); |
|
|
|
else |
|
|
|
else |
|
|
@ -410,6 +409,7 @@ namespace garlic |
|
|
|
} |
|
|
|
} |
|
|
|
m_NextReceiveRatchet->keyID = keyID; |
|
|
|
m_NextReceiveRatchet->keyID = keyID; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
m_SendReverseKey = true; |
|
|
|
int tagsetID = 2*keyID; |
|
|
|
int tagsetID = 2*keyID; |
|
|
|
if (newKey) |
|
|
|
if (newKey) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -781,6 +781,8 @@ namespace garlic |
|
|
|
[[fallthrough]]; |
|
|
|
[[fallthrough]]; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
case eSessionStateEstablished: |
|
|
|
case eSessionStateEstablished: |
|
|
|
|
|
|
|
if (m_SendReverseKey && receiveTagset->GetTagSetID () == 2*m_NextReceiveRatchet->keyID) |
|
|
|
|
|
|
|
m_SendReverseKey = false; // tag received on new tagset
|
|
|
|
if (receiveTagset->IsNS ()) |
|
|
|
if (receiveTagset->IsNS ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// our of sequence NSR
|
|
|
|
// our of sequence NSR
|
|
|
@ -978,7 +980,6 @@ namespace garlic |
|
|
|
memcpy (payload + offset, m_NextReceiveRatchet->key->GetPublicKey (), 32); |
|
|
|
memcpy (payload + offset, m_NextReceiveRatchet->key->GetPublicKey (), 32); |
|
|
|
offset += 32; // public key
|
|
|
|
offset += 32; // public key
|
|
|
|
} |
|
|
|
} |
|
|
|
m_SendReverseKey = false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (m_SendForwardKey) |
|
|
|
if (m_SendForwardKey) |
|
|
|
{ |
|
|
|
{ |
|
|
|