diff --git a/.clang-format b/.clang-format index 97daf9dd..4a6be883 100644 --- a/.clang-format +++ b/.clang-format @@ -2,9 +2,19 @@ Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: true -AlignConsecutiveDeclarations: true -AlignConsecutiveMacros: true +AlignConsecutiveAssignments: + Enabled: true + AcrossComments: true + AlignCompound: true +AlignConsecutiveDeclarations: + Enabled: true + AcrossComments: true + AlignFunctionPointers: true + AlignFunctionDeclarations: true +AlignConsecutiveMacros: + Enabled: true + AcrossEmptyLines: true + AcrossComments: false AlignEscapedNewlines: Left AlignOperands: true AlignTrailingComments: true @@ -17,7 +27,7 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false BinPackArguments: true -BinPackParameters: true +BinPackParameters: BinPack BreakBeforeBinaryOperators: None BreakBeforeBraces: Allman BreakBeforeTernaryOperators: true @@ -36,7 +46,8 @@ IncludeIsMainRegex: '$' IndentCaseLabels: true IndentPPDirectives: None IndentWidth: 4 -KeepEmptyLinesAtTheStartOfBlocks: true +KeepEmptyLines: + AtStartOfBlock: true MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 @@ -48,8 +59,8 @@ PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Right -ReflowComments: true -SortIncludes: false +ReflowComments: Always +SortIncludes: Never SpaceAfterCStyleCast: false SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements @@ -57,7 +68,7 @@ SpaceInEmptyParentheses: false SpaceBeforeCpp11BracedList: true SpacesBeforeTrailingComments: 1 SpacesInCStyleCastParentheses: false -SpacesInParentheses: false +SpacesInParens: Never SpacesInSquareBrackets: false Standard: c++11 TabWidth: 8 diff --git a/include/crypto.h b/include/crypto.h index 87e04d27..172b2dcd 100644 --- a/include/crypto.h +++ b/include/crypto.h @@ -226,7 +226,7 @@ int32_t Crypto_Get_tmLength(int len); uint8_t Crypto_Is_AEAD_Algorithm(uint32_t cipher_suite_id); void Crypto_TM_updatePDU(uint8_t *ingest, int len_ingest); void Crypto_TM_updateOCF(Telemetry_Frame_Ocf_Fsr_t *report, TM_t *tm_frame); -uint8_t *Crypto_Prepare_TC_AAD(uint8_t *buffer, uint16_t len_aad, uint8_t *abm_buffer); +uint8_t *Crypto_Prepare_TC_AAD(uint8_t *buffer, uint16_t len_aad, uint8_t *abm_buffer); uint32_t Crypto_Prepare_TM_AAD(const uint8_t *buffer, uint16_t len_aad, const uint8_t *abm_buffer, uint8_t *aad); uint32_t Crypto_Prepare_AOS_AAD(const uint8_t *buffer, uint16_t len_aad, const uint8_t *abm_buffer, uint8_t *aad); void Crypto_Local_Config(void); @@ -312,11 +312,11 @@ extern AOS_FrameSecurityHeader_t aos_frame_sec_hdr; // Used to reduce bit math d // Global configuration structs extern CryptoConfig_t crypto_config; -extern SadbMariaDBConfig_t *sa_mariadb_config; +extern SadbMariaDBConfig_t *sa_mariadb_config; extern CryptographyKmcCryptoServiceConfig_t *cryptography_kmc_crypto_config; -extern CamConfig_t *cam_config; -extern GvcidManagedParameters_t *gvcid_managed_parameters; -extern GvcidManagedParameters_t *current_managed_parameters; +extern CamConfig_t *cam_config; +extern GvcidManagedParameters_t *gvcid_managed_parameters; +extern GvcidManagedParameters_t *current_managed_parameters; extern GvcidManagedParameters_t gvcid_managed_parameters_array[GVCID_MAX_PARAM_SIZE]; extern GvcidManagedParameters_t current_managed_parameters_struct; extern int gvcid_counter; diff --git a/include/crypto_error.h b/include/crypto_error.h index 08f3aac0..67fd1b88 100644 --- a/include/crypto_error.h +++ b/include/crypto_error.h @@ -150,14 +150,14 @@ #define CONFIGURATION_ERROR_CODES 100 #define CONFIGURATION_ERROR_CODES_MAX 103 -#define CRYPTO_CORE_ERROR_CODES_MAX -59 - -extern char *crypto_enum_errlist_core[]; -extern char *crypto_enum_errlist_config[]; -extern char *crypto_enum_errlist_sa_if[]; -extern char *crypto_enum_errlist_sa_mariadb[]; -extern char *crypto_enum_errlist_crypto_if[]; -extern char *crypto_enum_errlist_crypto_kmc[]; -extern char *crypto_enum_errlist_crypto_cam[]; +#define CRYPTO_CORE_ERROR_CODES_MAX (-59) + +extern const char *crypto_enum_errlist_core[]; +extern const char *crypto_enum_errlist_config[]; +extern const char *crypto_enum_errlist_sa_if[]; +extern const char *crypto_enum_errlist_sa_mariadb[]; +extern const char *crypto_enum_errlist_crypto_if[]; +extern const char *crypto_enum_errlist_crypto_kmc[]; +extern const char *crypto_enum_errlist_crypto_cam[]; #endif // CRYPTO_ERROR_H \ No newline at end of file diff --git a/support/standalone/standalone.h b/support/standalone/standalone.h index af5a7c68..99b66db9 100644 --- a/support/standalone/standalone.h +++ b/support/standalone/standalone.h @@ -75,7 +75,7 @@ extern "C" #define CRYPTO_MAX_INPUT_TOKENS 32 #define CRYPTO_MAX_INPUT_TOKEN_SIZE 64 -#define CRYPTO_CMD_UNKNOWN -1 +#define CRYPTO_CMD_UNKNOWN (-1) #define CRYPTO_CMD_HELP 0 #define CRYPTO_CMD_EXIT 1 #define CRYPTO_CMD_NOOP 2 @@ -113,11 +113,11 @@ extern "C" int32_t crypto_standalone_udp_init(udp_info_t *sock, int32_t port, uint8_t bind_sock); int32_t crypto_reset(void); void crypto_standalone_tc_frame(uint8_t *in_data, uint16_t in_length, uint8_t *out_data, uint16_t *out_length); - void *crypto_standalone_tc_apply(void *socks); + void *crypto_standalone_tc_apply(void *socks); void crypto_standalone_tm_frame(uint8_t *in_data, uint16_t in_length, uint8_t *out_data, uint16_t *out_length, uint16_t spi); - void *crypto_standalone_tm_process(void *socks); - void crypto_standalone_cleanup(const int signal); + void *crypto_standalone_tm_process(void *socks); + void crypto_standalone_cleanup(int signal); #ifdef __cplusplus } /* Close scope of 'extern "C"' declaration which encloses file. */