David Miller (), responsible for the Linux kernel's network subsystem, into the net-next branch implementing a VPN interface from the project . Early next year, the changes accumulated in the net-next branch will form the basis for the Linux kernel 5.6 release.
Efforts to promote the WireGuard code into the mainline kernel have been made over the last few years, but these have remained unsuccessful due to reliance on custom implementations of cryptographic functions used to enhance performance. Initially, these functions were introduced to the kernel as an additional low-level API Zinc, which could eventually replace the standard Crypto API.
After discussions at the Kernel Recipes conference, the creators of WireGuard in September to transition their patches to use the existing Crypto API in the kernel, which the WireGuard developers have concerns about regarding performance and overall security. The Zinc API is planned to continue being developed as a separate project.
In November, the kernel developers a reciprocal compromise and agreed to incorporate part of the Zinc code into the main kernel. Essentially, some components of Zinc will be transferred to the kernel, but not as a separate API, rather as part of the Crypto API subsystem. For instance, in the Crypto API, the fast implementations of the ChaCha20 and Poly1305 algorithms prepared in WireGuard are already available.
In light of the upcoming inclusion of WireGuard in the main kernel, the project founder announced a restructuring of the repository. To simplify development, the monolithic repository 'WireGuard.git', which was designed for isolated existence, will be replaced by three separate repositories that are better suited for organizing code work in the main kernel:
- — a complete kernel tree with changes from the WireGuard project, whose patches will be reviewed for inclusion in the kernel and regularly merged into the net/net-next branches.
- — a repository for user-space utilities and scripts, such as wg and wg-quick. This repository can be used to create packages for distributions.
- — a repository with a version of the module supplied separately from the core and including a compat.h layer to ensure compatibility with older kernels. Main development will take place in the wireguard-linux.git repository, but as long as there is a need from users, a separate version of patches will also be supported in a working form.
Let us remind you that the WireGuard VPN is built on modern encryption methods, providing very high performance, simplicity of use, and a lack of complexity, and has proven itself in several large deployments handling significant traffic volumes. The project has been evolving since 2015, has passed an audit and of the employed encryption methods. Support for WireGuard has already been integrated into NetworkManager and systemd, and kernel patches are included in the base of the distributions , Mageia, Alpine, Arch, Gentoo, OpenWrt, NixOS, and .
WireGuard uses the concept of key-based routing, which implies binding a private key to each network interface and using it to link public keys. The exchange of public keys for establishing a connection is done similarly to SSH. Key agreement and connection establishment without launching a separate daemon in user space is achieved using the Noise_IK mechanism from , similar to maintaining authorized_keys in SSH. Data transmission is carried out through encapsulation in UDP packets. The switching of the VPN server's IP address (roaming) is supported without breaking the connection and with automatic client reconfiguration.
For encryption the stream cipher and the message authentication algorithm (MAC) , developed by Daniel Bernstein (), Tanja Lange
(Tanja Lange) and Peter Schwabe (Peter Schwabe). ChaCha20 and Poly1305 are presented as faster and safer alternatives to AES-256-CTR and HMAC, with software implementation allowing fixed execution time without requiring specialized hardware support. For generating a shared secret key, the elliptic curve Diffie-Hellman protocol is used, implemented in , also proposed by Daniel Bernstein. The hashing algorithm used is .
Upon WireGuard's performance demonstrated 3.9 times higher throughput and 3.8 times greater responsiveness compared to OpenVPN (256-bit AES with HMAC-SHA2-256). When compared to IPsec (256-bit ChaCha20+Poly1305 and AES-256-GCM-128), WireGuard shows a slight performance lead (13-18%) and reduced latency (21-23%). The tests were conducted using the project's developed fast implementations of encryption algorithms — switching to the standard Crypto API of the kernel may lead to a decline in performance.
Source: opennet.ru
