-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_memzero
calls.This change is