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

[nasa/cryptolib#244] Added has_ocf field to Crypto_Config_Add_Gvcid_M… #254

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extern int32_t Crypto_Config_Kmc_Crypto_Service(char* protocol, char* kmc_crypto
char* mtls_client_key_pass, char* mtls_issuer_cert);
extern int32_t Crypto_Config_Cam(uint8_t cam_enabled, char* cookie_file_path, char* keytab_file_path, uint8_t login_method, char* access_manager_uri, char* username, char* cam_home);
extern int32_t Crypto_Config_Add_Gvcid_Managed_Parameter(uint8_t tfvn, uint16_t scid, uint8_t vcid, uint8_t has_fecf,
uint8_t has_segmentation_hdr, uint16_t max_frame_size, uint8_t aos_has_fhec,
uint8_t has_segmentation_hdr, uint8_t has_ocf, uint16_t max_frame_size, uint8_t aos_has_fhec,
uint8_t aos_has_iz, uint16_t aos_iz_len);

// Initialization
Expand Down Expand Up @@ -255,7 +255,7 @@ int32_t Crypto_Get_Managed_Parameters_For_Gvcid(uint8_t tfvn, uint16_t scid, uin
GvcidManagedParameters_t* managed_parameters_in,
GvcidManagedParameters_t** managed_parameters_out);
int32_t crypto_config_add_gvcid_managed_parameter_recursion(uint8_t tfvn, uint16_t scid, uint8_t vcid,
uint8_t has_fecf, uint8_t has_segmentation_hdr,
uint8_t has_fecf, uint8_t has_segmentation_hdr, uint8_t has_ocf,
uint16_t max_frame_size, uint8_t aos_has_fhec,
uint8_t aos_has_iz, uint16_t aos_iz_len,
GvcidManagedParameters_t* managed_parameter);
Expand Down
39 changes: 22 additions & 17 deletions src/core/crypto_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ int32_t Crypto_SC_Init(void)
TC_UNIQUE_SA_PER_MAP_ID_FALSE, TC_CHECK_FECF_TRUE, 0x3F,
SA_INCREMENT_NONTRANSMITTED_IV_TRUE);
// TC
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 0, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 4, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 0, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, TC_OCF_NA, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 4, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, TC_OCF_NA, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);

