Skip to content
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

Merged
merged 6 commits into from
Sep 25, 2021
Merged

Pure rust asymmetric crypto #455

merged 6 commits into from
Sep 25, 2021

Conversation

kurnevsky
Copy link
Member

@kurnevsky kurnevsky commented Aug 21, 2021

libsodium no more

@kurnevsky kurnevsky mentioned this pull request Aug 21, 2021
4 tasks
@coveralls
Copy link

coveralls commented Aug 21, 2021

Pull Request Test Coverage Report for Build 1154040616

  • 3498 of 3780 (92.54%) changed or added relevant lines in 70 files are covered.
  • 1024 unchanged lines in 25 files lost coverage.
  • Overall coverage decreased (-7.6%) to 86.886%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tox_core/src/relay/links.rs 54 56 96.43%
tox_crypto/src/lib.rs 21 23 91.3%
tox_core/src/state_format/old.rs 10 13 76.92%
tox_core/src/relay/server/server.rs 41 46 89.13%
tox_core/src/relay/server/server_ext.rs 15 20 75.0%
tox_core/src/onion/client/paths_pool.rs 61 67 91.04%
tox_core/src/relay/client/client.rs 79 102 77.45%
tox_core/src/onion/client/mod.rs 517 543 95.21%
tox_core/src/relay/client/connections.rs 133 181 73.48%
tox_core/src/net_crypto/mod.rs 838 890 94.16%
Files with Coverage Reduction New Missed Lines %
tox_binary_io/src/lib.rs 1 91.67%
tox_core/src/dht/dht_node.rs 1 80.0%
tox_core/src/onion/client/nodes_pool.rs 1 87.8%
tox_core/src/relay/links.rs 1 97.75%
tox_core/src/state_format/old.rs 1 82.21%
tox_core/src/udp.rs 1 3.8%
tox_packet/src/messenger/msi.rs 1 79.1%
tox_core/src/io_tokio.rs 2 75.0%
tox_core/src/relay/server/client.rs 2 82.19%
tox_packet/src/dht/macros.rs 2 95.45%
Totals Coverage Status
Change from base Build 1077257580: -7.6%
Covered Lines: 14430
Relevant Lines: 16608

💛 - Coveralls

@kpp kpp requested review from suhr and kpp August 23, 2021 08:04
}

/* TODO
Use the following implementation when https://github.com/TokTok/c-toxcore/issues/1169 is fixed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fixed

Copy link
Member Author

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);
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

@kurnevsky kurnevsky Aug 23, 2021

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 :)

@@ -749,86 +735,4 @@ mod tests {
},
])
);

encode_decode_test!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep it?

Copy link
Member Author

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.

Copy link
Member

@kpp kpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kurnevsky kurnevsky merged commit 8db9d69 into master Sep 25, 2021
@kurnevsky kurnevsky deleted the asymmetric branch September 25, 2021 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants