mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
logger: cleanup crypto defines
This commit is contained in:
parent
6f4e873bce
commit
469fe62166
@ -173,7 +173,8 @@ public:
|
||||
{
|
||||
if (_log_writer_file) { _log_writer_file->set_encryption_parameters(algorithm, key_idx, exchange_key_idx); }
|
||||
}
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
private:
|
||||
|
||||
LogWriterFile *_log_writer_file = nullptr;
|
||||
|
||||
@ -40,9 +40,12 @@
|
||||
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <px4_platform_common/crypto.h>
|
||||
#include <px4_platform_common/log.h>
|
||||
|
||||
#if defined(PX4_CRYPTO)
|
||||
# include <px4_platform_common/crypto.h>
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
#if defined(__PX4_NUTTX)
|
||||
# include <malloc.h>
|
||||
# include <systemlib/hardfault_log.h>
|
||||
@ -378,7 +381,7 @@ void LogWriterFile::run()
|
||||
#if defined(PX4_CRYPTO)
|
||||
// Split into min blocksize chunks, so it is good for encrypting in pieces
|
||||
available = (available / _min_blocksize) * _min_blocksize;
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
/* if sufficient data available or partial read or terminating, write data */
|
||||
if (available >= min_available[i] || is_part || (!buffer._should_run && available > 0)) {
|
||||
@ -408,7 +411,7 @@ void LogWriterFile::run()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
int written = buffer.write_to_file(read_ptr, available, call_fsync);
|
||||
|
||||
@ -469,7 +472,7 @@ void LogWriterFile::run()
|
||||
/* close the crypto session */
|
||||
|
||||
_crypto.close();
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -39,7 +39,10 @@
|
||||
#include <pthread.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <perf/perf_counter.h>
|
||||
#include <px4_platform_common/crypto.h>
|
||||
|
||||
#if defined(PX4_CRYPTO)
|
||||
# include <px4_platform_common/crypto.h>
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
namespace px4
|
||||
{
|
||||
@ -143,7 +146,7 @@ public:
|
||||
_key_idx = key_idx;
|
||||
_exchange_key_idx = exchange_key_idx;
|
||||
}
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
private:
|
||||
static void *run_helper(void *);
|
||||
@ -223,6 +226,7 @@ private:
|
||||
pthread_mutex_t _mtx;
|
||||
pthread_cond_t _cv;
|
||||
pthread_t _thread = 0;
|
||||
|
||||
#if defined(PX4_CRYPTO)
|
||||
bool init_logfile_encryption(const LogType type);
|
||||
PX4Crypto _crypto;
|
||||
@ -230,7 +234,7 @@ private:
|
||||
px4_crypto_algorithm_t _algorithm;
|
||||
uint8_t _key_idx;
|
||||
uint8_t _exchange_key_idx;
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -1310,7 +1310,7 @@ int Logger::get_log_file_name(LogType type, char *file_name, size_t file_name_si
|
||||
crypto_suffix = "e";
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
char *log_file_name = _file_name[(int)type].log_file_name;
|
||||
|
||||
@ -1419,7 +1419,7 @@ void Logger::start_log_file(LogType type)
|
||||
(px4_crypto_algorithm_t)_param_sdlog_crypto_algorithm.get(),
|
||||
_param_sdlog_crypto_key.get(),
|
||||
_param_sdlog_crypto_exchange_key.get());
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
|
||||
if (_writer.start_log_file(type, file_name)) {
|
||||
_writer.select_write_backend(LogWriter::BackendFile);
|
||||
|
||||
@ -403,7 +403,7 @@ private:
|
||||
, (ParamInt<px4::params::SDLOG_ALGORITHM>) _param_sdlog_crypto_algorithm,
|
||||
(ParamInt<px4::params::SDLOG_KEY>) _param_sdlog_crypto_key,
|
||||
(ParamInt<px4::params::SDLOG_EXCH_KEY>) _param_sdlog_crypto_exchange_key
|
||||
#endif
|
||||
#endif // PX4_CRYPTO
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user