Toyomasa Watarai / simple-mbed-cloud-client

Dependents:  

Committer:
MACRUM
Date:
Mon Jul 02 08:06:37 2018 +0000
Revision:
2:bf2124b482f9
Parent:
0:276e7a263c35
Update library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:276e7a263c35 1 // ----------------------------------------------------------------------------
MACRUM 0:276e7a263c35 2 // Copyright 2016-2017 ARM Ltd.
MACRUM 0:276e7a263c35 3 //
MACRUM 0:276e7a263c35 4 // SPDX-License-Identifier: Apache-2.0
MACRUM 0:276e7a263c35 5 //
MACRUM 0:276e7a263c35 6 // Licensed under the Apache License, Version 2.0 (the "License");
MACRUM 0:276e7a263c35 7 // you may not use this file except in compliance with the License.
MACRUM 0:276e7a263c35 8 // You may obtain a copy of the License at
MACRUM 0:276e7a263c35 9 //
MACRUM 0:276e7a263c35 10 // http://www.apache.org/licenses/LICENSE-2.0
MACRUM 0:276e7a263c35 11 //
MACRUM 0:276e7a263c35 12 // Unless required by applicable law or agreed to in writing, software
MACRUM 0:276e7a263c35 13 // distributed under the License is distributed on an "AS IS" BASIS,
MACRUM 0:276e7a263c35 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 0:276e7a263c35 15 // See the License for the specific language governing permissions and
MACRUM 0:276e7a263c35 16 // limitations under the License.
MACRUM 0:276e7a263c35 17 // ----------------------------------------------------------------------------
MACRUM 0:276e7a263c35 18
MACRUM 0:276e7a263c35 19 #ifndef ARM_UPDATE_CERTIFICATES_H
MACRUM 0:276e7a263c35 20 #define ARM_UPDATE_CERTIFICATES_H
MACRUM 0:276e7a263c35 21
MACRUM 0:276e7a263c35 22 #include "update-client-common/arm_uc_common.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 * @brief Add certificate.
MACRUM 0:276e7a263c35 30 * @details [long description]
MACRUM 0:276e7a263c35 31 *
MACRUM 0:276e7a263c35 32 * @param certificate Pointer to certiface being added.
MACRUM 0:276e7a263c35 33 * @param certificate_length Certificate length.
MACRUM 0:276e7a263c35 34 * @param fingerprint Pointer to the fingerprint of the certificate being added.
MACRUM 0:276e7a263c35 35 * @param fingerprint_length Fingerprint length.
MACRUM 0:276e7a263c35 36 * @return Error code.
MACRUM 0:276e7a263c35 37 */
MACRUM 0:276e7a263c35 38 arm_uc_error_t ARM_UC_Certificate_Add(const uint8_t* certificate,
MACRUM 0:276e7a263c35 39 uint16_t certificate_size,
MACRUM 0:276e7a263c35 40 const uint8_t* fingerprint,
MACRUM 0:276e7a263c35 41 uint16_t fingerprint_size,
MACRUM 0:276e7a263c35 42 void (*callback)(arm_uc_error_t, const arm_uc_buffer_t*));
MACRUM 0:276e7a263c35 43
MACRUM 0:276e7a263c35 44 typedef arm_uc_error_t (* arm_uc_certificateStorer)(const arm_uc_buffer_t* certificate,
MACRUM 0:276e7a263c35 45 const arm_uc_buffer_t* fingerprint,
MACRUM 0:276e7a263c35 46 void (*callback)(arm_uc_error_t, const arm_uc_buffer_t*));
MACRUM 0:276e7a263c35 47
MACRUM 0:276e7a263c35 48 /**
MACRUM 0:276e7a263c35 49 * @brief Fetch a certificate by fingerprint
MACRUM 0:276e7a263c35 50 * @details This API is registered with the hub by the application. The application must handle any required certificate
MACRUM 0:276e7a263c35 51 * chain validation. The API for parsing a certificate chain will be provided by the manifest manager, but the API
MACRUM 0:276e7a263c35 52 * is TBD, so the DERCertificateList should be ignored for now.
MACRUM 0:276e7a263c35 53 *
MACRUM 0:276e7a263c35 54 * @param[out] certificates A pointer to the buffer to populate with the certificate. The buffer's ptr should be updated
MACRUM 0:276e7a263c35 55 * to point to the certificate.
MACRUM 0:276e7a263c35 56 * @param[in] fingerprint The fingerprint of the certificate
MACRUM 0:276e7a263c35 57 * @param[in] DERCertificateList The encoded list of certificate fingerprint/URL pairs that define the chain of
MACRUM 0:276e7a263c35 58 * certificates used to verify the requested certificate (The requested certificate will
MACRUM 0:276e7a263c35 59 * always be the first in the list)
MACRUM 0:276e7a263c35 60 * @param[in] callback The function to call when the certificate is available
MACRUM 0:276e7a263c35 61 */
MACRUM 0:276e7a263c35 62 typedef arm_uc_error_t (*arm_uc_certificateFetcher)(arm_uc_buffer_t* certificate,
MACRUM 0:276e7a263c35 63 const arm_uc_buffer_t* fingerprint,
MACRUM 0:276e7a263c35 64 const arm_uc_buffer_t* DERCertificateList,
MACRUM 0:276e7a263c35 65 void (*callback)(arm_uc_error_t, const arm_uc_buffer_t*, const arm_uc_buffer_t*));
MACRUM 0:276e7a263c35 66
MACRUM 0:276e7a263c35 67
MACRUM 0:276e7a263c35 68 struct arm_uc_certificate_api {
MACRUM 0:276e7a263c35 69 arm_uc_certificateFetcher fetch;
MACRUM 0:276e7a263c35 70 arm_uc_certificateStorer store;
MACRUM 0:276e7a263c35 71 };
MACRUM 0:276e7a263c35 72
MACRUM 0:276e7a263c35 73 arm_uc_error_t ARM_UC_certificateFetch(arm_uc_buffer_t* certificate,
MACRUM 0:276e7a263c35 74 const arm_uc_buffer_t* fingerprint,
MACRUM 0:276e7a263c35 75 const arm_uc_buffer_t* DERCertificateList,
MACRUM 0:276e7a263c35 76 void (*callback)(arm_uc_error_t, const arm_uc_buffer_t*, const arm_uc_buffer_t*));
MACRUM 0:276e7a263c35 77
MACRUM 0:276e7a263c35 78 #ifdef __cplusplus
MACRUM 0:276e7a263c35 79 };
MACRUM 0:276e7a263c35 80 #endif
MACRUM 0:276e7a263c35 81
MACRUM 0:276e7a263c35 82 #endif // ARM_UPDATE_CERTIFICATES_H