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 common_utils.h Source File

common_utils.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 __COMMON_UTILS_H__
00018 #define __COMMON_UTILS_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 /**This function retrieves kcm data buffer and its size according to the given name.
00034 * In case of success - The function allocates buffer for current kcm data and it is a user's responsibility to free the allocated memory.
00035 *
00036 * @param parameter_name[in]                  buffer of parameter name.
00037 * @param size_of_parameter_name[in]          size of parameter name.
00038 * @kcm_type[in]                              type of kcm data to retrieve
00039 * @param kcm_data[out]                       pointer to kcm data.
00040 * @param kcm_data_size[out]                  size of kcm data.
00041 *        fcc_status_e status.
00042 */
00043 fcc_status_e  fcc_get_kcm_data(const uint8_t *parameter_name, size_t size_of_parameter_name, kcm_item_type_e kcm_type, uint8_t **kcm_data, size_t *kcm_data_size);
00044 #if 0
00045 /**This function retrieves certificate's attribute using it's name.
00046 * The function allocates memory for attribute data buffer  and it is user's responsibility to free the allocated  memory.
00047 *
00048 * @param cert_name[in]                  The name of certificate
00049 * @param size_of_cert_name[in]          The size of certificate name.
00050 * @param attribute_type[in]             The type of attribute to retrieve.
00051 * @param attribute_data[out]            Attribute data buffer. If NULL and the size of the attribute_data_size is 0,the buffer is allocated by the function.
00052 *                                       Otherwise the function uses supplied buffer.
00053 * @param attribute_act_data_size[out]   The actual size of attribute data buffer.
00054 *        fcc_status_e status.
00055 */
00056 fcc_status_e  fcc_get_certificate_attribute_by_name_with_allocate(const uint8_t *cert_name, size_t size_of_cert_name, cs_certificate_attribute_type_e attribute_type, uint8_t **attribute_data, size_t attribute_data_size, size_t *attribute_act_data_size);
00057 #endif
00058 /**This function retrieves certificate's attribute using it's name.
00059 * The function allocates memory for attribute data buffer in case it was not allocated by user, and it is user's responsibility to free the allocated  memory.
00060 * @param cert_name[in]                  The name of certificate
00061 * @param size_of_cert_name[in]          The size of certificate name.
00062 * @param attribute_type[in]             The type of attribute to retrieve.
00063 * @param attribute_data[out]            Attribute data buffer. If NULL and the size of the attribute_data_size is 0,the buffer is allocated by the function.
00064 *                                       Otherwise the function uses supplied buffer.
00065 * @param attribute_data_size[in]       Attribute data buffer. Should be 0 in case the attribute_data is NULL.
00066 * @param attribute_act_data_size[out]   The actual size of attribute data buffer.
00067 *        fcc_status_e status.
00068 */
00069 fcc_status_e  fcc_get_certificate_attribute_by_name(const uint8_t *cert_name, size_t size_of_cert_name, cs_certificate_attribute_type_e attribute_type, uint8_t *attribute_data, size_t attribute_data_size, size_t *attribute_act_data_size);
00070 
00071 
00072 /**This function retrieves certificate's attribute and it's size according to its type.
00073 *   The function allocates memory for the attribute and it is a user's responsibility to free the allocated memory.
00074 *
00075 * @param certificate_data[in]                  buffer of certificate.
00076 * @param size_of_certificate_data[in]          size of certificate data.
00077 * @attribute_type[in]                          type of attribute to retrieve.
00078 * @param attribute_data[out]                   attribute data buffer.
00079 * @param attribute_act_data_size[out]          actual size of the attribute data
00080 *        fcc_status_e status.
00081 */
00082 fcc_status_e  fcc_get_certificate_attribute(palX509Handle_t x509_cert, cs_certificate_attribute_type_e attribute_type, uint8_t **attribute_data, size_t *attribute_act_data_size);
00083 
00084 
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088 
00089 #endif //__COMMON_UTILS_H__