le_iks_hmac_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_hmac_common.h
12  *
13  * Type definitions for le_iks_hmac.
14  *
15  */
16 #ifndef LE_IKS_HMAC_COMMON_H_INCLUDE_GUARD
17 #define LE_IKS_HMAC_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_HMAC_PROTOCOL_ID "afa7a51924e934df0a03705d2524c00d"
26 #define IFGEN_LE_IKS_HMAC_MSG_SIZE 4116
27 /** @addtogroup le_iks_hmac
28  * @{ **/
29 
30 
31 //--------------------------------------------------------------------------------------------------
32 /**
33  * Maximum tag sizes in bytes.
34  */
35 //--------------------------------------------------------------------------------------------------
36 #define LE_IKS_HMAC_MAX_TAG_SIZE 64
37 
38 
39 //--------------------------------------------------------------------------------------------------
40 /**
41  * Get if this client bound locally.
42  */
43 //--------------------------------------------------------------------------------------------------
44 LE_SHARED bool ifgen_le_iks_hmac_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_hmac_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_hmac_OpenSession
67 (
68  le_msg_SessionRef_t _ifgen_sessionRef,
69  bool isBlocking
70 );
71 
72 //--------------------------------------------------------------------------------------------------
73 /**
74  * Process message chunks. This function may be called multiple times to process the entire
75  * message but once a message has been completely processed and le_iks_hmac_Done() or
76  * le_iks_hmac_Verify() has been called this function should not be called again with the same
77  * session.
78  *
79  * @return
80  * LE_OK if successful.
81  * LE_BAD_PARAMETER if the session reference is invalid
82  * or if the key type is invalid
83  * or if msgChunkPtr is NULL.
84  * LE_UNSUPPORTED if underlying resource does not support this operation.
85  * LE_FAULT if no more messages can be processed, ie. le_iks_hmac_Done() or
86  * le_iks_hmac_Verify() has already been called,
87  * or if there was an internal error.
88  */
89 //--------------------------------------------------------------------------------------------------
90 LE_SHARED le_result_t ifgen_le_iks_hmac_ProcessChunk
91 (
92  le_msg_SessionRef_t _ifgen_sessionRef,
93  uint64_t session,
94  ///< [IN] Session reference.
95  const uint8_t* msgChunkPtr,
96  ///< [IN] Message chunk.
97  size_t msgChunkSize
98  ///< [IN]
99 );
100 
101 //--------------------------------------------------------------------------------------------------
102 /**
103  * Complete message processing and get the processed message's authentication tag.
104  *
105  * The maximum size of the authentication tag is the size of the output of the underlying hash
106  * function. For example, if the key is of type KEY_TYPE_HMAC_SHA256 then the maximum tag size
107  * is 32 bytes.
108  *
109  * If the supplied buffer is larger than or equal to the maximum authentication tag size then the
110  * full authentication tag is copied to the buffer and the rest of the buffer is left unmodified.
111  *
112  * If the supplied buffer is smaller than the maximum tag size then the tag will be truncated.
113  * However, all tags produced using the same key must use the same tag size. It is up to the caller
114  * to ensure this.
115  *
116  * @return
117  * LE_OK if successful.
118  * LE_BAD_PARAMETER if the session reference is invalid
119  * or if the key type is invalid
120  * or if bufPtr is NULL.
121  * LE_UNSUPPORTED if underlying resource does not support this operation.
122  * LE_FAULT if no message was processed or le_iks_hmac_Done() or
123  * le_iks_hmac_Verify() has already been called,
124  * or if there was an internal error.
125  */
126 //--------------------------------------------------------------------------------------------------
127 LE_SHARED le_result_t ifgen_le_iks_hmac_Done
128 (
129  le_msg_SessionRef_t _ifgen_sessionRef,
130  uint64_t session,
131  ///< [IN] Session reference.
132  uint8_t* tagBufPtr,
133  ///< [OUT] Buffer to hold the authentication tag.
134  size_t* tagBufSizePtr
135  ///< [INOUT]
136 );
137 
138 //--------------------------------------------------------------------------------------------------
139 /**
140  * Complete message processing and compare the resulting authentication tag with the supplied tag.
141  *
142  * The maximum size of the authentication tag is the size of the output of the underlying hash
143  * function. For example, if the key is of type KEY_TYPE_HMAC_SHA256 then the maximum tag size
144  * is 32 bytes.
145  *
146  * If the supplied tag is larger than or equal to the maximum authentication tag size then the
147  * authentication will fail.
148  *
149  * If the supplied tag is smaller than the maximum tag size then only the first tagSize bytes will
150  * be compared.
151  *
152  * All tags produced using the same key must use the same tag size. It is up to the caller
153  * to ensure this.
154  *
155  * @return
156  * LE_OK if the specified tag matches the calculated message tag.
157  * LE_BAD_PARAMETER if the session reference is invalid
158  * or if the key type is invalid
159  * or if tagPtr is NULL or tagSize is zero.
160  * LE_UNSUPPORTED if underlying resource does not support this operation.
161  * LE_FAULT if the specified tag does not match the calculated message tag,
162  * or if no message was processed or le_iks_hmac_Done() or
163  * or le_iks_hmac_Verify() has already been called,
164  * or if there was an internal error.
165  */
166 //--------------------------------------------------------------------------------------------------
167 LE_SHARED le_result_t ifgen_le_iks_hmac_Verify
168 (
169  le_msg_SessionRef_t _ifgen_sessionRef,
170  uint64_t session,
171  ///< [IN] Session reference.
172  const uint8_t* tagBufPtr,
173  ///< [IN] Authentication tag to check against.
174  size_t tagBufSize
175  ///< [IN]
176 );
177 /** @} **/
178 #endif // LE_IKS_HMAC_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