leo hendrickson / Mbed OS example-Ethernet-mbed-Cloud-connect
Embed: (wiki syntax)

« Back to documentation index

factory_configurator_client.h File Reference

factory_configurator_client.h File Reference

factory configurator client APIs. More...

Go to the source code of this file.

Functions

fcc_status_e fcc_init (void)
 Initiates the FCC module.
fcc_status_e fcc_finalize (void)
 Finalizes the FCC module.
fcc_status_e fcc_storage_delete (void)
 Cleans from the device all data that was saved during the factory process.
fcc_output_info_sfcc_get_error_and_warning_data (void)
 The function retrieves pointer to warning and errors structure.
bool fcc_is_session_finished (void)
 The function returns status of current session between the FCC and the FCU.
fcc_status_e fcc_verify_device_configured_4mbed_cloud (void)
 Verifies that all mandatory fields needed to connect to mbed Cloud are in place on the device.
fcc_status_e fcc_time_set (uint64_t time)
 Sets device time.
fcc_status_e fcc_entropy_set (const uint8_t *buf, size_t buf_size)
 Sets non-volatile entropy that will be used when seeding deterministic random bit generator (DRBG) instances, for random number generations.
fcc_status_e fcc_rot_set (const uint8_t *buf, size_t buf_size)
 Sets root of trust To set your own root of trust, call this function after fcc_init() and fcc_entropy_set() (if you set your own entropy), and prior to any other FCC or KCM functions.
fcc_status_e fcc_trust_ca_cert_id_set (void)
 The function sets bootstrap ca identification and stores it.
fcc_status_e fcc_factory_disable (void)
 Sets Factory disabled flag to disable further use of the factory flow.
fcc_status_e fcc_is_factory_disabled (bool *fcc_factory_disable)
 Returns true if the factory flow was disabled by calling fcc_factory_disable() API, outherwise returns false.
fcc_status_e fcc_developer_flow (void)
 This API is for developers only.

Detailed Description

factory configurator client APIs.

Definition in file factory_configurator_client.h.


Function Documentation

fcc_status_e fcc_developer_flow ( void   )

This API is for developers only.

You can download the `mbed_cloud_dev_credentials.c` file from the portal and thus, skip running FCU on PC side. The API reads all credentials from the `mbed_cloud_dev_credentials.c` file and stores them in the KCM.

RoT, Entropy and Time configurations are not a part of `fcc_developer_flow()` API. Devices that need to set RoT or Entropy should call `fcc_rot_set()`/`fcc_entropy_set()` APIs before `fcc_developer_flow()`. If a device does not have its own time configuration and `fcc_time_set()` was not called before `fcc_developer_flow()`, `fcc_verify_device_configured_4mbed_cloud()` will not check the validity of the certificate time.

If this API is called twice, without cleaning the non-volatile storage between two sequential calls, FCC_STATUS_KCM_FILE_EXIST_ERROR will be returned.

Returns:
FCC_STATUS_SUCCESS in case of success or one of the `fcc_status_e` errors otherwise.

Definition at line 57 of file fcc_dev_flow.c.

fcc_status_e fcc_entropy_set ( const uint8_t *  buf,
size_t  buf_size 
)

Sets non-volatile entropy that will be used when seeding deterministic random bit generator (DRBG) instances, for random number generations.

To set non-volatile entropy, call this function after fcc_init() and prior to any other FCC or KCM functions. You must use this API if your device does not have a true random number generator (TRNG).

Parameters:
bufThe buffer containing the entropy.
buf_sizeThe size of buf in bytes. Must be exactly FCC_ENTROPY_SIZE.
Returns:
FCC_STATUS_SUCCESS - Entropy injected successfully. FCC_STATUS_ENTROPY_ERROR - Entropy already exists in device. Successive entropy sets are not permitted. FCC_STATUS_INVALID_PARAMETER - Either buf is NULL or buf_size does not equal FCC_ENTROPY_SIZE. FCC_STATUS_NOT_SUPPORTED - Image built in a way that does not expect entropy to be injected. Otherwise - any one of the `fcc_status_e` errors.

Definition at line 216 of file factory_configurator_client.c.

fcc_status_e fcc_factory_disable ( void   )

Sets Factory disabled flag to disable further use of the factory flow.

Returns:
Operation status.

Definition at line 288 of file factory_configurator_client.c.

fcc_status_e fcc_finalize ( void   )

