mbedtls
mbedtls copied to clipboard
Split fopen and opendir platform requirements
MBEDTLS_FS_IO
is documented as “Enable functions that use the filesystem.”. More precisely, it means that the platform has:
- some basic functions from
stdio.h
:fopen()
,fclose()
,fread()
,fwrite()
,ftell()
,fseek()
,remove()
,rename()
(and more?printf
andfprintf
are required separately). - Either the trio of
opendir()
,readdir()
andclosedir()
; or their Windows equivalent.
There are platforms that have files but not directories, or that have directories but not opendir()
and friends (Window is one, for which we have special-case support).
The dir functions should actually probably be a separate compile-time option (not that the prospect of another compile-time option fills me with joy) to accommodate low-end platforms that have files with an stdio interface, but not directories.
opendir
is used in only one place: mbedtls_x509_crt_parse_path
. It definitely makes sense to build Mbed TLS with X.509 support but not mbedtls_x509_crt_parse_path
. Plenty of embedded applications have a single root CA and so only need parse_file()
, not parse_path()
.