Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-cloud-client/factory-configurator-client/fcc-bundle-handler/fcc-bundle-handler/fcc_bundle_handler.h@0:276e7a263c35, 2018-07-02 (annotated)
- Committer:
- MACRUM
- Date:
- Mon Jul 02 06:30:39 2018 +0000
- Revision:
- 0:276e7a263c35
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:276e7a263c35 | 1 | // ---------------------------------------------------------------------------- |
MACRUM | 0:276e7a263c35 | 2 | // Copyright 2016-2017 ARM Ltd. |
MACRUM | 0:276e7a263c35 | 3 | // |
MACRUM | 0:276e7a263c35 | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
MACRUM | 0:276e7a263c35 | 5 | // you may not use this file except in compliance with the License. |
MACRUM | 0:276e7a263c35 | 6 | // You may obtain a copy of the License at |
MACRUM | 0:276e7a263c35 | 7 | // |
MACRUM | 0:276e7a263c35 | 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
MACRUM | 0:276e7a263c35 | 9 | // |
MACRUM | 0:276e7a263c35 | 10 | // Unless required by applicable law or agreed to in writing, software |
MACRUM | 0:276e7a263c35 | 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
MACRUM | 0:276e7a263c35 | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MACRUM | 0:276e7a263c35 | 13 | // See the License for the specific language governing permissions and |
MACRUM | 0:276e7a263c35 | 14 | // limitations under the License. |
MACRUM | 0:276e7a263c35 | 15 | // ---------------------------------------------------------------------------- |
MACRUM | 0:276e7a263c35 | 16 | |
MACRUM | 0:276e7a263c35 | 17 | #ifndef __FCC_BUNDLE_HANDLER_H__ |
MACRUM | 0:276e7a263c35 | 18 | #define __FCC_BUNDLE_HANDLER_H__ |
MACRUM | 0:276e7a263c35 | 19 | |
MACRUM | 0:276e7a263c35 | 20 | #include <stdlib.h> |
MACRUM | 0:276e7a263c35 | 21 | #include <inttypes.h> |
MACRUM | 0:276e7a263c35 | 22 | #include "fcc_status.h" |
MACRUM | 0:276e7a263c35 | 23 | |
MACRUM | 0:276e7a263c35 | 24 | #ifdef __cplusplus |
MACRUM | 0:276e7a263c35 | 25 | extern "C" { |
MACRUM | 0:276e7a263c35 | 26 | #endif |
MACRUM | 0:276e7a263c35 | 27 | |
MACRUM | 0:276e7a263c35 | 28 | /** |
MACRUM | 0:276e7a263c35 | 29 | * @file fcc_bundle_handler.h |
MACRUM | 0:276e7a263c35 | 30 | * \brief The fcc bundle handler APIs. |
MACRUM | 0:276e7a263c35 | 31 | * This layer handles a device configuration bundle created by factory configurator utility (FCU). |
MACRUM | 0:276e7a263c35 | 32 | */ |
MACRUM | 0:276e7a263c35 | 33 | /** |
MACRUM | 0:276e7a263c35 | 34 | * Name of keys group. |
MACRUM | 0:276e7a263c35 | 35 | */ |
MACRUM | 0:276e7a263c35 | 36 | #define FCC_KEY_GROUP_NAME "Keys" |
MACRUM | 0:276e7a263c35 | 37 | /** |
MACRUM | 0:276e7a263c35 | 38 | * Name of certificates group |
MACRUM | 0:276e7a263c35 | 39 | */ |
MACRUM | 0:276e7a263c35 | 40 | #define FCC_CERTIFICATE_GROUP_NAME "Certificates" |
MACRUM | 0:276e7a263c35 | 41 | /** |
MACRUM | 0:276e7a263c35 | 42 | * Name of CSRs group. |
MACRUM | 0:276e7a263c35 | 43 | */ |
MACRUM | 0:276e7a263c35 | 44 | #define FCC_CSR_GROUP_NAME "Csrs" |
MACRUM | 0:276e7a263c35 | 45 | /** |
MACRUM | 0:276e7a263c35 | 46 | * Name of configuration parameters group. |
MACRUM | 0:276e7a263c35 | 47 | */ |
MACRUM | 0:276e7a263c35 | 48 | #define FCC_CONFIG_PARAM_GROUP_NAME "ConfigParams" |
MACRUM | 0:276e7a263c35 | 49 | /** |
MACRUM | 0:276e7a263c35 | 50 | * Name of certificate chain group. |
MACRUM | 0:276e7a263c35 | 51 | */ |
MACRUM | 0:276e7a263c35 | 52 | #define FCC_CERTIFICATE_CHAIN_GROUP_NAME "CertificateChains" |
MACRUM | 0:276e7a263c35 | 53 | /** |
MACRUM | 0:276e7a263c35 | 54 | * Name of scheme version group. |
MACRUM | 0:276e7a263c35 | 55 | */ |
MACRUM | 0:276e7a263c35 | 56 | #define FCC_BUNDLE_SCHEME_GROUP_NAME "SchemeVersion" |
MACRUM | 0:276e7a263c35 | 57 | /** |
MACRUM | 0:276e7a263c35 | 58 | * Name of Entropy group. |
MACRUM | 0:276e7a263c35 | 59 | */ |
MACRUM | 0:276e7a263c35 | 60 | #define FCC_ENTROPY_NAME "Entropy" |
MACRUM | 0:276e7a263c35 | 61 | /** |
MACRUM | 0:276e7a263c35 | 62 | * Name of RoT group. |
MACRUM | 0:276e7a263c35 | 63 | */ |
MACRUM | 0:276e7a263c35 | 64 | #define FCC_ROT_NAME "ROT" |
MACRUM | 0:276e7a263c35 | 65 | /** |
MACRUM | 0:276e7a263c35 | 66 | * Name of device verify readiness group. |
MACRUM | 0:276e7a263c35 | 67 | */ |
MACRUM | 0:276e7a263c35 | 68 | #define FCC_VERIFY_DEVICE_IS_READY_GROUP_NAME "Verify" |
MACRUM | 0:276e7a263c35 | 69 | /** |
MACRUM | 0:276e7a263c35 | 70 | * Name of device verify readiness group. |
MACRUM | 0:276e7a263c35 | 71 | */ |
MACRUM | 0:276e7a263c35 | 72 | #define FCC_FACTORY_DISABLE_GROUP_NAME "Disable" |
MACRUM | 0:276e7a263c35 | 73 | |
MACRUM | 0:276e7a263c35 | 74 | /** |
MACRUM | 0:276e7a263c35 | 75 | * Name of error info group. |
MACRUM | 0:276e7a263c35 | 76 | */ |
MACRUM | 0:276e7a263c35 | 77 | //Fixme : rename "infoMessage" to ErrorInfo" when Factory tool will be ready for the change |
MACRUM | 0:276e7a263c35 | 78 | #define FCC_ERROR_INFO_GROUP_NAME "InfoMessage" |
MACRUM | 0:276e7a263c35 | 79 | /** |
MACRUM | 0:276e7a263c35 | 80 | * Name of return status group. |
MACRUM | 0:276e7a263c35 | 81 | */ |
MACRUM | 0:276e7a263c35 | 82 | #define FCC_RETURN_STATUS_GROUP_NAME "ReturnStatus" |
MACRUM | 0:276e7a263c35 | 83 | /** |
MACRUM | 0:276e7a263c35 | 84 | * Name of warning info group. |
MACRUM | 0:276e7a263c35 | 85 | */ |
MACRUM | 0:276e7a263c35 | 86 | #define FCC_WARNING_INFO_GROUP_NAME "WarningInfo" |
MACRUM | 0:276e7a263c35 | 87 | |
MACRUM | 0:276e7a263c35 | 88 | /** Decodes and processes an inbound device configuration bundle created by FCU. |
MACRUM | 0:276e7a263c35 | 89 | * Also creates an outbound bundle that should be sent to FCU. |
MACRUM | 0:276e7a263c35 | 90 | * The function assumes that the bundle includes four groups represented as cbor maps. |
MACRUM | 0:276e7a263c35 | 91 | * The names of the groups are `SchemeVersion`, `Keys`, `Certificates` and `ConfigParams`. |
MACRUM | 0:276e7a263c35 | 92 | * Each group contains a list of items, and for each item, there are a number of relevant parameters. |
MACRUM | 0:276e7a263c35 | 93 | * |
MACRUM | 0:276e7a263c35 | 94 | * @param encoded_bundle The encoded FCU bundle that is written into a secure storage. |
MACRUM | 0:276e7a263c35 | 95 | * @param encoded_blob_size The encoded FCU bundle size in bytes. |
MACRUM | 0:276e7a263c35 | 96 | * @param bundle_response_out The encoded outbound bundle. It may contain data such as CSR and different types of key schemes. |
MACRUM | 0:276e7a263c35 | 97 | * The response associates a descriptive error in case of a fault. Will be NULL if response not created successfully. |
MACRUM | 0:276e7a263c35 | 98 | * @param bundle_response_size_out The encoded outbound bundle size in bytes. |
MACRUM | 0:276e7a263c35 | 99 | * |
MACRUM | 0:276e7a263c35 | 100 | * @return |
MACRUM | 0:276e7a263c35 | 101 | * FCC_STATUS_SUCCESS in case of success or one of the `::fcc_status_e` errors otherwise. |
MACRUM | 0:276e7a263c35 | 102 | */ |
MACRUM | 0:276e7a263c35 | 103 | fcc_status_e fcc_bundle_handler(const uint8_t *encoded_bundle, size_t encoded_bundle_size, uint8_t **bundle_response_out, size_t *bundle_response_size_out); |
MACRUM | 0:276e7a263c35 | 104 | |
MACRUM | 0:276e7a263c35 | 105 | |
MACRUM | 0:276e7a263c35 | 106 | #ifdef __cplusplus |
MACRUM | 0:276e7a263c35 | 107 | } |
MACRUM | 0:276e7a263c35 | 108 | #endif |
MACRUM | 0:276e7a263c35 | 109 | |
MACRUM | 0:276e7a263c35 | 110 | #endif //__FCC_BUNDLE_HANDLER_H__ |