Finalizes the FCC module.

Finalizes and frees file storage resources.

Returns:
FCC_STATUS_SUCCESS in case of success or one of the `fcc_status_e` errors otherwise.

Definition at line 102 of file factory_configurator_client.c.

fcc_output_info_s* fcc_get_error_and_warning_data ( void   )

The function retrieves pointer to warning and errors structure.

Should be called after fcc_verify_device_configured_4mbed_cloud, when possible warning and errors was stored in the structure. The structure contains data of last fcc_verify_device_configured_4mbed_cloud run.*

Returns:
pointer to fcc_output_info_s structure.

Example:

  void print_fcc_output_info(fcc_output_info_s *output_info)
  {
      fcc_warning_info_s *warning_list = NULL;

      if (output_info != NULL) {
          // Check if there is an error
          if (output_info->error_string_info != NULL) {
              // Print the error string
              printf("fcc output error: %s", output_info->error_string_info);
          }
          // Check if there are warnings
          if (output_info->size_of_warning_info_list > 0) {
              // Set warning_list to point on the head of the list
              warning_list = output_info->head_of_warning_list;

              // Iterate the list
              while (warning_list != NULL) {
                  // Print the warning string
                  printf("fcc output warning: %s", warning_list->warning_info_string);
                  // Move warning_list to point on the next warning in he list
                  warning_list = warning_list->next;
              }
          }
      }
  }

Definition at line 151 of file factory_configurator_client.c.

fcc_status_e fcc_init ( void   )

Initiates the FCC module.

Must be called before any other fcc's APIs. Otherwise relevant error will be returned.

Returns:
FCC_STATUS_SUCCESS in case of success or one of the `fcc_status_e` errors otherwise.

Definition at line 77 of file factory_configurator_client.c.

fcc_status_e fcc_is_factory_disabled ( bool *  fcc_factory_disable )

Returns true if the factory flow was disabled by calling fcc_factory_disable() API, outherwise returns false.

  • If the factory flow is already disabled any FCC API(s) will fail.
Parameters:
fcc_factory_disableAn output parameter, will be set to "true" in case factory flow is already disabled, "false" otherwise.
Returns:
FCC_STATUS_SUCCESS in case of success or one of the `fcc_status_e` errors otherwise.

Definition at line 265 of file factory_configurator_client.c.

bool fcc_is_session_finished ( void   )

The function returns status of current session between the FCC and the FCU.

If the returned value is true - the session should be finished in the communication layer after current message processing, if the return value is false - the session should be kept alive for next message.

Returns:
bool

Definition at line 162 of file factory_configurator_client.c.

fcc_status_e fcc_rot_set ( const uint8_t *  buf,
size_t  buf_size 
)

Sets root of trust To set your own root of trust, call this function after fcc_init() and fcc_entropy_set() (if you set your own entropy), and prior to any other FCC or KCM functions.

Parameters:
bufThe buffer containing the root of trust.
buf_sizeThe size of buf in bytes. Must be the exact size of root of trust key, as defined in device platform layer.
Returns:
Operation status.

Definition at line 231 of file factory_configurator_client.c.

fcc_status_e fcc_storage_delete ( void   )

Cleans from the device all data that was saved during the factory process.

Should be called if the process failed and needs to be executed again.

Returns:
FCC_STATUS_SUCCESS in case of success or one of the `fcc_status_e` errors otherwise.

Definition at line 133 of file factory_configurator_client.c.

fcc_status_e fcc_time_set ( uint64_t  time )

Sets device time.

This function will set the device time to what the user provides. Device time must be set in order to enable certificate expiration validations.

Parameters:
timeThe device time to set. As epoch time (number of seconds that have elapsed since January 1, 1970)
Returns:
Operation status.

Definition at line 251 of file factory_configurator_client.c.

fcc_status_e fcc_trust_ca_cert_id_set ( void   )

The function sets bootstrap ca identification and stores it.

Should be called only after storing bootstrap ca certificate on the device.

Returns:
Operation status.

Definition at line 313 of file factory_configurator_client.c.

fcc_status_e fcc_verify_device_configured_4mbed_cloud ( void   )

Verifies that all mandatory fields needed to connect to mbed Cloud are in place on the device.

Should be called in the end of the factory process

Returns:
FCC_STATUS_SUCCESS in case of success or one of the `fcc_status_e` errors otherwise.

Definition at line 169 of file factory_configurator_client.c.