Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/wh_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ int wh_Server_Init(whServerContext* server, whServerConfig* config)
}

memset(server, 0, sizeof(*server));
if (config->comm == NULL) {
return WH_ERROR_BADARGS;
}
server->comm = config->comm;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config->comm doesn't exist (which is why you are failing in CI).

What are you trying to do here? The transport-specific context is meant to be opaque and only used by the various transport back-ends, and so should be NULL checked at that level.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely right. I apologize for the confusion and the incorrect submission. I had misunderstood the initialization flow.

As you pointed out, my change was attempting to access config->comm, which does not exist. The correct member is config->comm_config.

More importantly, I now understand that a direct assignment is not the correct approach. The wh_CommServer_Init() function is called later in wh_Server_Init() and is responsible for initializing the whCommServer structure within the server context. It takes server->comm and config->comm_config as arguments and handles the necessary setup, including the NULL check for the configuration.

I was basically trying to add lines like:

    context->transport_context  = config->transport_context;
    context->transport_cb       = config->transport_cb;
    context->server_id          = config->server_id;

And, classic dump fault, I forgot to add them before pushing the PR. However, upon reviewing the code, I now realize these assignments are already correctly handled within the wh_CommClient_Init function

Thank you for your feedback. I will be closing this pull request.


server->nvm = config->nvm;

#ifndef WOLFHSM_CFG_NO_CRYPTO
Expand Down
Loading