Skip to content

CryptoLib: Usage

Robert Brown edited this page Sep 20, 2022 · 14 revisions

Apply/Process Functions

Crypto_TC_ApplySecurity

int32 Crypto_TC_ApplySecurity(const uint8* p_in_frame, const uint16 in_frame_length, uint8 **pp_in_frame, uint16 *p_enc_frame_len)

Performs various types of encryption on the passed input frame. This could be, Encryption only, Authentication only, and Authenticated Encryption.

Function inputs:

p_in_frame: Frame to be encrypted. Must match an expected format, and properly activated security association. Proper formatting includes valid transfer frame version number. Valid Spacecraft Id, Virtual Channel ID, Map ID, Command Control Flag, and an operational Security Association.

in_frame_length: The int16 length of p_in_frame.

pp_in_frame: pointer to pointer of a uint8 buffer where data will be stored once fully encrypted.

p_enc_frame_len: pointer to uint16 that will store the length of the pointed to pp_in_frame.

Function Return: Error / Success codes of function: All Error Codes and Status Codes can be found within the include/crypto_error.h header file.


Crypto_TC_ProcessSecurity

int32 Crypto_TC_ProcessSecurity(char* ingest, int* len_ingest, TC_t* tc_sdls_processed_frame)

Loads the ingest frame into the global tc_frame while performing various types of decryption. This could be decryption only, authentication only, or authenticated decryption.

Function Inputs:

ingest: Pointer to a character array that holds the encrypted ingest frame.

len_ingest: Pointer to the integer that holds the length of the ingest frame.

tc_sdls_processed_frame: Pointer to the TC_t structure that holds the header, sec_header, pdu, pdu_len, and sec_trailer. Many of these structure types themselves that are used to break apart and give various specific information about the processed frame.

Function Return Values:

The return values for TC_ProcessSecurity are the same as those mentioned above for the Apply Security funciton.


Clone this wiki locally