Loading src/lib/kinetic.pb-c.h +4 −4 Original line number Diff line number Diff line Loading @@ -1340,7 +1340,7 @@ typedef void (*Com__Seagate__Kinetic__Proto__Command__Header_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__Body_Closure) (const Com__Seagate__Kinetic__Proto__Command__Body *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__Status_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__Status__Closure) (const Com__Seagate__Kinetic__Proto__Command__Status *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__KeyValue_Closure) Loading Loading @@ -1385,13 +1385,13 @@ typedef void (*Com__Seagate__Kinetic__Proto__Command__GetLog__Limits_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__GetLog__Device_Closure) (const Com__Seagate__Kinetic__Proto__Command__GetLog__Device *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__GetLog_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__GetLog__Closure) (const Com__Seagate__Kinetic__Proto__Command__GetLog *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__Security__ACL__Scope_Closure) (const Com__Seagate__Kinetic__Proto__Command__Security__ACL__Scope *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__Security__ACL_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__Security__ACL__Closure) (const Com__Seagate__Kinetic__Proto__Command__Security__ACL *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__Security_Closure) Loading @@ -1400,7 +1400,7 @@ typedef void (*Com__Seagate__Kinetic__Proto__Command__Security_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__PinOperation_Closure) (const Com__Seagate__Kinetic__Proto__Command__PinOperation *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__Closure) (const Com__Seagate__Kinetic__Proto__Command *message, void *closure_data); Loading src/lib/kinetic_acl.c +25 −18 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ #include "json.h" typedef struct { Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission permission; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission permission; const char *string; } permission_pair; Loading @@ -43,15 +43,17 @@ static permission_pair permission_table[] = { { COM__SEAGATE__KINETIC__PROTO__COMMAND__SECURITY__ACL__PERMISSION__SECURITY, "SECURITY" }, }; #define PERM_TABLE_ROWS sizeof(permission_table)/sizeof(permission_table)[0] #define PERM_TABLE_ROWS (sizeof(permission_table)/sizeof(permission_table)[0]) static KineticACLLoadResult read_next_ACL(const char *buf, size_t buf_size, size_t offset, size_t *new_offset, struct json_tokener *tokener, Com__Seagate__Kinetic__Proto__Command__Security__ACL **instance); static KineticACLLoadResult unpack_scopes(Com__Seagate__Kinetic__Proto__Command__Security__ACL *acl, int scope_count, json_object *scopes); static KineticACLLoadResult acl_of_string(const char *buf, size_t buf_size, struct ACL **instance); static const char *str_of_permission(Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission perm) { static const char *str_of_permission(Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission perm) { for (size_t i = 0; i < PERM_TABLE_ROWS; i++) { permission_pair *pp = &permission_table[i]; if (pp->permission == perm) { return pp->string; } Loading @@ -59,7 +61,8 @@ static const char *str_of_permission(Com__Seagate__Kinetic__Proto__Command__Secu return "INVALID"; } static Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission permission_of_str(const char *str) { static Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission permission_of_str(const char *str) { for (size_t i = 0; i < PERM_TABLE_ROWS; i++) { permission_pair *pp = &permission_table[i]; if (0 == strcmp(str, pp->string)) { return pp->permission; } Loading @@ -68,7 +71,8 @@ static Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission permissio } KineticACLLoadResult KineticACL_LoadFromFile(const char *path, struct ACL **instance) { KineticACL_LoadFromFile(const char *path, struct ACL **instance) { if (path == NULL || instance == NULL) { return ACL_ERROR_NULL; } Loading Loading @@ -123,8 +127,8 @@ cleanup: return res; } KineticACLLoadResult acl_of_string(const char *buf, size_t buf_size, struct ACL **instance) { static KineticACLLoadResult acl_of_string(const char *buf, size_t buf_size, struct ACL **instance) { KineticACLLoadResult res = ACL_ERROR_MEMORY; struct ACL *acl_group = NULL; Com__Seagate__Kinetic__Proto__Command__Security__ACL **acl_array = NULL; Loading Loading @@ -193,7 +197,8 @@ cleanup: static KineticACLLoadResult read_next_ACL(const char *buf, size_t buf_size, size_t offset, size_t *new_offset, struct json_tokener *tokener, Com__Seagate__Kinetic__Proto__Command__Security__ACL **instance) { struct json_tokener *tokener, Com__Seagate__Kinetic__Proto__Command__Security__ACL **instance) { struct json_object *obj = json_tokener_parse_ex(tokener, &buf[offset], buf_size - offset); if (obj == NULL) { Loading Loading @@ -238,8 +243,8 @@ static KineticACLLoadResult read_next_ACL(const char *buf, size_t buf_size, const char *key = json_object_get_string(val); size_t len = strlen(key); acl->has_hmacAlgorithm = true; acl->hmacAlgorithm = COM__SEAGATE__KINETIC__PROTO__COMMAND__SECURITY__ACL__HMACALGORITHM__HmacSHA1; acl->has_hmacalgorithm = true; acl->hmacalgorithm = COM__SEAGATE__KINETIC__PROTO__COMMAND__SECURITY__ACL__HMACALGORITHM__HmacSHA1; acl->key.len = len; data = calloc(1, len + 1); Loading Loading @@ -279,10 +284,11 @@ cleanup: } static KineticACLLoadResult unpack_scopes(Com__Seagate__Kinetic__Proto__Command__Security__ACL *acl, int scope_count, json_object *scopes) { int scope_count, json_object *scopes) { KineticACLLoadResult res = ACL_ERROR_MEMORY; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Scope **scope_array = NULL; Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission *perm_array = NULL; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission *perm_array = NULL; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Scope *scope = NULL; uint8_t *data = NULL; Loading Loading @@ -345,7 +351,7 @@ static KineticACLLoadResult unpack_scopes(Com__Seagate__Kinetic__Proto__Command_ int count = json_object_array_length(val); for (int i = 0; i < count; i++) { struct json_object *jperm = json_object_array_get_idx(val, i); Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission p; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission p; p = permission_of_str(json_object_get_string(jperm)); if (p == COM__SEAGATE__KINETIC__PROTO__COMMAND__SECURITY__ACL__PERMISSION__INVALID_PERMISSION) { return ACL_ERROR_INVALID_FIELD; Loading @@ -359,8 +365,8 @@ static KineticACLLoadResult unpack_scopes(Com__Seagate__Kinetic__Proto__Command_ } } if (json_object_object_get_ex(cur_scope, "TlsRequired", &val)) { scope->TlsRequired = json_object_get_boolean(val); scope->has_TlsRequired = true; scope->tlsrequired = json_object_get_boolean(val); scope->has_tlsrequired = true; } acl->scope[acl->n_scope] = scope; Loading @@ -379,7 +385,8 @@ cleanup: return res; } void KineticACL_Print(FILE *f, struct ACL *ACLs) { void KineticACL_Print(FILE *f, struct ACL *ACLs) { if (ACLs == NULL) { fprintf(f, "NULL\n"); return; Loading Loading @@ -419,8 +426,8 @@ void KineticACL_Print(FILE *f, struct ACL *ACLs) { str_of_permission(scope->permission[pi])); } if (scope->has_TlsRequired) { fprintf(f, " TlsRequired: %d\n", scope->TlsRequired); if (scope->has_tlsrequired) { fprintf(f, " tlsrequired: %d\n", scope->tlsrequired); } } } Loading src/lib/kinetic_acl.h +1 −5 Original line number Diff line number Diff line Loading @@ -25,11 +25,7 @@ /* Attempt to instantiate an ACL structure based on the JSON data * contained in PATH. */ KineticACLLoadResult KineticACL_LoadFromFile(const char *path, struct ACL **instance); KineticACLLoadResult acl_of_string(const char *buf, size_t buf_size, struct ACL **instance); KineticACLLoadResult KineticACL_LoadFromFile(const char *path, struct ACL **instance); /* Print an ACL struct to the specified file. */ void KineticACL_Print(FILE *f, struct ACL *acl); Loading src/lib/kinetic_admin_client.c +2 −2 Original line number Diff line number Diff line Loading @@ -188,8 +188,8 @@ KineticStatus KineticAdminClient_GetLog(KineticSession * const session, KINETIC_ASSERT(session != NULL); KINETIC_ASSERT(info != NULL); Com__Seagate__Kinetic__Proto__Command__GetLog_Type protoType = KineticLogInfo_Type_to_Com__Seagate__Kinetic__Proto__Command__GetLog_Type(type); Com__Seagate__Kinetic__Proto__Command__GetLog__Type protoType = KineticLogInfo_Type_to_Com__Seagate__Kinetic__Proto__Command__GetLog__Type(type); if (protoType == COM__SEAGATE__KINETIC__PROTO__COMMAND__GET_LOG__TYPE__INVALID_TYPE) { return KINETIC_STATUS_INVALID_LOG_TYPE; } Loading src/lib/kinetic_auth.c +17 −17 Original line number Diff line number Diff line Loading @@ -42,28 +42,28 @@ KineticStatus KineticAuth_PopulateHmac(KineticSessionConfig const * const config Com__Seagate__Kinetic__Proto__Message* msg = &pdu->message.message; // Add HMAC authentication struct msg->hmacAuth = &pdu->message.hmacAuth; com__seagate__kinetic__proto__message__hmacauth__init(msg->hmacAuth); msg->hmacAuth = msg->hmacAuth; msg->pinAuth = NULL; msg->authType = COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__HMACAUTH; msg->has_authType = true; msg->hmacauth = &pdu->message.hmacAuth; com__seagate__kinetic__proto__message__hmacauth__init(msg->hmacauth); msg->hmacauth = msg->hmacauth; msg->pinauth = NULL; msg->authtype = COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__HMACAUTH; msg->has_authtype = true; // Configure HMAC support ByteArray const * const hmacKey = &config->hmacKey; KINETIC_ASSERT(hmacKey->len <= KINETIC_HMAC_MAX_LEN); // NOCOMMIT KINETIC_ASSERT(hmacKey->data != NULL); msg->hmacAuth = &pdu->message.hmacAuth; msg->hmacauth = &pdu->message.hmacAuth; msg->hmacAuth->hmac = (ProtobufCBinaryData) { msg->hmacauth->hmac = (ProtobufCBinaryData) { .data = pdu->message.hmacData, .len = KINETIC_HMAC_SHA1_LEN, }; msg->hmacAuth->has_hmac = true; msg->hmacAuth->identity = config->identity; msg->hmacAuth->has_identity = true; msg->hmacauth->has_hmac = true; msg->hmacauth->identity = config->identity; msg->hmacauth->has_identity = true; // Populate with hashed HMAC KineticHMAC hmac; Loading @@ -86,20 +86,20 @@ KineticStatus KineticAuth_PopulatePin(KineticSessionConfig const * const config, // Add PIN authentication struct com__seagate__kinetic__proto__message__pinauth__init(&msg->pinAuth); msg->message.pinAuth = &msg->pinAuth; msg->message.hmacAuth = NULL; msg->message.authType = COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__PINAUTH; msg->message.has_authType = true; msg->message.pinauth = &msg->pinAuth; msg->message.hmacauth = NULL; msg->message.authtype = COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__PINAUTH; msg->message.has_authtype = true; msg->command.header = &msg->header; // Configure PIN support KINETIC_ASSERT(pin.len <= KINETIC_PIN_MAX_LEN); if (pin.len > 0) { KINETIC_ASSERT(pin.data != NULL); } msg->message.pinAuth->pin = (ProtobufCBinaryData) { msg->message.pinauth->pin = (ProtobufCBinaryData) { .data = pin.data, .len = pin.len, }; msg->message.pinAuth->has_pin = true; msg->message.pinauth->has_pin = true; return KINETIC_STATUS_SUCCESS; } Loading Loading
src/lib/kinetic.pb-c.h +4 −4 Original line number Diff line number Diff line Loading @@ -1340,7 +1340,7 @@ typedef void (*Com__Seagate__Kinetic__Proto__Command__Header_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__Body_Closure) (const Com__Seagate__Kinetic__Proto__Command__Body *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__Status_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__Status__Closure) (const Com__Seagate__Kinetic__Proto__Command__Status *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__KeyValue_Closure) Loading Loading @@ -1385,13 +1385,13 @@ typedef void (*Com__Seagate__Kinetic__Proto__Command__GetLog__Limits_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__GetLog__Device_Closure) (const Com__Seagate__Kinetic__Proto__Command__GetLog__Device *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__GetLog_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__GetLog__Closure) (const Com__Seagate__Kinetic__Proto__Command__GetLog *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__Security__ACL__Scope_Closure) (const Com__Seagate__Kinetic__Proto__Command__Security__ACL__Scope *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__Security__ACL_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__Security__ACL__Closure) (const Com__Seagate__Kinetic__Proto__Command__Security__ACL *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command__Security_Closure) Loading @@ -1400,7 +1400,7 @@ typedef void (*Com__Seagate__Kinetic__Proto__Command__Security_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__PinOperation_Closure) (const Com__Seagate__Kinetic__Proto__Command__PinOperation *message, void *closure_data); typedef void (*Com__Seagate__Kinetic__Proto__Command_Closure) typedef void (*Com__Seagate__Kinetic__Proto__Command__Closure) (const Com__Seagate__Kinetic__Proto__Command *message, void *closure_data); Loading
src/lib/kinetic_acl.c +25 −18 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ #include "json.h" typedef struct { Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission permission; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission permission; const char *string; } permission_pair; Loading @@ -43,15 +43,17 @@ static permission_pair permission_table[] = { { COM__SEAGATE__KINETIC__PROTO__COMMAND__SECURITY__ACL__PERMISSION__SECURITY, "SECURITY" }, }; #define PERM_TABLE_ROWS sizeof(permission_table)/sizeof(permission_table)[0] #define PERM_TABLE_ROWS (sizeof(permission_table)/sizeof(permission_table)[0]) static KineticACLLoadResult read_next_ACL(const char *buf, size_t buf_size, size_t offset, size_t *new_offset, struct json_tokener *tokener, Com__Seagate__Kinetic__Proto__Command__Security__ACL **instance); static KineticACLLoadResult unpack_scopes(Com__Seagate__Kinetic__Proto__Command__Security__ACL *acl, int scope_count, json_object *scopes); static KineticACLLoadResult acl_of_string(const char *buf, size_t buf_size, struct ACL **instance); static const char *str_of_permission(Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission perm) { static const char *str_of_permission(Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission perm) { for (size_t i = 0; i < PERM_TABLE_ROWS; i++) { permission_pair *pp = &permission_table[i]; if (pp->permission == perm) { return pp->string; } Loading @@ -59,7 +61,8 @@ static const char *str_of_permission(Com__Seagate__Kinetic__Proto__Command__Secu return "INVALID"; } static Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission permission_of_str(const char *str) { static Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission permission_of_str(const char *str) { for (size_t i = 0; i < PERM_TABLE_ROWS; i++) { permission_pair *pp = &permission_table[i]; if (0 == strcmp(str, pp->string)) { return pp->permission; } Loading @@ -68,7 +71,8 @@ static Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission permissio } KineticACLLoadResult KineticACL_LoadFromFile(const char *path, struct ACL **instance) { KineticACL_LoadFromFile(const char *path, struct ACL **instance) { if (path == NULL || instance == NULL) { return ACL_ERROR_NULL; } Loading Loading @@ -123,8 +127,8 @@ cleanup: return res; } KineticACLLoadResult acl_of_string(const char *buf, size_t buf_size, struct ACL **instance) { static KineticACLLoadResult acl_of_string(const char *buf, size_t buf_size, struct ACL **instance) { KineticACLLoadResult res = ACL_ERROR_MEMORY; struct ACL *acl_group = NULL; Com__Seagate__Kinetic__Proto__Command__Security__ACL **acl_array = NULL; Loading Loading @@ -193,7 +197,8 @@ cleanup: static KineticACLLoadResult read_next_ACL(const char *buf, size_t buf_size, size_t offset, size_t *new_offset, struct json_tokener *tokener, Com__Seagate__Kinetic__Proto__Command__Security__ACL **instance) { struct json_tokener *tokener, Com__Seagate__Kinetic__Proto__Command__Security__ACL **instance) { struct json_object *obj = json_tokener_parse_ex(tokener, &buf[offset], buf_size - offset); if (obj == NULL) { Loading Loading @@ -238,8 +243,8 @@ static KineticACLLoadResult read_next_ACL(const char *buf, size_t buf_size, const char *key = json_object_get_string(val); size_t len = strlen(key); acl->has_hmacAlgorithm = true; acl->hmacAlgorithm = COM__SEAGATE__KINETIC__PROTO__COMMAND__SECURITY__ACL__HMACALGORITHM__HmacSHA1; acl->has_hmacalgorithm = true; acl->hmacalgorithm = COM__SEAGATE__KINETIC__PROTO__COMMAND__SECURITY__ACL__HMACALGORITHM__HmacSHA1; acl->key.len = len; data = calloc(1, len + 1); Loading Loading @@ -279,10 +284,11 @@ cleanup: } static KineticACLLoadResult unpack_scopes(Com__Seagate__Kinetic__Proto__Command__Security__ACL *acl, int scope_count, json_object *scopes) { int scope_count, json_object *scopes) { KineticACLLoadResult res = ACL_ERROR_MEMORY; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Scope **scope_array = NULL; Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission *perm_array = NULL; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission *perm_array = NULL; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Scope *scope = NULL; uint8_t *data = NULL; Loading Loading @@ -345,7 +351,7 @@ static KineticACLLoadResult unpack_scopes(Com__Seagate__Kinetic__Proto__Command_ int count = json_object_array_length(val); for (int i = 0; i < count; i++) { struct json_object *jperm = json_object_array_get_idx(val, i); Com__Seagate__Kinetic__Proto__Command__Security__ACL_Permission p; Com__Seagate__Kinetic__Proto__Command__Security__ACL__Permission p; p = permission_of_str(json_object_get_string(jperm)); if (p == COM__SEAGATE__KINETIC__PROTO__COMMAND__SECURITY__ACL__PERMISSION__INVALID_PERMISSION) { return ACL_ERROR_INVALID_FIELD; Loading @@ -359,8 +365,8 @@ static KineticACLLoadResult unpack_scopes(Com__Seagate__Kinetic__Proto__Command_ } } if (json_object_object_get_ex(cur_scope, "TlsRequired", &val)) { scope->TlsRequired = json_object_get_boolean(val); scope->has_TlsRequired = true; scope->tlsrequired = json_object_get_boolean(val); scope->has_tlsrequired = true; } acl->scope[acl->n_scope] = scope; Loading @@ -379,7 +385,8 @@ cleanup: return res; } void KineticACL_Print(FILE *f, struct ACL *ACLs) { void KineticACL_Print(FILE *f, struct ACL *ACLs) { if (ACLs == NULL) { fprintf(f, "NULL\n"); return; Loading Loading @@ -419,8 +426,8 @@ void KineticACL_Print(FILE *f, struct ACL *ACLs) { str_of_permission(scope->permission[pi])); } if (scope->has_TlsRequired) { fprintf(f, " TlsRequired: %d\n", scope->TlsRequired); if (scope->has_tlsrequired) { fprintf(f, " tlsrequired: %d\n", scope->tlsrequired); } } } Loading
src/lib/kinetic_acl.h +1 −5 Original line number Diff line number Diff line Loading @@ -25,11 +25,7 @@ /* Attempt to instantiate an ACL structure based on the JSON data * contained in PATH. */ KineticACLLoadResult KineticACL_LoadFromFile(const char *path, struct ACL **instance); KineticACLLoadResult acl_of_string(const char *buf, size_t buf_size, struct ACL **instance); KineticACLLoadResult KineticACL_LoadFromFile(const char *path, struct ACL **instance); /* Print an ACL struct to the specified file. */ void KineticACL_Print(FILE *f, struct ACL *acl); Loading
src/lib/kinetic_admin_client.c +2 −2 Original line number Diff line number Diff line Loading @@ -188,8 +188,8 @@ KineticStatus KineticAdminClient_GetLog(KineticSession * const session, KINETIC_ASSERT(session != NULL); KINETIC_ASSERT(info != NULL); Com__Seagate__Kinetic__Proto__Command__GetLog_Type protoType = KineticLogInfo_Type_to_Com__Seagate__Kinetic__Proto__Command__GetLog_Type(type); Com__Seagate__Kinetic__Proto__Command__GetLog__Type protoType = KineticLogInfo_Type_to_Com__Seagate__Kinetic__Proto__Command__GetLog__Type(type); if (protoType == COM__SEAGATE__KINETIC__PROTO__COMMAND__GET_LOG__TYPE__INVALID_TYPE) { return KINETIC_STATUS_INVALID_LOG_TYPE; } Loading
src/lib/kinetic_auth.c +17 −17 Original line number Diff line number Diff line Loading @@ -42,28 +42,28 @@ KineticStatus KineticAuth_PopulateHmac(KineticSessionConfig const * const config Com__Seagate__Kinetic__Proto__Message* msg = &pdu->message.message; // Add HMAC authentication struct msg->hmacAuth = &pdu->message.hmacAuth; com__seagate__kinetic__proto__message__hmacauth__init(msg->hmacAuth); msg->hmacAuth = msg->hmacAuth; msg->pinAuth = NULL; msg->authType = COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__HMACAUTH; msg->has_authType = true; msg->hmacauth = &pdu->message.hmacAuth; com__seagate__kinetic__proto__message__hmacauth__init(msg->hmacauth); msg->hmacauth = msg->hmacauth; msg->pinauth = NULL; msg->authtype = COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__HMACAUTH; msg->has_authtype = true; // Configure HMAC support ByteArray const * const hmacKey = &config->hmacKey; KINETIC_ASSERT(hmacKey->len <= KINETIC_HMAC_MAX_LEN); // NOCOMMIT KINETIC_ASSERT(hmacKey->data != NULL); msg->hmacAuth = &pdu->message.hmacAuth; msg->hmacauth = &pdu->message.hmacAuth; msg->hmacAuth->hmac = (ProtobufCBinaryData) { msg->hmacauth->hmac = (ProtobufCBinaryData) { .data = pdu->message.hmacData, .len = KINETIC_HMAC_SHA1_LEN, }; msg->hmacAuth->has_hmac = true; msg->hmacAuth->identity = config->identity; msg->hmacAuth->has_identity = true; msg->hmacauth->has_hmac = true; msg->hmacauth->identity = config->identity; msg->hmacauth->has_identity = true; // Populate with hashed HMAC KineticHMAC hmac; Loading @@ -86,20 +86,20 @@ KineticStatus KineticAuth_PopulatePin(KineticSessionConfig const * const config, // Add PIN authentication struct com__seagate__kinetic__proto__message__pinauth__init(&msg->pinAuth); msg->message.pinAuth = &msg->pinAuth; msg->message.hmacAuth = NULL; msg->message.authType = COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__PINAUTH; msg->message.has_authType = true; msg->message.pinauth = &msg->pinAuth; msg->message.hmacauth = NULL; msg->message.authtype = COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__PINAUTH; msg->message.has_authtype = true; msg->command.header = &msg->header; // Configure PIN support KINETIC_ASSERT(pin.len <= KINETIC_PIN_MAX_LEN); if (pin.len > 0) { KINETIC_ASSERT(pin.data != NULL); } msg->message.pinAuth->pin = (ProtobufCBinaryData) { msg->message.pinauth->pin = (ProtobufCBinaryData) { .data = pin.data, .len = pin.len, }; msg->message.pinAuth->has_pin = true; msg->message.pinauth->has_pin = true; return KINETIC_STATUS_SUCCESS; } Loading