Skip to content

Commit

Permalink
fix: introduce init method and use for enroll namespace list
Browse files Browse the repository at this point in the history
  • Loading branch information
srieteja committed Dec 18, 2024
1 parent b831294 commit 02f6eab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/atauth/src/auth_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ int main(int argc, char *argv[]) {
*/
// 3.1 Initialize and populate enrollment params structs
atcommons_enroll_namespace_list_t *ns_list = malloc(sizeof(atcommons_enroll_namespace_list_t));
if (ns_list == NULL) {
atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "Could not allocate memory for namespace list\n");
if((ret = atcommmons_init_enroll_namespace_list(ns_list)) != 0) {
goto enc_pub_key_exit;
}

Expand Down
9 changes: 9 additions & 0 deletions packages/atcommons/include/atcommons/enroll_namespace.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef ATCOMMONS_ENROLL_NAMESPACE_H
#define ATCOMMONS_ENROLL_NAMESPACE_H

#include <atlogger/atlogger.h>
#include <stddef.h>

typedef struct {
Expand All @@ -13,6 +14,14 @@ typedef struct {
atcommons_enroll_namespace_t *namespaces[];
} atcommons_enroll_namespace_list_t;

/**
* @brief intializes the provided atcommons_enroll_namespace_list_t struc
*
* @param ns_list pointer to the namespace list struct that needs to be initialized
* @return int 0 on success, non-zero int on failure
*/
int atcommmons_init_enroll_namespace_list(atcommons_enroll_namespace_list_t *ns_list);

/**
* @brief serializes enroll_namespace struct to JSON string
*
Expand Down

0 comments on commit 02f6eab

Please sign in to comment.