From 445486ccaae6cbe9c45adca11916a04969cdefd1 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Mon, 21 Sep 2026 12:30:10 +0800 Subject: [PATCH] tcp: drop box_pk_of until something calls it It has no caller here or in the servers; the responder that would keep only the secret half does not exist yet, so it belongs to that change. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab --- src/tcp.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/tcp.rs b/src/tcp.rs index f53302b37..2204c1c18 100644 --- a/src/tcp.rs +++ b/src/tcp.rs @@ -4,7 +4,7 @@ use bytes::{BufMut, Bytes, BytesMut}; use futures::{SinkExt, StreamExt}; use protobuf::Message; use sodiumoxide::crypto::{ - box_, generichash, scalarmult, + box_, generichash, secretbox::{self, Key, Nonce}, }; use std::{ @@ -56,11 +56,6 @@ pub struct KxTranscript<'a> { pub picked: u32, } -/// The public half of an X25519 secret key, for a responder that kept only the secret half. -pub fn box_pk_of(sk: &box_::SecretKey) -> box_::PublicKey { - box_::PublicKey(scalarmult::scalarmult_base(&scalarmult::Scalar(sk.0)).0) -} - /// The sending key, the send and receive counters, the receiving key where it differs, and /// the server's advertised version as this side saw it, while its echo is still awaited. #[derive(Clone)] @@ -618,10 +613,4 @@ mod tests { let mut later = BytesMut::from(&server.enc(&rendezvous_frame(KX_VERSION_LATEST + 9))[..]); client.dec(&mut later).unwrap(); } - - #[test] - fn test_box_pk_of_matches_the_generated_pair() { - let (pk, sk) = box_::gen_keypair(); - assert_eq!(box_pk_of(&sk), pk); - } }