1 /* 2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef INSTANCE_ID_CLAIM_SOURCE_H 8 #define INSTANCE_ID_CLAIM_SOURCE_H 9 10 #include <stdbool.h> 11 #include <stdint.h> 12 #include <psa/crypto.h> 13 #include <service/attestation/claims/claim_source.h> 14 15 /* Instance ID defines */ 16 #define INSTANCE_ID_HASH_ALG PSA_ALG_SHA_256 17 #define INSTANCE_ID_HASH_LEN PSA_HASH_LENGTH(INSTANCE_ID_HASH_ALG) 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 /** 24 * A claim_source that provides an identifier for the device, 25 * comprising a hash of the IAK public key. 26 */ 27 struct instance_id_claim_source 28 { 29 struct claim_source base; 30 31 bool is_known; 32 33 /* Space for the hashed key + a single type byte (see EAT) */ 34 uint8_t instance_id[INSTANCE_ID_HASH_LEN + 1]; 35 }; 36 37 /** 38 * \brief Initializes a struct instance_id_claim_source 39 * 40 * \param[in] instance The instance to initialze 41 * 42 * \return The initialize base claim_source structure 43 */ 44 struct claim_source *instance_id_claim_source_init(struct instance_id_claim_source *instance); 45 46 #ifdef __cplusplus 47 } /* extern "C" */ 48 #endif 49 50 #endif /* INSTANCE_ID_CLAIM_SOURCE_H */ 51