-
Notifications
You must be signed in to change notification settings - Fork 46
CryptoLib: Usage
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:
Success / Error Code Description Constant Success / No Error CRYPTO_LIB_SUCCESS (0) General Error CRYPTO_LIB_ERROR (-1) No Initialization CRYPTO_LIB_ERR_NO_INIT (-2) Invalid Transfer Frame Version Number CRYPTO_LIB_ERR_INVALID_TFVN (-3) Invalid Spacecraft ID CRYPTO_LIB_ERR_INVALID_SCID (-4) Invalid Virtual Channel ID CRYPTO_LIB_ERR_INVALID_VCID (-5) Invalid Map ID CRYPTO_LIB_ERR_INVALID_MAPID (-6) Invalid Command Control Flag CRYPTO_LIB_ERR_INVALID_CC_FLAG (-7) No Operational Security Association CRYPTO_LIB_ERR_NO_OPERATIONAL_SA (-8) Null Buffer CRYPTO_LIB_ERR_NULL_BUFFER (-9)
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:
WIP: OS_SUCCESS (1), OS_ERROR (-1). This function is currently being refactored to have more specific error codes as was done in Crypto_TC_ApplySecurity.
crypto_props.h/.c Usage & Function Info Here Usage & Function Info Here