You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: wolfHSM/src/chapter03.md
+12-40
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ The most common use case for wolfHSM is adding HSM-enabled functionality to an e
4
4
5
5
The first step required to run wolfHSM on a device is to follow the steps in the specific wolfHSM port to get the reference server running on the HSM core. Once the wolfHSM server app is loaded on the device and boots, client applications can link against the wolfHSM client library, configure an instance of the wolfHSM client structure, and interact with the HSM through the wolfHSM client API and through the wolfCrypt API.
6
6
7
-
Each wolfHSM port contains a client demo app showing how to set up the default communication channel and interact with the server. The server reference implementation can also be customized through [server callbacks](./chapter07-customizing-wolfHSM.md) to extend its functionality, which can be invoked through client requests.
7
+
Each wolfHSM port contains a client demo app showing how to set up the default communication channel and interact with the server. The server reference implementation can also be customized through [server callbacks](./chapter07.md) to extend its functionality, which can be invoked through client requests.
8
8
9
9
## Basic Client Configuration
10
10
@@ -79,60 +79,32 @@ if ((recvLen != sendLen ) ||
79
79
}
80
80
```
81
81
82
-
While there are indeed a large number of nested configurations and structures to set up, designing wolfHSM this way allowed for different transport implementations to be swapped in and out easily without changing the client code. For example, in order to switch from the shared memory transport to a TCP transport, only the transport configuration and callback structures need to be changed, and the rest of the client code remains the same (everything after step 2 in the sequence above).
83
-
84
-
```c
85
-
#include<string.h>/* for memcmp() */
86
-
#include"wolfhsm/client.h"/* Client API (includes comm config) */
87
-
#include"port/posix_transport_tcp.h"/* transport implementation */
88
-
89
-
/* Step 1: Allocate and initialize the posix TCP transport configuration */
/* Step 2: Allocate client comm configuration and bind to the transport */
98
-
/* Configure the client comms to use the selected transport configuration */
99
-
whCommClientConfig commClientCfg = {
100
-
.transport_cb = posixTransportTcpCb,
101
-
.transport_context = (void*)posixTransportTcpCtx,
102
-
.transport_config = (void*)posixTransportTcpCfg,
103
-
.client_id = 123, /* unique client identifier */
104
-
};
105
-
106
-
/* Subsequent steps remain the same... */
107
-
```
108
-
109
-
Note that the echo request in step 6 is just a simple usage example. Once the connection to the server is set up, any of the client APIs are available for use.
82
+
For more information, refer to [Chapter 5: Client Library](./chapter05.md).
110
83
111
84
## Basic Server Configuration
112
85
113
-
*Note: A wolfHSM port comes with a referenc
114
-
e server application that is already configured to run on the HSM core and so manual server configuration is not required.*
86
+
*Note: A wolfHSM port comes with a reference server application that is already configured to run on the HSM core and so manual server configuration is not required.*
115
87
116
88
Configuring a wolfHSM server involves allocating a server context structure and initializing it with a valid client configuration that enables it to perform the requested operations. These operations usually include client communication, cryptographic operations, managing keys, and non-volatile object storage. Depending on the required functionality, not all of these configuration components need to be initialized.
117
89
118
90
119
91
The steps required to configure a server that supports client communication, NVM object storage using the NVM flash configuration, and local crypto (software only) are:
120
92
121
-
1. Initialize the server comms configuration
122
-
1. Allocate and initialize a transport configuration structure, context, and callback implementation for the desired transport
123
-
2. Allocate and initialize a comm server configuration structure using the transport configuration from step 1.1
124
-
2. Initialize the server NVM context
125
-
1. Allocate and initialize a config, context, and callback structure for the low-level flash storage drivers (the implementation of these structures is provided by the port)
126
-
2. Allocate and initialize an NVM flash config, context, and callback strucure and bind the port flash configuration from step 2.1 to them
127
-
3. Allocate an NVM context structure and initialize it with the configuration from step 2.2 using `wh_Nvm_Init()`
93
+
1. Initialize the server comms configuration
94
+
1\. Allocate and initialize a transport configuration structure, context, and callback implementation for the desired transport
95
+
2\. Allocate and initialize a comm server configuration structure using the transport configuration from step 1.1
96
+
2. Initialize the server NVM context
97
+
1\. Allocate and initialize a config, context, and callback structure for the low-level flash storage drivers (the implementation of these structures is provided by the port)
98
+
2\. Allocate and initialize an NVM flash config, context, and callback strucure and bind the port flash configuration from step 2.1 to them
99
+
3\. Allocate an NVM context structure and initialize it with the configuration from step 2.2 using `wh_Nvm_Init()`
128
100
3. Allocate and initialize a crypto context structure for the server
129
101
4. Initialize wolfCrypt (before initializing the server)
130
102
5. Allocate and initialize a server config structure and bind the comm server configuration, NVM context, and crypto context to it
131
103
6. Allocate a server context structure and initialize it with the server configuration using `wh_Server_Init()`
132
-
7. Set the server connection state to connected using `wh_Server_SetConnected()` when the underlying transport is ready to be used for client communication (see [TODO](todo) for more information)
104
+
7. Set the server connection state to connected using `wh_Server_SetConnected()` when the underlying transport is ready to be used for client communication (see [wolfHSM Examples](https://github.com/wolfSSL/wolfHSM-examples) for more information)
133
105
8. Process client requests using `wh_Server_HandleRequestMessage()`
134
106
135
-
The server may be configured to support NVM object storage using NVM flash configuration. Include the steps to [initialize NVM](./chapter04-functional-components.md#NVM-Architecture) on the server after step 1.
107
+
The server may be configured to support NVM object storage using NVM flash configuration. Include the steps to [initialize NVM](./chapter04.md#NVM-Architecture) on the server after step 1.
Copy file name to clipboardexpand all lines: wolfHSM/src/chapter04.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -75,9 +75,9 @@ The communication layer of wolfHSM is designed to provide reliable, bidirectiona
75
75
- Comms layer: Defines the format and structure of messages exchanged between clients and servers, and provides an abstract interface to the underlying transport layer implementation, exposing a consistent interface for sending and receiving messages.
76
76
- Transport Layer: Concrete implementations of the underlying transport. Defines how data is actually transported between client and server.
77
77
78
-
### Client/Server APIs:
78
+
### Client/Server APIs
79
79
80
-
Highlevel client and server APIs (defined in [wh_client.h](wolfhsm/wh_client.h) and [wh_server.h](wolfhsm/wh_server.h)) are the primary interface for communication. These functions abstract the low level communications details from the caller, providing a simple split transaction interface for logical operations.
80
+
High-level client and server APIs (defined in `wolfhsm/wh_client.h` and `wolfhsm/wh_server.h`) are the primary interface for communication. These functions abstract the low level communications details from the caller, providing a simple split transaction interface for logical operations.
81
81
82
82
For example, using the client API to send an echo request to the server:
83
83
@@ -247,7 +247,7 @@ Currently, wolfHSM only supports one NVM back-end provider: the NVM flash module
247
247
248
248
## Key Management
249
249
250
-
The wolfHSM library provides comprehensive key management capabilities, including storing, loading, and exporting keys from non-volatile memory, caching of frequently used keys in RAM for fast access, and interacting with hardware-exclusive device keys. Keys are stored in non-volatile memory along side other NVM objects with corresponding access protections. wolfHSM will automatically load keys into the necessary cryptographic hardware when the key is selected for use with a specific consumer. More information on the key management API can be found in the [client library](./chapter05-client-library.md) and [API documentation](./appendix01-api-reference.md) sections.
250
+
The wolfHSM library provides comprehensive key management capabilities, including storing, loading, and exporting keys from non-volatile memory, caching of frequently used keys in RAM for fast access, and interacting with hardware-exclusive device keys. Keys are stored in non-volatile memory along side other NVM objects with corresponding access protections. wolfHSM will automatically load keys into the necessary cryptographic hardware when the key is selected for use with a specific consumer. More information on the key management API can be found in the [client library](./chapter05.md) and [API documentation](./appendix01.md) sections.
Copy file name to clipboardexpand all lines: wolfHSM/src/chapter05.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# wolfHSM Client Library
2
2
3
-
The client library API is the primary mechanism through which users will interact with wolfHSM. Refer to the [API documentation](appendix01-api-reference.md) for a full list of available functions and their descriptions.
3
+
The client library API is the primary mechanism through which users will interact with wolfHSM. Refer to the [API documentation](appendix01.md) for a full list of available functions and their descriptions.
4
4
5
5
## Table of Contents
6
6
@@ -196,7 +196,7 @@ byte myUpdate[] = “This is my update.”
For objects that should not be copied and sent over the transport, there exist DMA versions of the `NvmAddObject` functions. These pass the data to the server by reference rather than by value, allowing the server to access the data in memory directly. Note that if your platform requires custom address translation or cache invalidation before the server may access client addresses, you will need to implement a [DMA callback](TODO).
199
+
For objects that should not be copied and sent over the transport, there exist DMA versions of the `NvmAddObject` functions. These pass the data to the server by reference rather than by value, allowing the server to access the data in memory directly. Note that if your platform requires custom address translation or cache invalidation before the server may access client addresses, you will need to implement a [DMA callback](./chapter07#DMA-Callbacks).
200
200
201
201
```
202
202
whNvmMetadata myMeta = {
@@ -248,7 +248,7 @@ int wh_Client_NvmList(whClientContext* c,
Copy file name to clipboardexpand all lines: wolfHSM/src/chapter08.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -46,11 +46,11 @@ ST SPC58NN
46
46
- 1x 100MHz e200z0 PowerPC HSM core with NVM
47
47
- Crypto offload: TRNG, AES128
48
48
49
-
### Posix
49
+
### POSIX
50
50
51
-
The Posix port provides multiple and fully functional implementations of different wolfHSM abstractions that can be used to better understand the exact functionality expected for different hardware abstractions.
51
+
The POSIX port provides multiple and fully functional implementations of different wolfHSM abstractions that can be used to better understand the exact functionality expected for different hardware abstractions.
0 commit comments