le_iks_aesGcm_interface.h
Go to the documentation of this file.
44 //--------------------------------------------------------------------------------------------------48 //--------------------------------------------------------------------------------------------------51 //--------------------------------------------------------------------------------------------------54 * Connect the current client thread to the service providing this API. Block until the service is58 * called before any other functions in this API. Normally, ConnectService is automatically called63 //--------------------------------------------------------------------------------------------------69 //--------------------------------------------------------------------------------------------------72 * Try to connect the current client thread to the service providing this API. Return with an error76 * called before any other functions in this API. Normally, ConnectService is automatically called85 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).88 //--------------------------------------------------------------------------------------------------94 //--------------------------------------------------------------------------------------------------98 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants101 //--------------------------------------------------------------------------------------------------108 //--------------------------------------------------------------------------------------------------114 * longer a connection to the service, and the functions in this API can't be used. For details, see119 //--------------------------------------------------------------------------------------------------126 //--------------------------------------------------------------------------------------------------130 * GCM is an AEAD (Authenticated Encryption with Associated Data) which means that it provides both131 * confidentiality and integrity protection for plaintext data and provides integrity protection for132 * associated data. The associated data, also referred to as Additional Authenticated Data (AAD),133 * is not encrypted but is integrity protected. The output of the encryption is a randomly chosen146 * This is especially useful in communication protocols where a packet's payload needs to be secret149 * The AAD and plaintext are optional but they cannot both be omitted. If the AAD is omitted then153 * The ciphertext size is the same as the plaintext size and it is assumed that the ciphertextPtr156 * The tag size is always LE_IKS_AES_GCM_TAG_SIZE bytes and it is assumed that the tagPtr buffer is168 * Repeated nonces in GCM are particularly problematic as they can be used to recover the integrity181 //--------------------------------------------------------------------------------------------------211 //--------------------------------------------------------------------------------------------------242 //--------------------------------------------------------------------------------------------------272 //--------------------------------------------------------------------------------------------------294 * world. This is a critical security requirement but can be difficult to satisfy. Therefore keys305 //--------------------------------------------------------------------------------------------------317 //--------------------------------------------------------------------------------------------------319 * Process a chunk of AAD (Additional Authenticated Data). Either le_iks_aesGcm_StartEncrypt() or320 * le_iks_aesGcm_StartDecrypt() must have been previously called to start either an encryption or333 //--------------------------------------------------------------------------------------------------345 //--------------------------------------------------------------------------------------------------347 * Encrypt a chunk of plaintext. le_iks_aesGcm_StartEncrypt() must have been previously called to359 //--------------------------------------------------------------------------------------------------374 //--------------------------------------------------------------------------------------------------387 //--------------------------------------------------------------------------------------------------399 //--------------------------------------------------------------------------------------------------401 * Starts a process to decrypt and verify the integrity of a long packet with AES in GCM mode. This427 //--------------------------------------------------------------------------------------------------439 //--------------------------------------------------------------------------------------------------441 * Decrypt a chunk of ciphertext. le_iks_aesGcm_StartDecrypt() must have been previously called to453 //--------------------------------------------------------------------------------------------------468 //--------------------------------------------------------------------------------------------------482 //--------------------------------------------------------------------------------------------------le_result_t le_iks_aesGcm_Decrypt(uint64_t session, const uint8_t *ciphertextChunkPtr, size_t ciphertextChunkSize, uint8_t *plaintextChunkPtr, size_t *plaintextChunkSizePtr)void(* le_iks_aesGcm_DisconnectHandler_t)(void *)Definition: le_iks_aesGcm_interface.h:49void le_iks_aesGcm_ConnectService(void)le_result_t le_iks_aesGcm_ProcessAad(uint64_t session, const uint8_t *aadPtr, size_t aadSize)LE_FULL_API void le_iks_aesGcm_SetServerDisconnectHandler(le_iks_aesGcm_DisconnectHandler_t disconnectHandler, void *contextPtr)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_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_Encrypt(uint64_t session, const uint8_t *plaintextChunkPtr, size_t plaintextChunkSize, uint8_t *ciphertextChunkPtr, size_t *ciphertextChunkSizePtr)le_result_t le_iks_aesGcm_DoneEncrypt(uint64_t session, uint8_t *tagPtr, size_t *tagSizePtr)le_result_t le_iks_aesGcm_DoneDecrypt(uint64_t session, const uint8_t *tagPtr, size_t tagSize)le_result_t le_iks_aesGcm_TryConnectService(void)void le_iks_aesGcm_DisconnectService(void)le_result_t le_iks_aesGcm_StartDecrypt(uint64_t session, const uint8_t *noncePtr, size_t nonceSize)le_result_t le_iks_aesGcm_StartEncrypt(uint64_t session, uint8_t *noncePtr, size_t *nonceSizePtr)