le_iks_aesGcm_interface.h
Go to the documentation of this file.
48 //--------------------------------------------------------------------------------------------------52 //--------------------------------------------------------------------------------------------------55 //--------------------------------------------------------------------------------------------------58 * Connect the current client thread to the service providing this API. Block until the service is62 * called before any other functions in this API. Normally, ConnectService is automatically called67 //--------------------------------------------------------------------------------------------------73 //--------------------------------------------------------------------------------------------------76 * Try to connect the current client thread to the service providing this API. Return with an error80 * called before any other functions in this API. Normally, ConnectService is automatically called89 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).92 //--------------------------------------------------------------------------------------------------98 //--------------------------------------------------------------------------------------------------102 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants105 //--------------------------------------------------------------------------------------------------112 //--------------------------------------------------------------------------------------------------118 * longer a connection to the service, and the functions in this API can't be used. For details, see123 //--------------------------------------------------------------------------------------------------130 //--------------------------------------------------------------------------------------------------134 * GCM is an AEAD (Authenticated Encryption with Associated Data) which means that it provides both135 * confidentiality and integrity protection for plaintext data and provides integrity protection for136 * associated data. The associated data, also referred to as Additional Authenticated Data (AAD),137 * is not encrypted but is integrity protected. The output of the encryption is a randomly chosen150 * This is especially useful in communication protocols where a packet's payload needs to be secret153 * The AAD and plaintext are optional but they cannot both be omitted. If the AAD is omitted then157 * The ciphertext size is the same as the plaintext size and it is assumed that the ciphertextPtr160 * The tag size is always LE_IKS_AES_GCM_TAG_SIZE bytes and it is assumed that the tagPtr buffer is172 * Repeated nonces in GCM are particularly problematic as they can be used to recover the integrity185 //--------------------------------------------------------------------------------------------------215 //--------------------------------------------------------------------------------------------------246 //--------------------------------------------------------------------------------------------------276 //--------------------------------------------------------------------------------------------------298 * world. This is a critical security requirement but can be difficult to satisfy. Therefore keys309 //--------------------------------------------------------------------------------------------------321 //--------------------------------------------------------------------------------------------------323 * Process a chunk of AAD (Additional Authenticated Data). Either le_iks_aesGcm_StartEncrypt() or324 * le_iks_aesGcm_StartDecrypt() must have been previously called to start either an encryption or337 //--------------------------------------------------------------------------------------------------349 //--------------------------------------------------------------------------------------------------351 * Encrypt a chunk of plaintext. le_iks_aesGcm_StartEncrypt() must have been previously called to363 //--------------------------------------------------------------------------------------------------378 //--------------------------------------------------------------------------------------------------391 //--------------------------------------------------------------------------------------------------403 //--------------------------------------------------------------------------------------------------405 * Starts a process to decrypt and verify the integrity of a long packet with AES in GCM mode. This431 //--------------------------------------------------------------------------------------------------443 //--------------------------------------------------------------------------------------------------445 * Decrypt a chunk of ciphertext. le_iks_aesGcm_StartDecrypt() must have been previously called to457 //--------------------------------------------------------------------------------------------------472 //--------------------------------------------------------------------------------------------------486 //--------------------------------------------------------------------------------------------------void(* le_iks_aesGcm_DisconnectHandler_t)(void *)Definition: le_iks_aesGcm_interface.h:53le_result_t le_iks_aesGcm_EncryptPacket(uint64_t keyRef, uint8_t *noncePtr, size_t *nonceSizePtr, const uint8_t *aadPtr, size_t aadSize, const uint8_t *plaintextPtr, size_t plaintextSize, uint8_t *ciphertextPtr, size_t *ciphertextSizePtr, uint8_t *tagPtr, size_t *tagSizePtr)le_result_t le_iks_aesGcm_DoneEncrypt(uint64_t session, uint8_t *tagPtr, size_t *tagSizePtr)void le_iks_aesGcm_ConnectService(void)le_result_t le_iks_aesGcm_Encrypt(uint64_t session, const uint8_t *plaintextChunkPtr, size_t plaintextChunkSize, uint8_t *ciphertextChunkPtr, size_t *ciphertextChunkSizePtr)le_result_t le_iks_aesGcm_StartDecrypt(uint64_t session, const uint8_t *noncePtr, size_t nonceSize)le_result_t le_iks_aesGcm_ProcessAad(uint64_t session, const uint8_t *aadPtr, size_t aadSize)le_result_t le_iks_aesGcm_DecryptPacket(uint64_t keyRef, const uint8_t *noncePtr, size_t nonceSize, const uint8_t *aadPtr, size_t aadSize, const uint8_t *ciphertextPtr, size_t ciphertextSize, uint8_t *plaintextPtr, size_t *plaintextSizePtr, const uint8_t *tagPtr, size_t tagSize)le_result_t le_iks_aesGcm_Decrypt(uint64_t session, const uint8_t *ciphertextChunkPtr, size_t ciphertextChunkSize, uint8_t *plaintextChunkPtr, size_t *plaintextChunkSizePtr)le_result_t le_iks_aesGcm_DoneDecrypt(uint64_t session, const uint8_t *tagPtr, size_t tagSize)void le_iks_aesGcm_DisconnectService(void)le_result_t le_iks_aesGcm_StartEncrypt(uint64_t session, uint8_t *noncePtr, size_t *nonceSizePtr)le_result_t le_iks_aesGcm_TryConnectService(void)LE_FULL_API void le_iks_aesGcm_SetServerDisconnectHandler(le_iks_aesGcm_DisconnectHandler_t disconnectHandler, void *contextPtr)