Pfp Cybersecurity (Aka Power Fingerprinting, Inc.) / Mbed OS pfp-emon-nxp

Dependencies:   FXAS21002 FXOS8700Q

Committer:
vithyat
Date:
Fri Mar 20 20:15:18 2020 +0000
Revision:
2:990c985a69ae
Parent:
0:977e87915078
Update to work with P2Scan runtime

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vithyat 0:977e87915078 1 // ----------------------------------------------------------------------------
vithyat 0:977e87915078 2 // Copyright 2016-2018 ARM Ltd.
vithyat 0:977e87915078 3 //
vithyat 0:977e87915078 4 // SPDX-License-Identifier: Apache-2.0
vithyat 0:977e87915078 5 //
vithyat 0:977e87915078 6 // Licensed under the Apache License, Version 2.0 (the "License");
vithyat 0:977e87915078 7 // you may not use this file except in compliance with the License.
vithyat 0:977e87915078 8 // You may obtain a copy of the License at
vithyat 0:977e87915078 9 //
vithyat 0:977e87915078 10 // http://www.apache.org/licenses/LICENSE-2.0
vithyat 0:977e87915078 11 //
vithyat 0:977e87915078 12 // Unless required by applicable law or agreed to in writing, software
vithyat 0:977e87915078 13 // distributed under the License is distributed on an "AS IS" BASIS,
vithyat 0:977e87915078 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vithyat 0:977e87915078 15 // See the License for the specific language governing permissions and
vithyat 0:977e87915078 16 // limitations under the License.
vithyat 0:977e87915078 17 // ----------------------------------------------------------------------------
vithyat 0:977e87915078 18
vithyat 0:977e87915078 19 #ifndef CLOUD_CLIENT_STORAGE_H
vithyat 0:977e87915078 20 #define CLOUD_CLIENT_STORAGE_H
vithyat 0:977e87915078 21
vithyat 0:977e87915078 22 #include <stddef.h>
vithyat 0:977e87915078 23 #include <stdint.h>
vithyat 0:977e87915078 24
vithyat 0:977e87915078 25 #define KEY_ACCOUNT_ID "mbed.AccountID"
vithyat 0:977e87915078 26 #define KEY_INTERNAL_ENDPOINT "mbed.InternalEndpoint"
vithyat 0:977e87915078 27 #define KEY_DEVICE_SOFTWAREVERSION "mbed.SoftwareVersion"
vithyat 0:977e87915078 28 #define KEY_FIRST_TO_CLAIM "mbed.FirstToClaim"
vithyat 0:977e87915078 29
vithyat 0:977e87915078 30 #ifdef __cplusplus
vithyat 0:977e87915078 31 extern "C" {
vithyat 0:977e87915078 32 #endif
vithyat 0:977e87915078 33
vithyat 0:977e87915078 34 typedef enum {
vithyat 0:977e87915078 35 CCS_STATUS_MEMORY_ERROR = -4,
vithyat 0:977e87915078 36 CCS_STATUS_VALIDATION_FAIL = -3,
vithyat 0:977e87915078 37 CCS_STATUS_KEY_DOESNT_EXIST = -2,
vithyat 0:977e87915078 38 CCS_STATUS_ERROR = -1,
vithyat 0:977e87915078 39 CCS_STATUS_SUCCESS = 0
vithyat 0:977e87915078 40 } ccs_status_e;
vithyat 0:977e87915078 41
vithyat 0:977e87915078 42 /**
vithyat 0:977e87915078 43 * CCS item types
vithyat 0:977e87915078 44 * Keep these sync with ones that found from kcm_defs.h
vithyat 0:977e87915078 45 */
vithyat 0:977e87915078 46 typedef enum {
vithyat 0:977e87915078 47 CCS_PRIVATE_KEY_ITEM, //!< KCM private key item type. KCM Supports ECC keys with curves defined in palGroupIndex_t(pal_Crypto.h)
vithyat 0:977e87915078 48 CCS_PUBLIC_KEY_ITEM, //!< KCM public key item type. KCM Supports ECC keys with curves defined in palGroupIndex_t(pal_Crypto.h)
vithyat 0:977e87915078 49 CCS_SYMMETRIC_KEY_ITEM, //!< KCM symmetric key item type.
vithyat 0:977e87915078 50 CCS_CERTIFICATE_ITEM, //!< KCM certificate item type. Supported x509 certificates in der format.
vithyat 0:977e87915078 51 CCS_CONFIG_ITEM //!< KCM configuration parameter item type.
vithyat 0:977e87915078 52 } ccs_item_type_e;
vithyat 0:977e87915078 53
vithyat 0:977e87915078 54 /**
vithyat 0:977e87915078 55 * \brief Uninitializes the CFStore handle.
vithyat 0:977e87915078 56 */
vithyat 0:977e87915078 57 ccs_status_e uninitialize_storage(void);
vithyat 0:977e87915078 58
vithyat 0:977e87915078 59 /**
vithyat 0:977e87915078 60 * \brief Initializes the CFStore handle.
vithyat 0:977e87915078 61 */
vithyat 0:977e87915078 62 ccs_status_e initialize_storage(void);
vithyat 0:977e87915078 63
vithyat 0:977e87915078 64 /* Bootstrap credential handling methods */
vithyat 0:977e87915078 65 ccs_status_e ccs_get_string_item(const char* key, uint8_t *buffer, const size_t buffer_size, ccs_item_type_e item_type);
vithyat 0:977e87915078 66 ccs_status_e ccs_check_item(const char* key, ccs_item_type_e item_type);
vithyat 0:977e87915078 67 ccs_status_e ccs_delete_item(const char* key, ccs_item_type_e item_type);
vithyat 0:977e87915078 68 ccs_status_e ccs_get_item(const char* key, uint8_t *buffer, const size_t buffer_size, size_t *value_length, ccs_item_type_e item_type);
vithyat 0:977e87915078 69 ccs_status_e ccs_set_item(const char* key, const uint8_t *buffer, const size_t buffer_size, ccs_item_type_e item_type);
vithyat 0:977e87915078 70 ccs_status_e ccs_item_size(const char* key, size_t* size_out, ccs_item_type_e item_type);
vithyat 0:977e87915078 71
vithyat 0:977e87915078 72 /* Certificate chain handling methods */
vithyat 0:977e87915078 73 void *ccs_create_certificate_chain(const char *chain_file_name, size_t chain_len);
vithyat 0:977e87915078 74 void *ccs_open_certificate_chain(const char *chain_file_name, size_t *chain_size);
vithyat 0:977e87915078 75 ccs_status_e ccs_close_certificate_chain(void *chain_handle);
vithyat 0:977e87915078 76 ccs_status_e ccs_add_next_cert_chain(void *chain_handle, const uint8_t *cert_data, size_t data_size);
vithyat 0:977e87915078 77 ccs_status_e ccs_get_next_cert_chain(void *chain_handle, void *cert_data, size_t *data_size);
vithyat 0:977e87915078 78 ccs_status_e ccs_parse_cert_chain_and_store(const uint8_t *cert_chain_name,
vithyat 0:977e87915078 79 const size_t cert_chain_name_len,
vithyat 0:977e87915078 80 const uint8_t *cert_chain_data,
vithyat 0:977e87915078 81 const uint16_t cert_chain_data_len);
vithyat 0:977e87915078 82 #ifdef __cplusplus
vithyat 0:977e87915078 83 }
vithyat 0:977e87915078 84 #endif
vithyat 0:977e87915078 85 #endif // CLOUD_CLIENT_STORAGE_H