Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fcc_verification.h Source File

fcc_verification.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2017 ARM Ltd.
00003 //  
00004 // Licensed under the Apache License, Version 2.0 (the "License");
00005 // you may not use this file except in compliance with the License.
00006 // You may obtain a copy of the License at
00007 //  
00008 //     http://www.apache.org/licenses/LICENSE-2.0
00009 //  
00010 // Unless required by applicable law or agreed to in writing, software
00011 // distributed under the License is distributed on an "AS IS" BASIS,
00012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 // See the License for the specific language governing permissions and
00014 // limitations under the License.
00015 // ----------------------------------------------------------------------------
00016 
00017 #ifndef __FCC_VERIFICATION_H__
00018 #define __FCC_VERIFICATION_H__
00019 
00020 #include <stdlib.h>
00021 #include <stdbool.h>
00022 #include <inttypes.h>
00023 #include "key_config_manager.h"
00024 #include "factory_configurator_client.h"
00025 #include "fcc_defs.h"
00026 #include "cs_utils.h"
00027 #include "cs_der_certs.h"
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 /**
00034 * The size of the binary representation of UUID5. Used in verifying firmware vendor and class IDs.
00035 */
00036 #define FCC_UUID5_SIZE_IN_BYTES 16
00037 
00038 /**
00039 * Types of configuration parameter
00040 */
00041 typedef enum {
00042     FCC_MANUFACTURER_NAME_CONFIG_PARAM_TYPE,
00043     FCC_MODEL_NUMBER_CONFIG_PARAM_TYPE,
00044     FCC_DEVICE_TYPE_CONFIG_PARAM_TYPE,
00045     FCC_HARDWARE_VERSION_CONFIG_PARAM_TYPE,
00046     FCC_MEMORY_TOTAL_SIZE_CONFIG_PARAM_TYPE,
00047     FCC_DEVICE_SERIAL_NUMBER_CONFIG_PARAM_TYPE,
00048     FCC_MAX_CONFIG_PARAM_TYPE
00049 } fcc_config_param_type_e;
00050 
00051 /**
00052 * Configuration parameters lookup record, correlating parameter's type and name
00053 */
00054 typedef struct fcc_config_param_lookup_record_ {
00055     fcc_config_param_type_e config_param_type;
00056     const char *config_param_name;
00057 } fcc_config_param_lookup_record_s;
00058 
00059 /**
00060 * Group lookup table, correlating for each group its type and name
00061 */
00062 static const fcc_config_param_lookup_record_s fcc_config_param_lookup_table[FCC_MAX_CONFIG_PARAM_TYPE] = {
00063     { FCC_MANUFACTURER_NAME_CONFIG_PARAM_TYPE,     g_fcc_manufacturer_parameter_name },
00064     { FCC_MODEL_NUMBER_CONFIG_PARAM_TYPE,          g_fcc_model_number_parameter_name },
00065     { FCC_DEVICE_TYPE_CONFIG_PARAM_TYPE,           g_fcc_device_type_parameter_name },
00066     { FCC_HARDWARE_VERSION_CONFIG_PARAM_TYPE,      g_fcc_hardware_version_parameter_name },
00067     { FCC_MEMORY_TOTAL_SIZE_CONFIG_PARAM_TYPE,     g_fcc_memory_size_parameter_name },
00068     { FCC_DEVICE_SERIAL_NUMBER_CONFIG_PARAM_TYPE,  g_fcc_device_serial_number_parameter_name },
00069 };
00070 
00071 
00072 /** Checks entropy initialization
00073 *
00074 *    @returns
00075 *        entropy status  true/false.
00076 */
00077 bool fcc_is_entropy_initialized(void);
00078 
00079 /** Checks that all mandatory device meta data is present
00080 *
00081 *    @returns
00082 *        fcc_status_e status.
00083 */
00084 fcc_status_e  fcc_check_device_meta_data(void);
00085 
00086 /** Gets current bootstrap mode
00087 *
00088 * @param use_bootstrap[in/out]    The bootstrap mode
00089 *    @returns
00090 *        fcc_status_e status.
00091 */
00092 fcc_status_e  fcc_get_bootstrap_mode(bool *use_bootstrap);
00093 
00094 /**Function that checks all time synchronization parameters.
00095 *
00096 *    @returns
00097 *        fcc_status_e status.
00098 */
00099 fcc_status_e  fcc_check_time_synchronization(void);
00100 
00101 /** Checks mandatory device general info  - endpoint name. Does not check bootstrap_mode (checked with fcc_get_bootstrap_mode()).
00102 *
00103 *    @returns
00104 *        fcc_status_e status.
00105 */
00106 fcc_status_e  fcc_check_device_general_info( void );
00107 
00108 /** Checks device security objects : root ca certificate, device certificate, device private key and server URL.
00109 *
00110 * @param device_objects[in]           Structure with set of device security object names.
00111 * @param use_bootstrap[in]         Bootstrap mode.
00112 *    @returns
00113 *        fcc_status_e status.
00114 */
00115 fcc_status_e  fcc_check_device_security_objects(bool use_bootstrap);
00116 
00117 
00118 /** Checks firmware update integrity objects
00119 *
00120 *    @returns
00121 *        fcc_status_e status.
00122 */
00123 fcc_status_e   fcc_check_firmware_update_integrity( void );
00124 
00125 
00126 #ifdef __cplusplus
00127 }
00128 #endif
00129 
00130 #endif //__FCC_VERIFICATION_H__