SGX Multi-Package Registration Service Network Library (MP Network Library)¶
This library provides a set of C-like APIs that allows applications to communicate with the REST APIs defined by the Intel® SGX Registration Service APIs. The Multi-Package Registration Agent links to this library. You can develop your own tools using this library to suit your SGX attestation infrastructure.
Initialize the Multi-Package Network Library¶
Description¶
Provides the configuration data needed by the library to communicate to the registration authority service providing the REST APIs.
Syntax¶
MpResult mp_network_init(
const char *server_address,
const char *subscription_key,
const ProxyConf *proxy,
const LogLevel logLevel);
Parameters¶
Parameter | Description |
---|---|
server_address [In] |
Server URL that exposes the REST APIs. |
subscription_key [In] |
Some REST APIs may require a subscription key. Currently, only the add package API requires a subscription key. |
proxy [In] |
Desired proxy configurations of the platform communicating to the registration service. |
logLevel [In] |
Set the logging level. Logging messages default to stdout. You can create an auxiliary logging function and link with the MP Network Library to change the output location.
|
Return Values¶
Parameter | Description |
---|---|
MP_SUCCESS |
Successfully initialized the network library. |
MP_INVALID_PARAMETER |
|
MP_REDUNDANT_OPERATION |
The MP Network library was already initialized. |
MP_MEM_ERROR |
Failed to initialize the MP Network library. |
Send a Request to the Registration Server¶
Description¶
Sends a supported request type to the registration service and returns the response.
Syntax¶
MpResult mp_send_binary_request(
const MpRequestType *request_type,
const uint8_t *request,
const uint16_t request_size,
const uint8_t *response,
const uint16_t *response_size,
HttpStatusCode *status_code,
RegistrationErrorcode *error_code);
Parameters¶
Parameter | Description |
---|---|
request_type [In] |
The type of request to be sent. Currently, only the platform manifest and the add package request types are supported. |
request [In] |
Request buffer to send to the service. |
request_size [In] |
Size in bytes of the request buffer. |
response [In/Out] |
Buffer that contains the response from the service. |
response_size [In] |
Size in bytes of the response buffer. |
status_code [Out] |
HTTPS status code returned by the service. |
error_code [In] |
The error code generated by the registration service. See the MPA_RS error codes defined in MPA Error Codes. |
Return Values¶
Parameter | Description |
---|---|
MP_SUCCESS |
Successfully sent the request. |
MP_INVALID_PARAMETER |
|
MP_NETWORK_ERROR |
Failed to set up the network connection, proxy or other failure sending request to the server. |
MP_UNEXPECTED_ERROR |
The API encountered an unexpected error. Check logs for more information. |
MP_MEM_ERROR |
Error allocating memory. |
MP_USER_INSUFFICIENT_MEM |
The response_size parameter value is too small to contain the server response. |
MP_NOT_INITIALIZED |
The MP UEFI library was not initialized. |
Exit the Multi-Package Network Library¶
Description¶
Free any resources used by the MP Network Library.
Syntax¶
MpResult mp_uefi_terminate();
Parameters¶
None
Return Values¶
Parameter | Description |
---|---|
MP_SUCCESS |
Successfully terminated the MP Network library. |
MP_REDUNDANT_OPERATION |
The MP Network library was not initialized or has been terminated. |