Files
zftpd/include
Seregon 28f8a1b9b0 Add ChaCha20 encryption (AUTH XCRYPT)
Introduce optional ChaCha20 stream encryption negotiated via AUTH XCRYPT.

- Add new crypto API and implementation: include/ftp_crypto.h and src/ftp_crypto.c implement a self-contained ChaCha20 context, keystream generation (chacha20_block), ftp_crypto_init/ftp_crypto_xor/ftp_crypto_reset and a simple PSK+nonce key derivation.
- Add compile-time toggle and default PSK in include/ftp_config.h (FTP_ENABLE_CRYPTO, platform-disabled for PS4/PS5). Default PSK provided but documented to be changed before production.
- Embed per-session crypto context in ftp_session_t (include/ftp_types.h). When crypto is disabled a small stub context is used to preserve layout.
- Add AUTH XCRYPT command handler and handshake in src/ftp_commands.c (formats 234 reply with nonce, derives session key, initializes crypto). FEAT advertises XCRYPT and the RETR fast-path (sendfile) is disabled when encryption is active so data can be XORed in userspace.
- Build integration: add src/ftp_crypto.c to Makefile.
- Misc: minor header doc formatting/cleanup.

This change enables per-session encrypted control+data when negotiated; clients that do not request AUTH XCRYPT remain plaintext. Compile-time flag allows disabling the feature on platforms where encryption is undesirable.
2026-02-19 01:41:24 +01:00
..