Refactor: Extract shared key cache into separate file#2317
Conversation
5454a89 to
5ee8e1f
Compare
Codecov Report
@@ Coverage Diff @@
## master #2317 +/- ##
==========================================
+ Coverage 78.08% 78.17% +0.09%
==========================================
Files 140 141 +1
Lines 31053 31097 +44
==========================================
+ Hits 24247 24311 +64
+ Misses 6806 6786 -20
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
baa56e3 to
d6cc0c5
Compare
d6cc0c5 to
dade188
Compare
dade188 to
23ceb2a
Compare
2a8f10f to
5b39a26
Compare
JFreegman
left a comment
There was a problem hiding this comment.
Reviewed 13 of 14 files at r1, all commit messages.
Reviewable status: 0 of 1 approvals obtained (waiting on @sudden6)
toxcore/announce.c line 438 at r1 (raw file):
VLA(uint8_t, plain, plain_len); const uint8_t* shared_key = shared_key_cache_lookup(announce->shared_keys, data_public_key);
shared_key_cache_lookup() can return null. Wouldn't it be better to do a null check on the return value immediately and log any errors, instead of propagating the null pointer to decrypt_data_symmetric() and obfuscating the error?
toxcore/shared_key_cache.h line 20 at r1 (raw file):
/** * @brief Initializes a new shared key cache
Missing period (a couple more in this file)
5b39a26 to
f97f888
Compare
sudden6
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 1 approvals obtained (waiting on @JFreegman)
toxcore/announce.c line 438 at r1 (raw file):
Previously, JFreegman wrote…
shared_key_cache_lookup()can return null. Wouldn't it be better to do a null check on the return value immediately and log any errors, instead of propagating the null pointer todecrypt_data_symmetric()and obfuscating the error?
Done.
toxcore/shared_key_cache.h line 20 at r1 (raw file):
Previously, JFreegman wrote…
Missing period (a couple more in this file)
Done.
JFreegman
left a comment
There was a problem hiding this comment.
Reviewed 5 of 5 files at r2, all commit messages.
Reviewable status:complete! 1 of 1 approvals obtained
ca4fd96 to
479875b
Compare
The exisiting implementation is not clearly documented and used by multiple modules.
479875b to
8c7d304
Compare
This removes the old and badly documented/designed shared key cache from DHT.c and moves the implemenation to a separate file. This makes it more testable and allows a better overview of how many caches exist (currently 7, total ~0,5MB). Additionally I think this fixes several missed
crypto_memzerocalls.This change is