Fixed a minor bug in how we were storing shared secrets we already
saw. We were checking for old secrets, then releasing all locks to check
the MAC and then inserting the secret into the map. If we received a
duplicate message while we were checking the MAC we could be tricked
into processing the package twice. Adding an additional check after
checking the MAC seems like a good tradeoff between speed and safety.
Fixed a minor bug in how we were storing shared secrets we already saw. We were checking for old secrets, then releasing all locks to check the MAC and then inserting the secret into the map. If we received a duplicate message while we were checking the MAC we could be tricked into processing the package twice. Adding an additional check after checking the MAC seems like a good tradeoff between speed and safety.