SEcube open-source SDK
|
This file includes some of the constants, return values and public functions used for implementing a secure file system. More...
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | MAX_PATHNAME 256 |
Use this values as mode parameter for secure_open(). | |
#define | SEFILE_READ O_RDONLY |
#define | SEFILE_WRITE O_RDWR |
Use this values as creation parameter for secure_open(). | |
#define | SEFILE_NEWFILE O_CREAT | O_TRUNC |
#define | SEFILE_OPEN 0 |
Use this values as whence parameter for secure_seek(). | |
#define | SEFILE_BEGIN SEEK_SET |
#define | SEFILE_CURRENT SEEK_CUR |
#define | SEFILE_END SEEK_END |
Returned error values. | |
#define | SEFILE_ENV_ALREADY_SET 15 |
#define | SEFILE_ENV_WRONG_PARAMETER 16 |
#define | SEFILE_ENV_MALLOC_ERROR 17 |
#define | SEFILE_ENV_NOT_SET 18 |
#define | SEFILE_SECTOR_MALLOC_ERR 19 |
#define | SEFILE_GET_FILEPOINTER_ERR 20 |
#define | SEFILE_HANDLE_MALLOC_ERR 21 |
#define | SEFILE_CLOSE_HANDLE_ERR 22 |
#define | SEFILE_CREATE_ERROR 23 |
#define | SEFILE_OPEN_ERROR 24 |
#define | SEFILE_WRITE_ERROR 25 |
#define | SEFILE_SEEK_ERROR 26 |
#define | SEFILE_READ_ERROR 27 |
#define | SEFILE_ILLEGAL_SEEK 28 |
#define | SEFILE_FILESIZE_ERROR 29 |
#define | SEFILE_BUFFER_MALLOC_ERR 30 |
#define | SEFILE_FILENAME_DEC_ERROR 31 |
#define | SEFILE_FILENAME_ENC_ERROR 32 |
#define | SEFILE_DIRNAME_ENC_ERROR 33 |
#define | SEFILE_DIRNAME_DEC_ERROR 34 |
#define | SEFILE_DIRNAME_TOO_LONG 35 |
#define | SEFILE_MKDIR_ERROR 36 |
#define | SEFILE_LS_ERROR 37 |
#define | SEFILE_ENV_INIT_ERROR 38 |
#define | SEFILE_ENV_UPDATE_ERROR 39 |
#define | SEFILE_INTEGRITY_ERROR 40 |
#define | SEFILE_NAME_NOT_VALID 41 |
#define | SEFILE_TRUNCATE_ERROR 42 |
#define | SEFILE_DEVICE_SN_MISMATCH 43 |
#define | SEFILE_KEYID_NOT_PRESENT 44 |
#define | SEFILE_ALGID_NOT_PRESENT 45 |
#define | SEFILE_PATH_TOO_LONG 46 |
#define | SEFILE_SYNC_ERR 47 |
#define | SEFILE_SIGNATURE_MISMATCH 48 |
#define | SEFILE_RECRYPT_ERROR 49 |
Constant used to define sector structure. | |
#define | SEFILE_SECTOR_SIZE 512 |
#define | SEFILE_BLOCK_SIZE B5_AES_BLK_SIZE |
#define | SEFILE_SECTOR_DATA_SIZE (SEFILE_SECTOR_SIZE - B5_SHA256_DIGEST_SIZE) |
#define | SEFILE_LOGIC_DATA (SEFILE_SECTOR_DATA_SIZE-2) |
#define | SEFILE_SECTOR_OVERHEAD (SEFILE_SECTOR_SIZE-SEFILE_LOGIC_DATA) |
Typedefs | |
typedef struct SEFILE_HANDLE * | SEFILE_FHANDLE |
Functions | |
uint16_t | crypto_filename (char *path, char *enc_name, uint16_t *encoded_length) |
This function computes the encrypted name of the file specified as path. More... | |
Wrappers of SEfile APIs for the SQLite DB engine. | |
These APIs are C wrappers around the C++ APIs of the SEcure Database library. They are called automatically by the custom VFS of SQLite; they are required by SEkey and by the SEcure Database library. They must not be used directly. | |
uint16_t | c_sql_secure_open (char *path, SEFILE_FHANDLE *hFile, int32_t mode, int32_t creation) |
uint16_t | c_sql_secure_write (SEFILE_FHANDLE *hFile, uint8_t *dataIn, uint32_t dataIn_len) |
uint16_t | c_sql_secure_read (SEFILE_FHANDLE *hFile, uint8_t *dataOut, uint32_t dataOut_len, uint32_t *bytesRead) |
uint16_t | c_sql_secure_seek (SEFILE_FHANDLE *hFile, int32_t offset, int32_t *position, uint8_t whence) |
uint16_t | c_sql_secure_truncate (SEFILE_FHANDLE *hFile, uint32_t size) |
uint16_t | c_sql_secure_getfilesize (char *path, uint32_t *position) |
uint16_t | c_secure_sync (SEFILE_FHANDLE *hFile) |
uint16_t | c_secure_close (SEFILE_FHANDLE *hFile) |
This file includes some of the constants, return values and public functions used for implementing a secure file system.
This header file was created moving part of the content of SEfile.h here. This separate header file is required because it must be included by SQLite in order to implement SEkey and to support encrypted SQLite databases based on SEfile.
#define MAX_PATHNAME 256 |
Maximum length for path in OS.
typedef struct SEFILE_HANDLE* SEFILE_FHANDLE |
uint16_t crypto_filename | ( | char * | path, |
char * | enc_name, | ||
uint16_t * | encoded_length | ||
) |
This function computes the encrypted name of the file specified as path.
[in] | path | Absolute or relative path of a file (it must be plaintext, it cannot be a directory). |
[out] | enc_name | Pre-allocated char array where the encrypted filename should be stored. |
[out] | encoded_length | Length of the encrypted filename. |
The encrypted filename is the SHA-256 digest of the original name. It is expressed as a string of 64 characters (HEX format).