Skip to content

Commit 31b7a90

Browse files
use boolean array for group permissions, fix permissions bitmask, remove unused enum
1 parent 4a6d222 commit 31b7a90

10 files changed

Lines changed: 86 additions & 98 deletions

File tree

examples/demo/client/wh_demo_client_auth.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,14 @@ static int wh_DemoClient_AuthUserSetPermissions(whClientContext* clientContext)
377377

378378
/* Enable CRYPTO group and all CRYPTO actions */
379379
memset(&permissions, 0, sizeof(permissions));
380-
permissions.groupPermissions |= WH_MESSAGE_GROUP_CRYPTO;
381-
380+
382381
/* Enable all CRYPTO actions by setting all bits in all words, an example of
383382
* a CRYPTO action is WC_ALGO_TYPE_CIPHER or WC_ALGO_TYPE_PK */
384383
{
385384
int groupIndex = (WH_MESSAGE_GROUP_CRYPTO >> 8) & 0xFF;
386385
int wordIndex;
386+
/* Enable access to CRYPTO group */
387+
permissions.groupPermissions[groupIndex] = 1;
387388
/* Set all action bits for CRYPTO group (allows all actions) */
388389
for (wordIndex = 0; wordIndex < WH_AUTH_ACTION_WORDS; wordIndex++) {
389390
permissions.actionPermissions[groupIndex][wordIndex] = 0xFFFFFFFF;

port/posix/posix_auth.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static whAuthBase_User* posixAuth_CheckCertificate(const char* username,
181181

182182
int posixAuth_Login(void* context, uint8_t client_id, whAuthMethod method,
183183
const char* username, const void* auth_data,
184-
uint16_t auth_data_len, uint16_t* out_user_id,
184+
uint16_t auth_data_len, whUserId* out_user_id,
185185
whAuthPermissions* out_permissions, int* loggedIn)
186186
{
187187
whAuthBase_User* current_user = NULL;
@@ -277,7 +277,7 @@ int posixAuth_CheckKeyAuthorization(void* context, int err, uint16_t user_id,
277277

278278

279279
int posixAuth_UserAdd(void* context, const char* username,
280-
uint16_t* out_user_id, whAuthPermissions permissions,
280+
whUserId* out_user_id, whAuthPermissions permissions,
281281
whAuthMethod method, const void* credentials,
282282
uint16_t credentials_len)
283283
{
@@ -420,7 +420,7 @@ int posixAuth_UserSetPermissions(void* context, uint16_t current_user_id,
420420

421421

422422
int posixAuth_UserGet(void* context, const char* username,
423-
uint16_t* out_user_id,
423+
whUserId* out_user_id,
424424
whAuthPermissions* out_permissions)
425425
{
426426
whAuthBase_User* user = posixAuth_FindUser(username);

port/posix/posix_auth.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int posixAuth_Cleanup(void* context);
6666
*/
6767
int posixAuth_Login(void* context, uint8_t client_id, whAuthMethod method,
6868
const char* username, const void* auth_data,
69-
uint16_t auth_data_len, uint16_t* out_user_id,
69+
uint16_t auth_data_len, whUserId* out_user_id,
7070
whAuthPermissions* out_permissions, int* loggedIn);
7171

7272
/**
@@ -111,7 +111,7 @@ int posixAuth_CheckKeyAuthorization(void* context, int err, uint16_t user_id,
111111
* @return int Returns 0 on success, or a negative error code on failure.
112112
*/
113113
int posixAuth_UserAdd(void* context, const char* username,
114-
uint16_t* out_user_id, whAuthPermissions permissions,
114+
whUserId* out_user_id, whAuthPermissions permissions,
115115
whAuthMethod method, const void* credentials,
116116
uint16_t credentials_len);
117117

@@ -149,7 +149,7 @@ int posixAuth_UserSetPermissions(void* context, uint16_t current_user_id,
149149
* @return int Returns 0 on success, or a negative error code on failure.
150150
*/
151151
int posixAuth_UserGet(void* context, const char* username,
152-
uint16_t* out_user_id,
152+
whUserId* out_user_id,
153153
whAuthPermissions* out_permissions);
154154

155155
/**
@@ -171,4 +171,4 @@ int posixAuth_UserSetCredentials(void* context, uint16_t user_id,
171171
const void* new_credentials,
172172
uint16_t new_credentials_len);
173173

174-
#endif /* PORT_POSIX_POSIX_AUTH_H_ */
174+
#endif /* PORT_POSIX_POSIX_AUTH_H_ */

src/wh_auth.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,15 @@ int wh_Auth_CheckRequestAuthorization(whAuthContext* context, uint16_t group,
189189
rc = WH_ERROR_OK;
190190
}
191191
else {
192-
if (user->permissions.groupPermissions & group) {
192+
if (user->permissions.groupPermissions[groupIndex]) {
193193
/* Check if action is within supported range */
194194
if (action < WH_AUTH_ACTIONS_PER_GROUP) {
195195
/* Get word index and bitmask for this action */
196-
uint32_t wordAndBit = WH_AUTH_ACTION_TO_WORD_AND_BIT(action);
197-
uint32_t wordIndex = WH_AUTH_ACTION_WORD(wordAndBit);
198-
uint32_t bitmask = WH_AUTH_ACTION_BIT(wordAndBit);
196+
uint32_t wordIndex;
197+
uint32_t bitmask;
198+
199+
WH_AUTH_ACTION_TO_WORD_AND_BITMASK(action, wordIndex,
200+
bitmask);
199201

200202
if (wordIndex < WH_AUTH_ACTION_WORDS &&
201203
(user->permissions.actionPermissions[groupIndex]
@@ -255,9 +257,6 @@ int wh_Auth_CheckKeyAuthorization(whAuthContext* context, uint32_t key_id,
255257
}
256258
}
257259

258-
(void)context;
259-
(void)action; /* Action could be used for future fine-grained key access
260-
control */
261260
if (context->cb->CheckKeyAuthorization != NULL) {
262261
rc = context->cb->CheckKeyAuthorization(context->context, rc,
263262
user_id, key_id, action);

src/wh_message_auth.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,21 @@ int wh_MessageAuth_FlattenPermissions(whAuthPermissions* permissions,
126126
return WH_ERROR_BADARGS;
127127
}
128128

129-
/* Serialize groupPermissions (2 bytes) */
130-
buffer[idx++] = (uint8_t)(permissions->groupPermissions & 0xFF);
131-
buffer[idx++] = (uint8_t)((permissions->groupPermissions >> 8) & 0xFF);
129+
/* Serialize groupPermissions array (WH_NUMBER_OF_GROUPS bytes) */
130+
for (i = 0; i < WH_NUMBER_OF_GROUPS; i++) {
131+
buffer[idx++] = permissions->groupPermissions[i];
132+
}
132133

133-
/* Serialize actionPermissions array (4*WH_NUMBER_OF_GROUPS*WH_AUTH_ACTION_WORDS bytes) */
134+
/* Serialize actionPermissions array
135+
* (4*WH_NUMBER_OF_GROUPS*WH_AUTH_ACTION_WORDS bytes) */
134136
for (i = 0; i < WH_NUMBER_OF_GROUPS; i++) {
135137
int j;
136138
for (j = 0; j < WH_AUTH_ACTION_WORDS; j++) {
137139
uint32_t actionPerm = permissions->actionPermissions[i][j];
138-
buffer[idx++] = (uint8_t)(actionPerm & 0xFF);
139-
buffer[idx++] = (uint8_t)((actionPerm >> 8) & 0xFF);
140-
buffer[idx++] = (uint8_t)((actionPerm >> 16) & 0xFF);
141-
buffer[idx++] = (uint8_t)((actionPerm >> 24) & 0xFF);
140+
buffer[idx++] = (uint8_t)(actionPerm & 0xFF);
141+
buffer[idx++] = (uint8_t)((actionPerm >> 8) & 0xFF);
142+
buffer[idx++] = (uint8_t)((actionPerm >> 16) & 0xFF);
143+
buffer[idx++] = (uint8_t)((actionPerm >> 24) & 0xFF);
142144
}
143145
}
144146

@@ -179,25 +181,25 @@ int wh_MessageAuth_UnflattenPermissions(uint8_t* buffer, uint16_t buffer_len,
179181
return WH_ERROR_BADARGS;
180182
}
181183

182-
/* Deserialize groupPermissions (2 bytes) */
183-
permissions->groupPermissions = buffer[idx] | (buffer[idx + 1] << 8);
184-
idx += 2;
184+
/* Deserialize groupPermissions array (WH_NUMBER_OF_GROUPS bytes) */
185+
for (i = 0; i < WH_NUMBER_OF_GROUPS; i++) {
186+
permissions->groupPermissions[i] = buffer[idx++];
187+
}
185188

186-
/* Deserialize actionPermissions array (4*WH_NUMBER_OF_GROUPS*WH_AUTH_ACTION_WORDS bytes) */
189+
/* Deserialize actionPermissions array
190+
* (4*WH_NUMBER_OF_GROUPS*WH_AUTH_ACTION_WORDS bytes) */
187191
for (i = 0; i < WH_NUMBER_OF_GROUPS; i++) {
188192
int j;
189193
for (j = 0; j < WH_AUTH_ACTION_WORDS; j++) {
190194
permissions->actionPermissions[i][j] =
191-
buffer[idx] |
192-
(buffer[idx + 1] << 8) |
193-
(buffer[idx + 2] << 16) |
194-
(buffer[idx + 3] << 24);
195+
(uint32_t)(buffer[idx] | (buffer[idx + 1] << 8) |
196+
(buffer[idx + 2] << 16) | (buffer[idx + 3] << 24));
195197
idx += 4;
196198
}
197199
}
198200

199201
/* Deserialize keyIdCount (2 bytes) */
200-
keyIdCount = buffer[idx] | (buffer[idx + 1] << 8);
202+
keyIdCount = (uint16_t)(buffer[idx] | (buffer[idx + 1] << 8));
201203
idx += 2;
202204
if (keyIdCount > WH_AUTH_MAX_KEY_IDS) {
203205
keyIdCount = WH_AUTH_MAX_KEY_IDS;
@@ -206,10 +208,8 @@ int wh_MessageAuth_UnflattenPermissions(uint8_t* buffer, uint16_t buffer_len,
206208

207209
/* Deserialize keyIds array (4*WH_AUTH_MAX_KEY_IDS bytes) */
208210
for (i = 0; i < WH_AUTH_MAX_KEY_IDS; i++) {
209-
keyId = buffer[idx] |
210-
(buffer[idx + 1] << 8) |
211-
(buffer[idx + 2] << 16) |
212-
(buffer[idx + 3] << 24);
211+
keyId = (uint32_t)(buffer[idx] | (buffer[idx + 1] << 8) |
212+
(buffer[idx + 2] << 16) | (buffer[idx + 3] << 24));
213213
permissions->keyIds[i] = keyId;
214214
idx += 4;
215215
}

src/wh_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static int _wh_Server_HandlePkcs11Request(whServerContext* server,
315315
/* Helper to format an authorization error response for any group/action.
316316
* All response structures have int32_t rc as the first field.
317317
* Returns the response size to send. */
318-
static uint16_t _wh_Server_FormatAuthErrorResponse(uint16_t magic,
318+
static uint16_t _FormatAuthErrorResponse(uint16_t magic,
319319
uint16_t group,
320320
uint16_t action,
321321
int32_t error_code,
@@ -524,7 +524,7 @@ int wh_Server_HandleRequestMessage(whServerContext* server)
524524
/* Authorization failed - format and send error response to
525525
* client */
526526
int32_t error_code = (int32_t)WH_AUTH_PERMISSION_ERROR;
527-
uint16_t resp_size = _wh_Server_FormatAuthErrorResponse(
527+
uint16_t resp_size = _FormatAuthErrorResponse(
528528
magic, group, action, error_code, data);
529529

530530
/* Send error response to client */

test/wh_test_auth.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -856,13 +856,14 @@ int whTest_AuthSetPermissions(whClientContext* client)
856856
/* Test 2b: Set user permissions success path */
857857
WH_TEST_PRINT(" Test: Set user permissions success\n");
858858
memset(&new_perms, 0, sizeof(new_perms));
859-
new_perms.groupPermissions = WH_MESSAGE_GROUP_AUTH;
860859
/* Convert action enum value to bitmask: action 0x04 -> word 0, bit 4 -> 0x10 */
861860
{
862-
int groupIndex = (WH_MESSAGE_GROUP_AUTH >> 8) & 0xFF;
863-
uint32_t wordAndBit = WH_AUTH_ACTION_TO_WORD_AND_BIT(WH_MESSAGE_AUTH_ACTION_USER_ADD);
864-
uint32_t wordIndex = WH_AUTH_ACTION_WORD(wordAndBit);
865-
uint32_t bitmask = WH_AUTH_ACTION_BIT(wordAndBit);
861+
int groupIndex = (WH_MESSAGE_GROUP_AUTH >> 8) & 0xFF;
862+
uint32_t wordIndex;
863+
uint32_t bitmask;
864+
WH_AUTH_ACTION_TO_WORD_AND_BITMASK(WH_MESSAGE_AUTH_ACTION_USER_ADD,
865+
wordIndex, bitmask);
866+
new_perms.groupPermissions[groupIndex] = 1;
866867
new_perms.actionPermissions[groupIndex][wordIndex] = bitmask;
867868
}
868869
server_rc = 0;
@@ -878,13 +879,14 @@ int whTest_AuthSetPermissions(whClientContext* client)
878879
client, "testuser3", &get_rc, &fetched_user_id, &fetched_perms));
879880
WH_TEST_ASSERT_RETURN(get_rc == WH_ERROR_OK);
880881
WH_TEST_ASSERT_RETURN(fetched_user_id == user_id);
881-
WH_TEST_ASSERT_RETURN(fetched_perms.groupPermissions ==
882-
new_perms.groupPermissions);
883882
{
884-
/* Compare all action permission words for this group */
885-
int groupIndex = (WH_MESSAGE_GROUP_AUTH >> 8) & 0xFF;
883+
/* Compare group permission and all action permission words */
884+
int groupIndex = (WH_MESSAGE_GROUP_AUTH >> 8) & 0xFF;
886885
int j;
887886
int permissions_match = 1;
887+
/* Verify groupPermissions for this group */
888+
WH_TEST_ASSERT_RETURN(fetched_perms.groupPermissions[groupIndex] ==
889+
new_perms.groupPermissions[groupIndex]);
888890
for (j = 0; j < WH_AUTH_ACTION_WORDS; j++) {
889891
if (fetched_perms.actionPermissions[groupIndex][j] !=
890892
new_perms.actionPermissions[groupIndex][j]) {
@@ -1105,13 +1107,14 @@ int whTest_AuthRequestAuthorization(whClientContext* client)
11051107
WH_TEST_ASSERT_RETURN(server_rc == WH_ERROR_OK);
11061108

11071109
memset(&perms, 0, sizeof(perms));
1108-
perms.groupPermissions = WH_MESSAGE_GROUP_AUTH;
11091110
/* Convert action enum value to bitmask: action 0x04 -> word 0, bit 4 -> 0x10 */
11101111
{
1111-
int groupIndex = (WH_MESSAGE_GROUP_AUTH >> 8) & 0xFF;
1112-
uint32_t wordAndBit = WH_AUTH_ACTION_TO_WORD_AND_BIT(WH_MESSAGE_AUTH_ACTION_USER_ADD);
1113-
uint32_t wordIndex = WH_AUTH_ACTION_WORD(wordAndBit);
1114-
uint32_t bitmask = WH_AUTH_ACTION_BIT(wordAndBit);
1112+
int groupIndex = (WH_MESSAGE_GROUP_AUTH >> 8) & 0xFF;
1113+
uint32_t wordIndex;
1114+
uint32_t bitmask;
1115+
WH_AUTH_ACTION_TO_WORD_AND_BITMASK(WH_MESSAGE_AUTH_ACTION_USER_ADD,
1116+
wordIndex, bitmask);
1117+
perms.groupPermissions[groupIndex] = 1;
11151118
perms.actionPermissions[groupIndex][wordIndex] = bitmask;
11161119
}
11171120
WH_TEST_RETURN_ON_FAIL(

wolfhsm/wh_auth.h

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <stdbool.h>
4141

4242
#include "wolfhsm/wh_common.h"
43+
#include "wolfhsm/wh_message.h" /* for WH_NUMBER_OF_GROUPS */
4344

4445
/** Auth Manager Types */
4546

@@ -54,27 +55,23 @@ typedef enum {
5455
WH_AUTH_METHOD_CERTIFICATE,
5556
} whAuthMethod;
5657

57-
#define WH_NUMBER_OF_GROUPS 14
5858
#define WH_AUTH_MAX_KEY_IDS \
5959
2 /* Maximum number of key IDs a user can have access to */
6060
#define WH_AUTH_ACTIONS_PER_GROUP 256 /* Support up to 256 actions (0-255) */
6161
#define WH_AUTH_ACTION_WORDS \
6262
((WH_AUTH_ACTIONS_PER_GROUP + 31) / 32) /* 8 uint32_t words for 256 bits */
6363

64-
/* Convert action enum value (0-255) to bitmask and word index.
65-
* Returns the word index in the upper 16 bits and bitmask in lower 32 bits.
66-
* Use WH_AUTH_ACTION_WORD() and WH_AUTH_ACTION_BIT() to extract. */
67-
#define WH_AUTH_ACTION_TO_WORD_AND_BIT(_action) \
68-
((((_action) / 32) << 16) | (1UL << ((_action) % 32)))
69-
#define WH_AUTH_ACTION_WORD(_word_and_bit) (((_word_and_bit) >> 16) & 0xFF)
70-
#define WH_AUTH_ACTION_BIT(_word_and_bit) ((_word_and_bit) & 0xFFFFFFFFUL)
71-
72-
/* Legacy macro for backward compatibility - only works for actions < 32 */
73-
#define WH_AUTH_ACTION_TO_BITMASK(_action) \
74-
(((_action) < 32) ? (1UL << (_action)) : 0)
64+
/* Convert action enum value (0-255) to word index and bitmask.
65+
* Sets wordIdx to the array index (0-7) and bitMask to the bit position. */
66+
#define WH_AUTH_ACTION_TO_WORD_AND_BITMASK(action, wordIdx, bitMask) \
67+
do { \
68+
(wordIdx) = ((action) / 32); \
69+
(bitMask) = (1UL << ((action) % 32)); \
70+
} while (0)
7571

7672
typedef struct {
77-
uint16_t groupPermissions; /* bit mask of if allowed for use in group */
73+
uint8_t groupPermissions[WH_NUMBER_OF_GROUPS]; /* boolean array of if group
74+
is allowed */
7875
uint32_t actionPermissions[WH_NUMBER_OF_GROUPS]
7976
[WH_AUTH_ACTION_WORDS]; /* multi-word bit array
8077
for action permissions
@@ -155,8 +152,6 @@ typedef struct whAuthContext_t {
155152
void* context;
156153
} whAuthContext;
157154

158-
#define WOLFHSM_MAX_CERTIFICATE_LEN 2048
159-
160155
/* Simple helper configuration structure associated with an Auth Manager
161156
* instance */
162157
typedef struct whAuthConfig_t {

wolfhsm/wh_message.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ enum WH_MESSAGE_ENUM {
5252
WH_MESSAGE_ACTION_MASK = 0x00FF, /* 255 subtypes per group*/
5353
WH_MESSAGE_ACTION_NONE = 0x0000, /* No action. Invalid. */
5454
};
55+
#define WH_NUMBER_OF_GROUPS 14
5556

5657
/* keystore actions */
5758
enum WH_KEY_ENUM {
@@ -101,12 +102,13 @@ enum {
101102

102103
/* auth actions */
103104
enum {
104-
WH_AUTH_ACTION_LOGIN,
105-
WH_AUTH_ACTION_LOGOUT,
106-
WH_AUTH_ACTION_USER_ADD,
107-
WH_AUTH_ACTION_USER_DELETE,
108-
WH_AUTH_ACTION_USER_MODIFY,
109-
WH_AUTH_ACTION_PERMISSION_SET,
105+
WH_MESSAGE_AUTH_ACTION_LOGIN,
106+
WH_MESSAGE_AUTH_ACTION_LOGOUT,
107+
WH_MESSAGE_AUTH_ACTION_USER_ADD,
108+
WH_MESSAGE_AUTH_ACTION_USER_DELETE,
109+
WH_MESSAGE_AUTH_ACTION_USER_GET,
110+
WH_MESSAGE_AUTH_ACTION_USER_SET_PERMISSIONS,
111+
WH_MESSAGE_AUTH_ACTION_USER_SET_CREDENTIALS,
110112
};
111113

112114
/* Construct the message kind based on group and action */

wolfhsm/wh_message_auth.h

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,12 @@
3535
#include "wolfhsm/wh_message.h"
3636
#include "wolfhsm/wh_auth.h"
3737

38-
enum WH_MESSAGE_AUTH_ACTION_ENUM {
39-
WH_MESSAGE_AUTH_ACTION_AUTHENTICATE = 0x01,
40-
WH_MESSAGE_AUTH_ACTION_LOGIN = 0x02,
41-
WH_MESSAGE_AUTH_ACTION_LOGOUT = 0x03,
42-
WH_MESSAGE_AUTH_ACTION_USER_ADD = 0x04,
43-
WH_MESSAGE_AUTH_ACTION_USER_DELETE = 0x05,
44-
WH_MESSAGE_AUTH_ACTION_USER_GET = 0x06,
45-
WH_MESSAGE_AUTH_ACTION_USER_SET_PERMISSIONS = 0x07,
46-
WH_MESSAGE_AUTH_ACTION_USER_SET_CREDENTIALS = 0x08,
47-
};
48-
49-
enum WH_MESSAGE_AUTH_MAX_ENUM {
50-
WH_MESSAGE_AUTH_MAX_USERNAME_LEN = 32,
51-
/* Reserve space for UserAddRequest fixed fields:
52-
* username (32) + permissions (WH_FLAT_PERMISSIONS_LEN) + method (2) +
53-
* credentials_len (2) + overhead (2) = 32 + 460 + 2 + 2 + 2 = 498 bytes */
54-
WH_MESSAGE_AUTH_MAX_CREDENTIALS_LEN = WOLFHSM_CFG_COMM_DATA_LEN - 498,
55-
WH_MESSAGE_AUTH_MAX_SESSIONS = 16,
56-
};
38+
#define WH_MESSAGE_AUTH_MAX_USERNAME_LEN 32
39+
/* Reserve space for UserAddRequest fixed fields:
40+
* username (32) + permissions (WH_FLAT_PERMISSIONS_LEN) + method (2) +
41+
* credentials_len (2) + overhead (2) = 32 + 460 + 2 + 2 + 2 = 498 bytes */
42+
#define WH_MESSAGE_AUTH_MAX_CREDENTIALS_LEN (WOLFHSM_CFG_COMM_DATA_LEN - 498)
43+
#define WH_MESSAGE_AUTH_MAX_SESSIONS 16
5744

5845
/* Simple reusable response message */
5946
typedef struct {
@@ -133,11 +120,12 @@ int wh_MessageAuth_TranslateLogoutRequest(
133120
/** Logout Response (SimpleResponse) */
134121

135122
/* whAuthPermissions struct
136-
* uint16_t (groupPermissions) + uint32_t[WH_NUMBER_OF_GROUPS][WH_AUTH_ACTION_WORDS]
137-
* (actionPermissions) + uint16_t (keyIdCount) + uint32_t[WH_AUTH_MAX_KEY_IDS]
138-
* (keyIds) */
139-
#define WH_FLAT_PERMISSIONS_LEN \
140-
(2 + (4 * WH_NUMBER_OF_GROUPS * WH_AUTH_ACTION_WORDS) + 2 + \
123+
* uint8_t[WH_NUMBER_OF_GROUPS] (groupPermissions) +
124+
* uint32_t[WH_NUMBER_OF_GROUPS][WH_AUTH_ACTION_WORDS] (actionPermissions) +
125+
* uint16_t (keyIdCount) + uint32_t[WH_AUTH_MAX_KEY_IDS] (keyIds) */
126+
#define WH_FLAT_PERMISSIONS_LEN \
127+
(WH_NUMBER_OF_GROUPS + \
128+
(4 * WH_NUMBER_OF_GROUPS * WH_AUTH_ACTION_WORDS) + 2 + \
141129
(4 * WH_AUTH_MAX_KEY_IDS))
142130

143131
/**

0 commit comments

Comments
 (0)