SEcube open-source SDK
|
Functions for internal purposes of SEfile | |
You should not need to use these functions directly because they are used internally by the SEfile library. | |
uint16_t | SEfile::secure_create (char *path, std::shared_ptr< SEFILE_HANDLE > hFile, int mode) |
This function creates a new secure file managed with SEfile. If the file already exists, it is overwritten with an empty one, all previous data are lost. More... | |
uint16_t | SEfile::secure_key_check (uint16_t direction) |
This function is used to check if the key setup in the SEfile object can be used to encrypt or decrypt data. More... | |
uint16_t | SEfile::get_filesize (uint32_t *length) |
This function is used to compute the total logic size of a file that is already open within a SEfile object. More... | |
uint16_t | SEfile::crypt_header (void *buff1, void *buff2, size_t datain_len, uint16_t direction) |
This function encrypts a header buffer by exploiting the functions provided by L1.h. More... | |
uint16_t | SEfile::crypt_sectors (void *buff_decrypt, void *buff_crypt, size_t datain_len, size_t current_offset, uint8_t *nonce_ctr, uint8_t *nonce_pbkdf2) |
This function encrypts the buff_decrypt data by exploiting the functions provided by L1.h. More... | |
uint16_t | SEfile::decrypt_sectors (void *buff_crypt, void *buff_decrypt, size_t datain_len, size_t current_offset, uint8_t *nonce_ctr, uint8_t *nonce_pbkdf2) |
This function decrypts the buff_crypt data by exploiting the functions provided by L1.h. More... | |
uint16_t SEfile::crypt_header | ( | void * | buff1, |
void * | buff2, | ||
size_t | datain_len, | ||
uint16_t | direction | ||
) |
This function encrypts a header buffer by exploiting the functions provided by L1.h.
[in] | buff1 | Pointer to the header we want to encrypt/decrypt. |
[out] | buff2 | Pointer to an allocated header where to store the result. |
[in] | datain_len | How big is the amount of data. |
[in] | direction | See SE3_DIR. |
uint16_t SEfile::crypt_sectors | ( | void * | buff_decrypt, |
void * | buff_crypt, | ||
size_t | datain_len, | ||
size_t | current_offset, | ||
uint8_t * | nonce_ctr, | ||
uint8_t * | nonce_pbkdf2 | ||
) |
This function encrypts the buff_decrypt data by exploiting the functions provided by L1.h.
[in] | buff_decrypt | The plaintext data to be encrypted |
[out] | buff_crypt | The preallocated buffer where to store the encrypted data. |
[in] | datain_len | Specify how many data we want to encrypt. |
[in] | current_offset | Current position inside the file expressed as number of cipher blocks |
[in] | nonce_ctr | Initialization vector, see SEFILE_HEADER |
[in] | nonce_pbkdf2 | Initialization vector, see SEFILE_HEADER |
uint16_t SEfile::decrypt_sectors | ( | void * | buff_crypt, |
void * | buff_decrypt, | ||
size_t | datain_len, | ||
size_t | current_offset, | ||
uint8_t * | nonce_ctr, | ||
uint8_t * | nonce_pbkdf2 | ||
) |
This function decrypts the buff_crypt data by exploiting the functions provided by L1.h.
[in] | buff_crypt | The cipher text data to be decrypted |
[out] | buff_decrypt | The preallocated buffer where to store the decrypted data. |
[in] | datain_len | Specify how many data we want to decrypt. |
[in] | current_offset | Current position inside the file expressed as number of cipher blocks |
[in] | nonce_ctr | Initialization vector, see SEFILE_HEADER |
[in] | nonce_pbkdf2 | Initialization vector, see SEFILE_HEADER |
uint16_t SEfile::get_filesize | ( | uint32_t * | length | ) |
This function is used to compute the total logic size of a file that is already open within a SEfile object.
[out] | length | Where the logic size of the file is stored. |
uint16_t SEfile::secure_create | ( | char * | path, |
std::shared_ptr< SEFILE_HANDLE > | hFile, | ||
int | mode | ||
) |
This function creates a new secure file managed with SEfile. If the file already exists, it is overwritten with an empty one, all previous data are lost.
[in] | path | Specify the absolute/relative path where to create the file. No encrypted directory are allowed inside the path. |
[out] | hFile | The pointer in which the file handle to the new opened file is placed after a success, NULL in case of failure. |
[in] | mode | The mode in which the file should be created. See mode parameter for secure_open. |
You do not need to call this function explicitly. Use secure_open() instead.
uint16_t SEfile::secure_key_check | ( | uint16_t | direction | ) |
This function is used to check if the key setup in the SEfile object can be used to encrypt or decrypt data.
[in] | direction | Check if the key can be used for encryption or decryption. |