mesh: Rework msg_cache
mesh: Rework msg_cache

Changes the behavior of the message cache to optimize for cache
capacity. Previously, the message cache's primary function was to avoid
decrypting messages multiple times, although the cache's main function
in the spec is to avoid message rebroadcasting. Optimizing for minimal
decryption causes us to fill the network cache faster, which in turn
causes more cache misses, potentially outweighing the advantage.

Now stores src + seq in message cache instead of field hash value. This
cuts cache size in two, while including more of the sequence number than
before.

Adds messages to the cache only after the packet is successfully
decrypted. This reduces noise in the cache, and ensures that no
invalid deobfuscations are added.

Additionally, this fixes a bug where multiple calls to net_decrypt with
the same packet failed, as the message cache found its own entry from
the previous call.

this is port of 6238ed68e8bdb09afcc741435f5e010929d5953d

apache/mynewt-nimble,apache/mynewt-nimble,apache/mynewt-nimble,apache/mynewt-nimble,apache/mynewt-nimble