progress
Some checks failed
Build and Test / puyopuyo (push) Failing after 26s
Build and Test / splatoon-testfire (push) Failing after 27s
Build and Test / minecraft-wiiu (push) Failing after 2m34s
Build and Test / fast-racing-neo (push) Failing after 2m36s
Build and Test / mario-tennis (push) Failing after 2m38s
Build and Test / splatoon (push) Failing after 2m38s
Build and Test / wii-u-chat (push) Failing after 5m25s
Build and Test / friends (push) Successful in 6m34s
Build and Test / super-mario-maker (push) Failing after 6m43s
Build and Test / sonic-transformed (push) Failing after 6m58s
Build and Test / wii-sports-club (push) Failing after 7m9s

This commit is contained in:
Maple Nebel 2026-07-13 23:47:15 +02:00
commit f1d16e40a1
36 changed files with 730 additions and 1392 deletions

View file

@ -3,13 +3,11 @@ use std::io::Write;
use hmac::Mac;
use md5::{Digest, Md5};
use rc4::{KeyInit, Rc4, StreamCipher};
use rnex_core::{
PID,
prudp::{
encryption::{DEFAULT_KEY, EncryptionPair},
types_flags::{TypesFlags, types::DATA},
},
use rnex_prudp::{
encryption::{DEFAULT_KEY, EncryptionPair},
types_flags::{TypesFlags, types::DATA},
};
use rnex_util::PID;
use typenum::U5;
use crate::crypto::{
@ -19,7 +17,7 @@ use crate::crypto::{
};
pub struct InsecureInstance {
pair: EncryptionPair<Rc4<U5>>,
pair: EncryptionPair<Rc4>,
self_signat: [u8; 4],
#[allow(dead_code)]
remote_signat: [u8; 4],
@ -41,8 +39,8 @@ impl CryptoInstance for InsecureInstance {
[0x78, 0x56, 0x34, 0x12]
} else {
let mut hash = Md5::new();
hash.write(ACCESS_KEY.as_bytes()).unwrap();
let mut hmac = <HmacMd5 as Mac>::new_from_slice(&hash.finalize().as_slice())
hash.update(ACCESS_KEY.as_bytes());
let mut hmac = HmacMd5::new_from_slice(&hash.finalize().as_slice())
.expect("unable to create hmac md5");
hmac.update(data);
hmac.finalize().into_bytes()[0..4].try_into().unwrap()
@ -57,7 +55,7 @@ pub struct Insecure();
impl Crypto for Insecure {
type Instance = InsecureInstance;
fn new() -> Self {
async fn new() -> Self {
Self()
}
fn calculate_checksum(&self, data: &[u8]) -> u8 {
@ -72,7 +70,9 @@ impl Crypto for Insecure {
) -> Option<(Self::Instance, Vec<u8>)> {
Some((
InsecureInstance {
pair: EncryptionPair::init_both(|| Rc4::new(&DEFAULT_KEY)),
pair: EncryptionPair::init_both(|| {
Rc4::new_from_slice(DEFAULT_KEY).expect("incorrect key size")
}),
self_signat,
remote_signat,
},

View file

@ -1,17 +1,13 @@
use hmac::Mac;
use md5::{Digest, Md5};
use rc4::{KeyInit, Rc4, StreamCipher};
use rnex_core::{
PID,
executables::common::SECURE_SERVER_ACCOUNT,
nex::account::Account,
prudp::{
encryption::EncryptionPair,
ticket::read_secure_connection_data,
types_flags::{TypesFlags, types::DATA},
},
rmc::structures::RmcSerialize,
use rnex_prudp::{
encryption::EncryptionPair,
ticket::read_secure_connection_data,
types_flags::{TypesFlags, types::DATA},
};
use rnex_rmc::serialization::RmcSerialize;
use rnex_util::{PID, account::Account};
use std::io::Write;
use typenum::U16;
@ -22,7 +18,7 @@ use crate::crypto::{
};
pub struct SecureInstance {
pair: EncryptionPair<Rc4<U16>>,
pair: EncryptionPair<Rc4>,
uid: PID,
self_signat: [u8; 4],
#[allow(dead_code)]
@ -45,8 +41,8 @@ impl CryptoInstance for SecureInstance {
[0x78, 0x56, 0x34, 0x12]
} else {
let mut hash = Md5::new();
hash.write(ACCESS_KEY.as_bytes()).unwrap();
let mut hmac = <HmacMd5 as Mac>::new_from_slice(&hash.finalize().as_slice())
hash.update(ACCESS_KEY.as_bytes());
let mut hmac = HmacMd5::new_from_slice(&hash.finalize().as_slice())
.expect("unable to create hmac md5");
hmac.update(data);
hmac.finalize().into_bytes()[0..4].try_into().unwrap()
@ -57,12 +53,16 @@ impl CryptoInstance for SecureInstance {
}
}
pub struct Secure(&'static Account);
pub struct Secure(Account);
impl Crypto for Secure {
type Instance = SecureInstance;
fn new() -> Self {
Self(&SECURE_SERVER_ACCOUNT)
async fn new() -> Self {
Self(
Account::from_nexact(2, "Quazal Rendez-Vous")
.await
.expect("unable to get account info"),
)
}
fn calculate_checksum(&self, data: &[u8]) -> u8 {
common_checksum(ACCESS_KEY, data)

View file

@ -1,5 +1,6 @@
use cfg_if::cfg_if;
use rnex_core::{PID, prudp::types_flags::TypesFlags};
use rnex_prudp::types_flags::TypesFlags;
use rnex_util::PID;
mod common_crypto;
@ -12,7 +13,7 @@ pub trait CryptoInstance: Send + 'static {
pub trait Crypto: Send + Sync + 'static {
type Instance: CryptoInstance;
fn new() -> Self;
async fn new() -> Self;
fn calculate_checksum(&self, data: &[u8]) -> u8;
fn instantiate(
&self,

View file

@ -1,7 +1,7 @@
use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "prudpv0")] {
use log::info;
use tracing::info;
use proxy_common::ProxyStartupParam;
use std::env;
use std::net::SocketAddrV4;

View file

@ -1,6 +1,5 @@
use bytemuck::{Pod, Zeroable, try_from_bytes, try_from_bytes_mut};
use log::{info, warn};
use rnex_core::prudp::{
use rnex_prudp::{
types_flags::{
TypesFlags,
flags::HAS_SIZE,
@ -8,6 +7,7 @@ use rnex_core::prudp::{
},
virtual_port::VirtualPort,
};
use tracing::{info, warn};
use crate::crypto::{Crypto, CryptoInstance};

View file

@ -5,24 +5,22 @@ use std::{
time::Duration,
};
use log::{error, info, warn};
use proxy_common::{ProxyStartupParam, new_backend_connection};
use rnex_core::{
prudp::{
socket_addr::PRUDPSockAddr,
types_flags::{
flags::{ACK, NEED_ACK, RELIABLE},
types::{CONNECT, DATA, DISCONNECT, PING, SYN},
},
use rnex_prudp::{
socket_addr::PRUDPSockAddr,
types_flags::{
flags::{ACK, NEED_ACK, RELIABLE},
types::{CONNECT, DATA, DISCONNECT, PING, SYN},
},
util::{SendingBufferConnection, SplittableBufferConnection},
};
use rnex_util::{SendingBufferConnection, SplittableBufferConnection};
use tokio::{
net::UdpSocket,
spawn,
sync::{Mutex, RwLock},
time::{Instant, sleep},
};
use tracing::{error, info, warn};
use crate::{
crypto::{Crypto, CryptoInstance},
@ -528,7 +526,7 @@ impl<C: Crypto> Server<C> {
.expect("unable to bind socket");
Self {
socket,
crypto: C::new(),
crypto: C::new().await,
connections: RwLock::new(HashMap::new()),
param,
}