Files | |
file | le_iks_aesCbc_common.h |
file | le_iks_aesCbc_interface.h |
Macros | |
#define | LE_IKS_AESCBC_IV_SIZE 16 |
Typedefs | |
typedef void(* | le_iks_aesCbc_DisconnectHandler_t) (void *) |
Functions | |
void | le_iks_aesCbc_ConnectService (void) |
le_result_t | le_iks_aesCbc_TryConnectService (void) |
LE_FULL_API void | le_iks_aesCbc_SetServerDisconnectHandler (le_iks_aesCbc_DisconnectHandler_t disconnectHandler, void *contextPtr) |
void | le_iks_aesCbc_DisconnectService (void) |
le_result_t | le_iks_aesCbc_StartEncrypt (uint64_t session, const uint8_t *ivPtr, size_t ivSize) |
le_result_t | le_iks_aesCbc_Encrypt (uint64_t session, const uint8_t *plaintextChunkPtr, size_t plaintextChunkSize, uint8_t *ciphertextChunkPtr, size_t *ciphertextChunkSizePtr) |
le_result_t | le_iks_aesCbc_StartDecrypt (uint64_t session, const uint8_t *ivPtr, size_t ivSize) |
le_result_t | le_iks_aesCbc_Decrypt (uint64_t session, const uint8_t *ciphertextChunkPtr, size_t ciphertextChunkSize, uint8_t *plaintextChunkPtr, size_t *plaintextChunkSizePtr) |
Detailed Description
Macro Definition Documentation
◆ LE_IKS_AESCBC_IV_SIZE
#define LE_IKS_AESCBC_IV_SIZE 16 |
IV (initialization vector) size in bytes.
Typedef Documentation
◆ le_iks_aesCbc_DisconnectHandler_t
typedef void(* le_iks_aesCbc_DisconnectHandler_t) (void *) |
Type for handler called when a server disconnects.
Function Documentation
◆ le_iks_aesCbc_ConnectService()
void le_iks_aesCbc_ConnectService | ( | void | ) |
Connect the current client thread to the service providing this API. Block until the service is available.
For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client Specific Functions.
This function is created automatically.
◆ le_iks_aesCbc_Decrypt()
le_result_t le_iks_aesCbc_Decrypt | ( | uint64_t | session, |
const uint8_t * | ciphertextChunkPtr, | ||
size_t | ciphertextChunkSize, | ||
uint8_t * | plaintextChunkPtr, | ||
size_t * | plaintextChunkSizePtr | ||
) |
Decrypt a chunk of ciphertext. le_iks_aesCbc_StartDecrypt() must have been previously called to start a decryption process.
- Returns
- LE_OK if successful. LE_BAD_PARAMETER if the session reference is invalid. or if the key type is invalid. or if plaintextChunkPtr or ciphertextChunkPtr is NULL. LE_OUT_OF_RANGE if textSize is invalid. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if a decryption process has not started.
- Parameters
-
[in] session Session reference. [in] ciphertextChunkPtr Ciphertext chunk. [in] ciphertextChunkSize [out] plaintextChunkPtr Buffer to hold the plaintext chunk. [in,out] plaintextChunkSizePtr
◆ le_iks_aesCbc_DisconnectService()
void le_iks_aesCbc_DisconnectService | ( | void | ) |
Disconnect the current client thread from the service providing this API.
Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client Specific Functions.
This function is created automatically.
◆ le_iks_aesCbc_Encrypt()
le_result_t le_iks_aesCbc_Encrypt | ( | uint64_t | session, |
const uint8_t * | plaintextChunkPtr, | ||
size_t | plaintextChunkSize, | ||
uint8_t * | ciphertextChunkPtr, | ||
size_t * | ciphertextChunkSizePtr | ||
) |
Encrypt a chunk of plaintext. le_iks_aesCbc_StartEncrypt() must have been previously called. The plaintest must be a multiple of the block size. It is up to the caller to pad the plaintext as needed.
- Returns
- LE_OK if successful. LE_BAD_PARAMETER if the session reference is invalid or if the key type is invalid or if plaintextChunkPtr or ciphertextChunkPtr is NULL. LE_OUT_OF_RANGE if textSize is invalid. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if an encryption process has not started.
- Parameters
-
[in] session Session reference. [in] plaintextChunkPtr Plaintext chunk. [in] plaintextChunkSize [out] ciphertextChunkPtr Buffer to hold the ciphertext chunk. [in,out] ciphertextChunkSizePtr
◆ le_iks_aesCbc_SetServerDisconnectHandler()
LE_FULL_API void le_iks_aesCbc_SetServerDisconnectHandler | ( | le_iks_aesCbc_DisconnectHandler_t | disconnectHandler, |
void * | contextPtr | ||
) |
Set handler called when server disconnection is detected.
When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.
◆ le_iks_aesCbc_StartDecrypt()
le_result_t le_iks_aesCbc_StartDecrypt | ( | uint64_t | session, |
const uint8_t * | ivPtr, | ||
size_t | ivSize | ||
) |
Starts a process to decrypt a message with AES in CBC mode. Calling this function will cancel any previously started process using the same session.
To decrypt a message the following sequence should be used:
le_iks_aesCbc_StartDecrypt() // Start the decryption process. le_iks_aesCbc_Decrypt() // Call zero or more times until all ciphertext is decrypted.
- Returns
- LE_OK if successful. LE_BAD_PARAMETER if the session reference is invalid or if the key type is invalid or if ivPtr is NULL. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if there was an internal error.
- Parameters
-
[in] session Session reference. [in] ivPtr Initialization vector. Assumed to be AESCBC_IV_SIZE bytes. [in] ivSize
◆ le_iks_aesCbc_StartEncrypt()
le_result_t le_iks_aesCbc_StartEncrypt | ( | uint64_t | session, |
const uint8_t * | ivPtr, | ||
size_t | ivSize | ||
) |
Starts a process to encrypt a message with AES in CBC mode. Calling this function will cancel any previously started process using the same session.
To encrypt a message the following sequence should be used:
le_iks_aesCbc_StartEncrypt() // Start the encryption process. le_iks_aesCbc_Encrypt() // Call zero or more times until all plaintext is encrypted.
The initialization vector, IV, does not need to be kept secret but must be unpredictable. Thus the IV must be generated from a well seeded CPRNG each time this function is called.
- Returns
- LE_OK if successful. LE_BAD_PARAMETER if the session reference is invalid or if the key type is invalid or if ivPtr is NULL. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if there was an internal error.
- Parameters
-
[in] session Session reference. [in] ivPtr Initialization vector. Assumed to be IV_SIZE bytes. [in] ivSize
◆ le_iks_aesCbc_TryConnectService()
le_result_t le_iks_aesCbc_TryConnectService | ( | void | ) |
Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.
For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client Specific Functions.
This function is created automatically.
- Returns
- LE_OK if the client connected successfully to the service.
- LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
- LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
- LE_COMM_ERROR if the Service Directory cannot be reached.