Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logger: fix file open issue if crypto algorithm is disabled #24156

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

jnippula
Copy link
Contributor

@jnippula jnippula commented Dec 27, 2024

Open log file only once to avoid conflicts.

Solved Problem

Fixes #24155

Solution

  • The init_logfile_encryption() call is moved after the buffer's start_log() is called. This way file is opened only once and is already open when storing possible key data into the beginning of the file.

Changelog Entry

For release notes:

Bugfix: Fix logger file open when SDLOG_ALGORITHM is 0 (crypto disabled)

Alternatives

Could also add "append" parameter to start_log() function to select whether file needs to be opened as APPEND or CREATE flag. Another option is to store the keydata into temporary memory buffer and store it to file when opened in buffer's start_log() method.

Test coverage

  • Unit/integration test: Logging functionality with encryption enabled and disabled verified with Pixhawk4 and px4_fmu-v5_cryptotest target

@jnippula jnippula marked this pull request as draft January 3, 2025 13:08
@jnippula jnippula force-pushed the fix-logger-no-crypto branch from 38a0fe3 to dfd8f2c Compare January 3, 2025 13:54
@jnippula jnippula marked this pull request as ready for review January 3, 2025 14:10
move init_logfile_encryption() call after the buffer start_log() call
to have log file already open while storing the header and key data to
the beginning of the file.
@jnippula jnippula force-pushed the fix-logger-no-crypto branch from dde2a9b to b6f37c6 Compare January 8, 2025 10:43
@bkueng bkueng merged commit cbbbbc9 into PX4:main Jan 9, 2025
57 of 58 checks passed
@jnippula jnippula deleted the fix-logger-no-crypto branch January 10, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Logging not working with crypto_algorithm==NONE
2 participants