-
Notifications
You must be signed in to change notification settings - Fork 33
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
Pure rust asymmetric crypto #455
Conversation
} | ||
|
||
/* TODO | ||
Use the following implementation when https://github.com/TokTok/c-toxcore/issues/1169 is fixed. |
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.
It is fixed
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.
Fixed, but I'd leave it for another MR, because firstly we need to check how many nodes from tox network migrated to a new version.
|
||
/// `OnionRequest1` packet with encrypted payload from `OnionRequest` packet | ||
/// shouldn't be bigger than `ONION_MAX_PACKET_SIZE`. | ||
const ONION_MAX_PAYLOAD_SIZE: usize = ONION_MAX_PACKET_SIZE - (1 + NONCEBYTES + PUBLICKEYBYTES + ONION_RETURN_1_SIZE); |
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.
Do we really have to have NONCEBYTES but not PUBLICKEYBYTES? Why not create an alias to crypto_box::KEY_SIZE?
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.
To be honest I thought we had tox_crypto crate to be able to keep all these consts in one place.
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.
To be honest I thought we had tox_crypto crate to be able to keep all these consts in one place.
It didn't work this way because in tox we have both symmetric and asymmetric crypto, and different kind of hashes. So there are a lot of consts that have same or similar name, but we had here only consts for asymmetric crypto. I'd actually prefer not to redefine consts and import them directly from tox-crypto lib because this way we won't have a confusion - before we used both sodiumoxide and our redefined consts at the same time in different places. As for NONCEBYTES ryst-crypto just don't have a convenient const to use. But I can remove it as well - just using NonceSize::USIZE is good enough for me :)
5660ad4
to
040a0c9
Compare
040a0c9
to
cb7edf1
Compare
@@ -749,86 +735,4 @@ mod tests { | |||
}, | |||
]) | |||
); | |||
|
|||
encode_decode_test!( |
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.
Why not keep it?
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.
encode_decode_test compares result with Eq
, but it's not implemented for secret and precomputed keys.
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.
LGTM
libsodium no more