le_iks_aesCbc_common.h

Go to the documentation of this file.
1 
2 /*
3  * ====================== WARNING ======================
4  *
5  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
6  * DO NOT MODIFY IN ANY WAY.
7  *
8  * ====================== WARNING ======================
9  */
10 /**
11  * @file le_iks_aesCbc_common.h
12  *
13  * Type definitions for le_iks_aesCbc.
14  *
15  */
16 #ifndef LE_IKS_AESCBC_COMMON_H_INCLUDE_GUARD
17 #define LE_IKS_AESCBC_COMMON_H_INCLUDE_GUARD
18 
19 
20 #include "legato.h"
21 
22 // Interface specific includes
23 #include "le_iks_common.h"
24 
25 #define IFGEN_LE_IKS_AESCBC_PROTOCOL_ID "536d70a245e73ca144ac03fcde2cf08f"
26 #define IFGEN_LE_IKS_AESCBC_MSG_SIZE 4122
27 /** @addtogroup le_iks_aesCbc
28  * @{ **/
29 
30 
31 //--------------------------------------------------------------------------------------------------
32 /**
33  * IV (initialization vector) size in bytes.
34  */
35 //--------------------------------------------------------------------------------------------------
36 #define LE_IKS_AESCBC_IV_SIZE 16
37 
38 
39 //--------------------------------------------------------------------------------------------------
40 /**
41  * Get if this client bound locally.
42  */
43 //--------------------------------------------------------------------------------------------------
44 LE_SHARED bool ifgen_le_iks_aesCbc_HasLocalBinding
45 (
46  void
47 );
48 
49 
50 //--------------------------------------------------------------------------------------------------
51 /**
52  * Init data that is common across all threads
53  */
54 //--------------------------------------------------------------------------------------------------
55 LE_SHARED void ifgen_le_iks_aesCbc_InitCommonData
56 (
57  void
58 );
59 
60 
61 //--------------------------------------------------------------------------------------------------
62 /**
63  * Perform common initialization and open a session
64  */
65 //--------------------------------------------------------------------------------------------------
66 LE_SHARED le_result_t ifgen_le_iks_aesCbc_OpenSession
67 (
68  le_msg_SessionRef_t _ifgen_sessionRef,
69  bool isBlocking
70 );
71 
72 //--------------------------------------------------------------------------------------------------
73 /**
74  * Starts a process to encrypt a message with AES in CBC mode. Calling this function will cancel
75  * any previously started process using the same session.
76  *
77  * To encrypt a message the following sequence should be used:
78  *
79  * le_iks_aesCbc_StartEncrypt() // Start the encryption process.
80  * le_iks_aesCbc_Encrypt() // Call zero or more times until all plaintext is encrypted.
81  *
82  * The initialization vector, IV, does not need to be kept secret but must be unpredictable. Thus
83  * the IV must be generated from a well seeded CPRNG each time this function is called.
84  *
85  * @return
86  * LE_OK if successful.
87  * LE_BAD_PARAMETER if the session reference is invalid
88  * or if the key type is invalid
89  * or if ivPtr is NULL.
90  * LE_UNSUPPORTED if underlying resource does not support this operation.
91  * LE_FAULT if there was an internal error.
92  */
93 //--------------------------------------------------------------------------------------------------
94 LE_SHARED le_result_t ifgen_le_iks_aesCbc_StartEncrypt
95 (
96  le_msg_SessionRef_t _ifgen_sessionRef,
97  uint64_t session,
98  ///< [IN] Session reference.
99  const uint8_t* ivPtr,
100  ///< [IN] Initialization vector.
101  ///< Assumed to be IV_SIZE bytes.
102  size_t ivSize
103  ///< [IN]
104 );
105 
106 //--------------------------------------------------------------------------------------------------
107 /**
108  * Encrypt a chunk of plaintext. le_iks_aesCbc_StartEncrypt() must have been previously called. The
109  * plaintest must be a multiple of the block size. It is up to the caller to pad the plaintext as
110  * needed.
111  *
112  * @return
113  * LE_OK if successful.
114  * LE_BAD_PARAMETER if the session reference is invalid
115  * or if the key type is invalid
116  * or if plaintextChunkPtr or ciphertextChunkPtr is NULL.
117  * LE_OUT_OF_RANGE if textSize is invalid.
118  * LE_UNSUPPORTED if underlying resource does not support this operation.
119  * LE_FAULT if an encryption process has not started.
120  */
121 //--------------------------------------------------------------------------------------------------
122 LE_SHARED le_result_t ifgen_le_iks_aesCbc_Encrypt
123 (
124  le_msg_SessionRef_t _ifgen_sessionRef,
125  uint64_t session,
126  ///< [IN] Session reference.
127  const uint8_t* plaintextChunkPtr,
128  ///< [IN] Plaintext chunk.
129  size_t plaintextChunkSize,
130  ///< [IN]
131  uint8_t* ciphertextChunkPtr,
132  ///< [OUT] Buffer to hold the ciphertext chunk.
133  size_t* ciphertextChunkSizePtr
134  ///< [INOUT]
135 );
136 
137 //--------------------------------------------------------------------------------------------------
138 /**
139  * Starts a process to decrypt a message with AES in CBC mode. Calling this function will cancel
140  * any previously started process using the same session.
141  *
142  * To decrypt a message the following sequence should be used:
143  *
144  * le_iks_aesCbc_StartDecrypt() // Start the decryption process.
145  * le_iks_aesCbc_Decrypt() // Call zero or more times until all ciphertext is decrypted.
146  *
147  * @return
148  * LE_OK if successful.
149  * LE_BAD_PARAMETER if the session reference is invalid
150  * or if the key type is invalid
151  * or if ivPtr is NULL.
152  * LE_UNSUPPORTED if underlying resource does not support this operation.
153  * LE_FAULT if there was an internal error.
154  */
155 //--------------------------------------------------------------------------------------------------
156 LE_SHARED le_result_t ifgen_le_iks_aesCbc_StartDecrypt
157 (
158  le_msg_SessionRef_t _ifgen_sessionRef,
159  uint64_t session,
160  ///< [IN] Session reference.
161  const uint8_t* ivPtr,
162  ///< [IN] Initialization vector.
163  ///< Assumed to be AESCBC_IV_SIZE bytes.
164  size_t ivSize
165  ///< [IN]
166 );
167 
168 //--------------------------------------------------------------------------------------------------
169 /**
170  * Decrypt a chunk of ciphertext. le_iks_aesCbc_StartDecrypt() must have been previously called to
171  * start a decryption process.
172  *
173  * @return
174  * LE_OK if successful.
175  * LE_BAD_PARAMETER if the session reference is invalid.
176  * or if the key type is invalid.
177  * or if plaintextChunkPtr or ciphertextChunkPtr is NULL.
178  * LE_OUT_OF_RANGE if textSize is invalid.
179  * LE_UNSUPPORTED if underlying resource does not support this operation.
180  * LE_FAULT if a decryption process has not started.
181  */
182 //--------------------------------------------------------------------------------------------------
183 LE_SHARED le_result_t ifgen_le_iks_aesCbc_Decrypt
184 (
185  le_msg_SessionRef_t _ifgen_sessionRef,
186  uint64_t session,
187  ///< [IN] Session reference.
188  const uint8_t* ciphertextChunkPtr,
189  ///< [IN] Ciphertext chunk.
190  size_t ciphertextChunkSize,
191  ///< [IN]
192  uint8_t* plaintextChunkPtr,
193  ///< [OUT] Buffer to hold the plaintext chunk.
194  size_t* plaintextChunkSizePtr
195  ///< [INOUT]
196 );
197 /** @} **/
198 #endif // LE_IKS_AESCBC_COMMON_H_INCLUDE_GUARD
#define LE_SHARED
Definition: le_basics.h:287
le_result_t
Definition: le_basics.h:46
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:860