From c77aba382a7d71f09c0412db664cc0db80de4d46 Mon Sep 17 00:00:00 2001 From: Donnie-Ice Date: Mon, 4 Nov 2024 19:18:47 +0000 Subject: [PATCH] [nasa/cryptolib#341] Attempt to manually fix const suggestions --- include/crypto.h | 6 +++--- src/core/crypto_error.c | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/crypto.h b/include/crypto.h index 172b2dcd..5ab1513c 100644 --- a/include/crypto.h +++ b/include/crypto.h @@ -95,10 +95,10 @@ extern int32_t Crypto_Init_AOS_Unit_Test(void); // Initialize CryptoLib with uni extern int32_t Crypto_Shutdown(void); // Free all allocated memory // Telecommand (TC) -extern int32_t Crypto_TC_ApplySecurity(const uint8_t *p_in_frame, const uint16_t in_frame_length, +extern int32_t Crypto_TC_ApplySecurity(const uint8_t *p_in_frame, uint16_t in_frame_length, uint8_t **pp_enc_frame, uint16_t *p_enc_frame_len); extern int32_t Crypto_TC_ProcessSecurity(uint8_t *ingest, int *len_ingest, TC_t *tc_sdls_processed_frame); -extern int32_t Crypto_TC_ApplySecurity_Cam(const uint8_t *p_in_frame, const uint16_t in_frame_length, +extern int32_t Crypto_TC_ApplySecurity_Cam(const uint8_t *p_in_frame, uint16_t in_frame_length, uint8_t **pp_enc_frame, uint16_t *p_enc_frame_len, char *cam_cookies); extern int32_t Crypto_TC_ProcessSecurity_Cam(uint8_t *ingest, int *len_ingest, TC_t *tc_sdls_processed_frame, char *cam_cookies); @@ -148,7 +148,7 @@ int32_t Crypto_TC_Do_Encrypt(uint8_t sa_service_type, SecurityAssociation_t *sa_ const uint8_t *p_in_frame, char *cam_cookies, uint32_t pkcs_padding, uint16_t new_enc_frame_header_field_length, uint16_t *new_fecf); int32_t Crypto_TC_Check_Init_Setup(uint16_t in_frame_length); -int32_t Crypto_TC_Sanity_Setup(const uint8_t *p_in_frame, const uint16_t in_frame_length); +int32_t Crypto_TC_Sanity_Setup(const uint8_t *p_in_frame, uint16_t in_frame_length); int32_t Crytpo_TC_Validate_TC_Temp_Header(const uint16_t in_frame_length, TC_FramePrimaryHeader_t temp_tc_header, const uint8_t *p_in_frame, uint8_t *map_id, uint8_t *segmentation_hdr, SecurityAssociation_t **sa_ptr); diff --git a/src/core/crypto_error.c b/src/core/crypto_error.c index c5dff512..8d82b6c8 100644 --- a/src/core/crypto_error.c +++ b/src/core/crypto_error.c @@ -21,7 +21,7 @@ #define CRYPTO_UNDEFINED_ERROR (char *)"CRYPTO_UNDEFINED_ERROR_CODE" -char *crypto_enum_errlist_core[] = {(char *)"CRYPTO_LIB_SUCCESS", +const char *crypto_enum_errlist_core[] = {(char *)"CRYPTO_LIB_SUCCESS", (char *)"CRYPTO_LIB_ERROR", (char *)"CRYPTO_LIB_ERR_NO_INIT", (char *)"CRYPTO_LIB_ERR_INVALID_TFVN", @@ -82,29 +82,29 @@ char *crypto_enum_errlist_core[] = {(char *)"CRYPTO_LIB_SUCCESS", (char *)"CRYPTO_LIB_ERR_IV_GREATER_THAN_MAX_LENGTH", (char *)"CRYPTO_LIB_ERR_KEY_STATE_TRANSITION_ERROR"}; -char *crypto_enum_errlist_config[] = { +const char *crypto_enum_errlist_config[] = { (char *)"CRYPTO_CONFIGURATION_NOT_COMPLETE", (char *)"CRYPTO_MANAGED_PARAM_CONFIGURATION_NOT_COMPLETE", (char *)"CRYPTO_MARIADB_CONFIGURATION_NOT_COMPLETE", (char *)"MANAGED_PARAMETERS_FOR_GVCID_NOT_FOUND", }; -char *crypto_enum_errlist_sa_if[] = { +const char *crypto_enum_errlist_sa_if[] = { (char *)"SADB_INVALID_SADB_TYPE", (char *)"SADB_NULL_SA_USED", }; -char *crypto_enum_errlist_sa_mariadb[] = { +const char *crypto_enum_errlist_sa_mariadb[] = { (char *)"SADB_MARIADB_CONNECTION_FAILED", (char *)"SADB_QUERY_FAILED", (char *)"SADB_QUERY_EMPTY_RESULTS", (char *)"SADB_INSERT_FAILED", }; -char *crypto_enum_errlist_crypto_if[] = { +const char *crypto_enum_errlist_crypto_if[] = { (char *)"CRYPTOGRAPHY_INVALID_CRYPTO_INTERFACE_TYPE", (char *)"CRYPTOGRAPHY_UNSUPPORTED_OPERATION_FOR_KEY_RING", (char *)"CRYPTOGRAPHY_LIBRARY_INITIALIZIATION_ERROR", }; -char *crypto_enum_errlist_crypto_kmc[] = { +const char *crypto_enum_errlist_crypto_kmc[] = { (char *)"CRYPTOGRAPHY_KMC_CRYPTO_SERVICE_CONFIGURATION_NOT_COMPLETE", (char *)"CRYPTOGRAPHY_KMC_CURL_INITIALIZATION_FAILURE", (char *)"CRYPTOGRAHPY_KMC_CRYPTO_SERVICE_CONNECTION_ERROR", @@ -123,7 +123,7 @@ char *crypto_enum_errlist_crypto_kmc[] = { (char *)"CRYPTOGRAHPY_KMC_CRYPTO_SERVICE_ENCRYPT_ERROR", }; -char *crypto_enum_errlist_crypto_cam[] = { +const char *crypto_enum_errlist_crypto_cam[] = { (char *)"CAM_CONFIG_NOT_SUPPORTED_ERROR", (char *)"CAM_INVALID_COOKIE_FILE_CONFIGURATION_NULL", (char *)"CAM_AUTHENTICATION_FAILURE_REDIRECT",