|
1 | 1 | // benches/curve25519.rs
|
2 |
| -use criterion::{black_box, criterion_group, criterion_main, Criterion}; |
| 2 | +use criterion::{Criterion, black_box, criterion_group, criterion_main}; |
3 | 3 | use drasyl_p2p::crypto::{
|
4 |
| - compute_kx_session_keys, |
5 |
| - convert_ed25519_pk_to_curve25519_pk, |
6 |
| - convert_ed25519_sk_to_curve25519_sk, |
7 |
| - generate_sign_keypair, |
8 |
| - AgreementPubKey, AgreementSecKey, SigningPubKey, SigningSecKey, SessionKey, |
| 4 | + AgreementPubKey, AgreementSecKey, SessionKey, SigningPubKey, SigningSecKey, |
| 5 | + compute_kx_session_keys, convert_ed25519_pk_to_curve25519_pk, |
| 6 | + convert_ed25519_sk_to_curve25519_sk, generate_sign_keypair, |
9 | 7 | };
|
10 | 8 | use libsodium_sys as sodium;
|
11 | 9 |
|
12 | 10 | fn sodium_init_once() {
|
13 | 11 | static ONCE: std::sync::Once = std::sync::Once::new();
|
14 |
| - ONCE.call_once(|| unsafe { let _ = sodium::sodium_init(); }); |
| 12 | + ONCE.call_once(|| unsafe { |
| 13 | + let _ = sodium::sodium_init(); |
| 14 | + }); |
15 | 15 | }
|
16 | 16 |
|
17 | 17 | // --- Helpers: neue Impl ausschließlich über crypto/mod.rs -------------------
|
@@ -67,11 +67,9 @@ fn bench_kx_session_keys(c: &mut Criterion) {
|
67 | 67 | // neue Impl: compute_kx_session_keys aus crypto/mod.rs
|
68 | 68 | group.bench_function("new-impl/kx", |b| {
|
69 | 69 | b.iter(|| {
|
70 |
| - let (rx, tx): (SessionKey, SessionKey) = compute_kx_session_keys( |
71 |
| - black_box(&my_pk), |
72 |
| - black_box(&my_sk), |
73 |
| - black_box(&peer_pk), |
74 |
| - ).unwrap(); |
| 70 | + let (rx, tx): (SessionKey, SessionKey) = |
| 71 | + compute_kx_session_keys(black_box(&my_pk), black_box(&my_sk), black_box(&peer_pk)) |
| 72 | + .unwrap(); |
75 | 73 | black_box((rx, tx));
|
76 | 74 | });
|
77 | 75 | });
|
|
0 commit comments