If the board supports encrypting logfiles, but the parameter SDCARD_ALGORITHM is set to NONE,
the log should be written to the sdcard in plaintext format. This fixes a bug which caused
logger to hang in mutex instead.
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
SDLOG_ALGORITHM for selecting the crypto algorithm
SDLOG_KEY for selecting the key in keystore to use with the algorithm.
for symmetric algorithms which are currently supported, this is just a free
slot to be used, the key is generated at logging start
SDLOG_EXCH_KEY for selecting an RSA2048 key for encrypting the SDLOG_KEY
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
- Generate a symmetric encryption key and a nonce value
- Use a public key in keystore to encrypt the symmteric key
- Write the encrypted key and the nonce value to disk into .ulgk, name matching with the encrypted log file
- use quick stream encryption to crypt the .ulg file contents
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
and remove the px4_ prefix, except for px4_config.h.
command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done
Transitional headers for submodules are added (px4_{defines,log,time}.h)
- fsync can be a long blocking operation, so we need to make sure the main
logger thread does not block during this time, when it tries to aquire
the mutex
- fixes calling fsync on an invalid file descriptor
In case a log ends abruptly, we will know that we have everything up to the
last second.
A test showed that CPU load and the amount of logging drops are unaffected
by this.
Test flights reported the warning `[load_mon] log_writer_file low on stack! (292 bytes left)`
Increase stack size from 1060 to 1072 (=8 + 1060 rounded to next multiple of 8).
This enables to use the RAM normally consumed by the log buffer to be used for calibration and other memory-intense tasks.
These run typically only disarmed when logging is not enabled.