3ds, vita, switch: the built-in SMB client

The 3DS, Vita and Switch build smb://: the SMB and Kerberos clients
reach the network only through libretro-common's socket helpers, and
the crypto they rest on draws on each console's hardware random number
generator. The Wii U, whose crypto has only a clock to stir, is left
out: SMB derives its signing and sealing keys from that randomness. The
3DS keeps its SMB transfers at 64 KiB, as it does NFS's.

The compile matrix builds the SMB client, the Kerberos client and the
SMB VFS backend for each of the three under their Makefiles' defines.
This commit is contained in:
libretroadmin committed 2026-09-30 22:44:16 +02:00
1 parent 3298947b8a
commit 0ddc58c44d
7 files changed
+24

No files matched your search

@@ -190,6 +190,13 @@ console_set "3ds nfs" "-Itools/platform_stubs/ctr $NFSD" "-D_3DS -DARM11
console_set "vita nfs" "-Itools/platform_stubs/vita $NFSD" "-DVITA -DRARCH_CONSOLE -DHAVE_SOCKET_LEGACY" $NFS_SET
console_set "switch nfs" "-I$STUBS/libnx $NFSD" "-DHAVE_LIBNX -DSWITCH -D__SWITCH__ -DRARCH_CONSOLE" $NFS_SET
console_set "wiiu nfs" "-Iwiiu/include -Itools/platform_stubs/wiiu $NFSD" "-DWIIU -D__WUT__ -DHW_WUP -D__wiiu__ -DRARCH_CONSOLE" $NFS_SET
# The built-in SMB and Kerberos clients, which the 3DS, Vita and Switch
# build on their crypto (the Wii U has no kernel RNG for it to draw on).
SMB_SET="libretro-common/net/net_smb2.c libretro-common/net/net_krb5.c libretro-common/vfs/vfs_implementation_smb.c"
SMBD="-DHAVE_RETROSMB -DHAVE_SMBCLIENT"
console_set "3ds smb" "-Itools/platform_stubs/ctr $SMBD" "-D_3DS -DARM11 -DRARCH_CONSOLE" $SMB_SET
console_set "vita smb" "-Itools/platform_stubs/vita $SMBD" "-DVITA -DRARCH_CONSOLE -DHAVE_SOCKET_LEGACY" $SMB_SET
console_set "switch smb" "-I$STUBS/libnx $SMBD" "-DHAVE_LIBNX -DSWITCH -D__SWITCH__ -DRARCH_CONSOLE" $SMB_SET
# Every platform makefile on Makefile.common, without its toolchain: the
# graph's own DEFINES checked for consistency (TLS, SMB, NFS need the
+1
View File
@@ -98,6 +98,7 @@
- NETWORK: Built-in NFSv3 and NFSv4 (4.0, 4.1, 4.2) client for loading content from nfs:// exports
- NETWORK: NFS files stay usable across a server restart, a dropped connection or a long pause: the client reconnects and reopens what it needs
- 3DS/VITA/SWITCH/WIIU: nfs:// content through the built-in NFS client
- 3DS/VITA/SWITCH: smb:// content through the built-in SMB client
- NETWORK: SMB files stay usable across a server restart: the connection is mended and the file opened again where it was
- NETWORK: NFSv4.2 reads use READ_PLUS: holes in sparse files no longer cross the network
- 3DS/SWITCH: nfs:// content through the built-in NFS client
+2
View File
@@ -106,6 +106,8 @@ else
HAVE_RETROSSL = 1
# the built-in NFS client (nfs://); it needs no crypto
HAVE_RETRONFS = 1
# the built-in SMB client (smb://), on the crypto above
HAVE_RETROSMB = 1
HAVE_CORE_INFO_CACHE = 1
HAVE_CLOUDSYNC = 1
+2
View File
@@ -64,6 +64,8 @@ HAVE_KEYCHAIN = 1
HAVE_RETROSSL = 1
# The built-in NFS client (nfs://); it needs no crypto.
HAVE_RETRONFS = 1
# The built-in SMB client (smb://), on the crypto above.
HAVE_RETROSMB = 1
# RetroArch libnx useful flags
HAVE_THREADS = 1
+2
View File
@@ -84,6 +84,8 @@ else
HAVE_SOCKET_LEGACY := 1
# the built-in NFS client (nfs://); it needs no crypto
HAVE_RETRONFS := 1
# the built-in SMB client (smb://), on the crypto above
HAVE_RETROSMB := 1
HAVE_MENU := 1
HAVE_MENU_COMMON := 1
HAVE_GFX_WIDGETS := 1
+4
View File
@@ -65,6 +65,10 @@ other cores have the file copied to local storage first. Changes to these
settings apply the next time a share is browsed; content already running
keeps its connection. A wired connection is more reliable than Wi-Fi.
Besides the desktop and mobile builds, the 3DS, Vita and Switch carry the
SMB client, on their hardware random number generators. The Wii U does
not: it has no kernel source of randomness for the keys SMB derives.
## Loading content from NFS exports
The NFS client supports NFSv3, which finds the NFS and MOUNT services
+6
View File
@@ -78,7 +78,13 @@
* SMB2_LARGE_IO once the server has granted the credits; the
* connection's buffers are sized to what it negotiated. */
#define SMB2_MAX_IO (64 * 1024)
/* The 3DS keeps the 64 KiB start: its RAM is small, four connections
* at 1 MiB would hold 8 MiB of buffers, and its Wi-Fi gains nothing. */
#ifdef _3DS
#define SMB2_LARGE_IO (64 * 1024)
#else
#define SMB2_LARGE_IO (1024 * 1024)
#endif
#define SMB2_BUF_SIZE(io) (SMB2_TRANSFORM_HDR_SIZE + SMB2_HDR_SIZE + (io) + 4096)
#define SMB2_RX_SIZE SMB2_BUF_SIZE(SMB2_MAX_IO)