// TM
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 1, TM_HAS_FECF, TM_SEGMENT_HDRS_NA, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 1, TM_HAS_FECF, TM_SEGMENT_HDRS_NA, TM_HAS_OCF, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
status = Crypto_Init();
return status;
}
Expand All @@ -82,9 +82,9 @@ int32_t Crypto_Init_TC_Unit_Test(void)
TC_UNIQUE_SA_PER_MAP_ID_FALSE, TC_CHECK_FECF_TRUE, 0x3F,
SA_INCREMENT_NONTRANSMITTED_IV_TRUE);
// TC Tests
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 0, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 1, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 4, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 0, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, TC_OCF_NA, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 1, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, TC_OCF_NA, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 4, TC_HAS_FECF, TC_HAS_SEGMENT_HDRS, TC_OCF_NA, 1024, AOS_FHEC_NA, AOS_IZ_NA, 0);
status = Crypto_Init();
return status;
}
Expand All @@ -101,9 +101,9 @@ int32_t Crypto_Init_TM_Unit_Test(void)
TC_IGNORE_SA_STATE_FALSE, TC_IGNORE_ANTI_REPLAY_FALSE, TC_UNIQUE_SA_PER_MAP_ID_FALSE,
TM_CHECK_FECF_TRUE, 0x3F, SA_INCREMENT_NONTRANSMITTED_IV_TRUE);
// TM Tests
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 0, TM_HAS_FECF, TM_SEGMENT_HDRS_NA, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x002c, 0, TM_NO_FECF, TM_SEGMENT_HDRS_NA, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0042, 0, TM_NO_FECF, TM_SEGMENT_HDRS_NA, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0003, 0, TM_HAS_FECF, TM_SEGMENT_HDRS_NA, TM_NO_OCF, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x002c, 0, TM_NO_FECF, TM_SEGMENT_HDRS_NA, TM_NO_OCF, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(0, 0x0042, 0, TM_NO_FECF, TM_SEGMENT_HDRS_NA, TM_HAS_OCF, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
status = Crypto_Init();
return status;
}
Expand All @@ -120,9 +120,9 @@ int32_t Crypto_Init_AOS_Unit_Test(void)
TC_IGNORE_SA_STATE_FALSE, TC_IGNORE_ANTI_REPLAY_FALSE, TC_UNIQUE_SA_PER_MAP_ID_FALSE,
AOS_CHECK_FECF_TRUE, 0x3F, SA_INCREMENT_NONTRANSMITTED_IV_TRUE);
// AOS Tests
Crypto_Config_Add_Gvcid_Managed_Parameter(1, 0x0003, 0, AOS_HAS_FECF, AOS_SEGMENT_HDRS_NA, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(1, 0x002c, 0, AOS_NO_FECF, AOS_SEGMENT_HDRS_NA, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(1, 0x0042, 0, AOS_NO_FECF, AOS_SEGMENT_HDRS_NA, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(1, 0x0003, 0, AOS_HAS_FECF, AOS_SEGMENT_HDRS_NA, AOS_NO_OCF, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(1, 0x002c, 0, AOS_NO_FECF, AOS_SEGMENT_HDRS_NA, AOS_NO_OCF, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
Crypto_Config_Add_Gvcid_Managed_Parameter(1, 0x0042, 0, AOS_NO_FECF, AOS_SEGMENT_HDRS_NA, AOS_HAS_OCF, 1786, AOS_FHEC_NA, AOS_IZ_NA, 0);
status = Crypto_Init();
return status;
}
Expand Down Expand Up @@ -477,12 +477,15 @@ int32_t Crypto_Config_Cam(uint8_t cam_enabled, char* cookie_file_path, char* key
* @param vcid: uint8
* @param has_fecf: uint8
* @param has_segmentation_hdr: uint8
* @param has_ocf: uint8
* @param max_frame_size: uint16
* @param has_fhec: uint8
* @param aos_has_fhec: uint8
* @param aos_has_iz: uint8
* @param aos_iz_len: uint16
* @return int32: Success/Failure
**/
int32_t Crypto_Config_Add_Gvcid_Managed_Parameter(uint8_t tfvn, uint16_t scid, uint8_t vcid, uint8_t has_fecf,
uint8_t has_segmentation_hdr, uint16_t max_frame_size, uint8_t aos_has_fhec,
uint8_t has_segmentation_hdr, uint8_t has_ocf, uint16_t max_frame_size, uint8_t aos_has_fhec,
uint8_t aos_has_iz, uint16_t aos_iz_len)
{
int32_t status = CRYPTO_LIB_SUCCESS;
Expand All @@ -497,6 +500,7 @@ int32_t Crypto_Config_Add_Gvcid_Managed_Parameter(uint8_t tfvn, uint16_t scid, u
gvcid_managed_parameters->vcid = vcid;
gvcid_managed_parameters->has_fecf = has_fecf;
gvcid_managed_parameters->has_segmentation_hdr = has_segmentation_hdr;
gvcid_managed_parameters->has_ocf = has_ocf;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just calling this out as what the goal of the issue was - looks good!

gvcid_managed_parameters->max_frame_size = max_frame_size;
gvcid_managed_parameters->aos_has_fhec = aos_has_fhec;
gvcid_managed_parameters->aos_has_iz = aos_has_iz;
Expand All @@ -513,7 +517,7 @@ int32_t Crypto_Config_Add_Gvcid_Managed_Parameter(uint8_t tfvn, uint16_t scid, u
}
else
{ // Recurse through nodes and add at end
return crypto_config_add_gvcid_managed_parameter_recursion(tfvn, scid, vcid, has_fecf, has_segmentation_hdr,
return crypto_config_add_gvcid_managed_parameter_recursion(tfvn, scid, vcid, has_fecf, has_segmentation_hdr, has_ocf,
max_frame_size, aos_has_fhec, aos_has_iz, aos_iz_len,
gvcid_managed_parameters);
}
Expand Down Expand Up @@ -600,13 +604,13 @@ char* crypto_deep_copy_string(char* src_string)
* @return int32: Success/Failure
**/
int32_t crypto_config_add_gvcid_managed_parameter_recursion(uint8_t tfvn, uint16_t scid, uint8_t vcid, uint8_t has_fecf,
uint8_t has_segmentation_hdr, uint16_t max_frame_size, uint8_t aos_has_fhec,
uint8_t has_segmentation_hdr, uint8_t has_ocf, uint16_t max_frame_size, uint8_t aos_has_fhec,
uint8_t aos_has_iz, uint16_t aos_iz_len,
GvcidManagedParameters_t* managed_parameter)
{
if (managed_parameter->next != NULL)
{
return crypto_config_add_gvcid_managed_parameter_recursion(tfvn, scid, vcid, has_fecf, has_segmentation_hdr,
return crypto_config_add_gvcid_managed_parameter_recursion(tfvn, scid, vcid, has_fecf, has_segmentation_hdr, has_ocf,
max_frame_size, aos_has_fhec, aos_has_iz,
aos_iz_len, managed_parameter->next);
}
Expand All @@ -618,6 +622,7 @@ int32_t crypto_config_add_gvcid_managed_parameter_recursion(uint8_t tfvn, uint16
managed_parameter->next->vcid = vcid;
managed_parameter->next->has_fecf = has_fecf;
managed_parameter->next->has_segmentation_hdr = has_segmentation_hdr;
managed_parameter->next->has_ocf = has_ocf;
managed_parameter->next->max_frame_size = max_frame_size;
managed_parameter->next->next = NULL;
return CRYPTO_LIB_SUCCESS;
Expand Down
Loading
Loading