bool replay_cache_has_elem(uint16_t src, uint32_t seqno, uint8_t ivi) { for (uint_fast8_t i = 0; i < REPLAY_CACHE_ENTRIES; ++i) { if (m_replay_cache[ivi][i].src == src) { __LOG(LOG_SRC_TRANSPORT, LOG_LEVEL_INFO, "replay cache has elem %u, tag %u\n", m_replay_cache[ivi][i].seqno, seqno); if (m_replay_cache[ivi][i].seqno < seqno) { return false; } return true; } } /* Not to be added to cache unless successful application decrypt! */ return false; }
if m_replay_cache[ivi][i].seqno == 0xFFFFFF, then new message received and seqno == 0 or other value, Whether the message is valid ?
Because the seqno of the new message must be greater than the old seqno in the current code, is there any other code that will reset the m_replay_cache[ivi][i].seqno value ?