blob: 09aeaaf203a98d268858c24aad6a0204a5fe1c6f [file] [log] [blame]
# Copyright Runtime.io 2018. All rights reserved.
# Copyright Nordic Semiconductor ASA 2020-2022. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
menuconfig MCUMGR_CMD_FS_MGMT
bool "Mcumgr handlers for file management (insecure)"
depends on FILE_SYSTEM
select MGMT_MIN_DECODING_LEVEL_2
help
Enables mcumgr handlers for file management
This option allows mcumgr clients to access anything in the
file system, including application-stored secrets like
private keys. Use of this feature in production is strongly
discouraged.
if MCUMGR_CMD_FS_MGMT
choice FS_MGMT_MAX_FILE_SIZE
prompt "Maximum file size that could be uploaded/downloaded"
default FS_MGMT_MAX_FILE_SIZE_64KB
help
Maximum file size that will be allowed to be downloaded from
device.
This option decides on number of bytes that are reserved in
CBOR frame for storage of offset/size of file downloaded.
config FS_MGMT_MAX_FILE_SIZE_64KB
bool "<= 64KB"
help
Files that have size up to 64KB require 1 to 3 bytes to encode
size/offset within CBOR frame with file chunk.
config FS_MGMT_MAX_FILE_SIZE_4GB
bool "<= 4GB"
help
Files that have size up to 4GB require 1 to 5 bytes to encode
size/offset within CBOR frame with file chunk.
endchoice
config FS_MGMT_MAX_OFFSET_LEN
int
default 3 if FS_MGMT_MAX_FILE_SIZE_64KB
default 5 if FS_MGMT_MAX_FILE_SIZE_4GB
help
Maximal byte length of encoded offset/size, within transferred
CBOR frame containing chunk of downloaded file.
This value affects how much of data will fit into download buffer,
as it selects sizes of fields within headers.
NOTE: This option is hidden intentionally as it is intended
to be assigned from limited set of allowed values, depending on
the selection made in FS_MGMT_MAX_FILE_SIZE menu.
config FS_MGMT_UL_CHUNK_SIZE
int "Maximum chunk size for file uploads (DEPRECATED)"
default 512
help
DEPRECATED: The chunk is now directly read from received frame buffer
and is no longer copied first into intermediate buffer so the actual
file chunk is as much as MCUMGR_BUF_SIZE can take, less the other
SMP fields.
Limits the maximum chunk size for file uploads, in bytes. A buffer of
this size gets allocated on the stack during handling of a file upload command.
config FS_MGMT_DL_CHUNK_SIZE_LIMIT
bool "Setting custom size of download file chunk"
help
By default file chunk, that will be read off storage and fit into
mcumgr frame, is automatically calculated to fit into buffer
of size MCUGMR_BUF_SIZE with all headers.
Enabling this option allows to set MAXIMUM value that will be
allowed for such chunk.
Look inside fs_mgmt_config.h for details.
if FS_MGMT_DL_CHUNK_SIZE_LIMIT
config FS_MGMT_DL_CHUNK_SIZE
int "Maximum chunk size for file downloads"
range 65 MCUMGR_BUF_SIZE
default MCUMGR_BUF_SIZE
help
Sets the MAXIMUM size of chunk which will be rounded down to
number of bytes that, with all the required headers, will fit
into MCUMGR_BUF_SIZE. This means that actual value might be lower
then selected, in which case compiler warning will be issued.
Look inside fs_mgmt_config.h for details.
Note that header sizes are affected by FS_MGMT_MAX_OFFSET_LEN.
endif
config FS_MGMT_FILE_STATUS
bool "File status command"
default y
help
This command allows a remote device to retrieve the status of a file,
at present only the size of the file is returned (if it exists).
config FS_MGMT_CHECKSUM_HASH
bool "Checksum/hash mcumgr functions"
help
Enable this to support the hash/checksum mcumgr functionality,
individual checksum and hash types need to be enabled below.
Note that this requires enough stack space to buffer data
from the file being read and generate the output hash/checksum.
if FS_MGMT_CHECKSUM_HASH
config FS_MGMT_CHECKSUM_HASH_CHUNK_SIZE
int "Checksum calculation buffer size"
range 32 16384
default 128
help
Chunk size of buffer to use when calculating file checksum or hash
(uses stack).
config FS_MGMT_CHECKSUM_IEEE_CRC32
bool "IEEE CRC32 checksum support"
default y
help
Enable IEEE CRC32 checksum support for mcumgr.
config FS_MGMT_HASH_SHA256
bool "SHA256 hash support"
depends on TINYCRYPT_SHA256 || MBEDTLS_MAC_SHA256_ENABLED
help
Enable SHA256 hash support for mcumgr.
endif
config FS_MGMT_PATH_SIZE
int "Maximum file path length"
default 64
help
Limits the maximum path length for file operations, in bytes. A buffer
of this size gets allocated on the stack during handling of file upload
and download commands.
config FS_MGMT_FILE_ACCESS_HOOK
bool "File read/write access hook"
help
Allows applications to control file read and write access by
registering for a callback which is then triggered whenever a file
read or write attempt is made. This also, optionally, allows
re-writing or changing of supplied file paths.
Note that this will be called multiple times for each file read and
write due to mcumgr's method of stateless operation.
endif