1 /* 2 * Copyright (c) 2021, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <stdint.h> 8 9 #include <plat/arm/common/plat_arm.h> 10 11 /* 12 * Return the non-volatile counter value stored in the platform. The cookie 13 * will contain the OID of the counter in the certificate. 14 * 15 * Return: 0 = success, Otherwise = error 16 */ 17 int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr) 18 { 19 *nv_ctr = MORELLO_FW_NVCTR_VAL; 20 21 return 0; 22 } 23 24 /* 25 * Store a new non-volatile counter value. By default on ARM development 26 * platforms, the non-volatile counters are RO and cannot be modified. We expect 27 * the values in the certificates to always match the RO values so that this 28 * function is never called. 29 * 30 * Return: 0 = success, Otherwise = error 31 */ 32 int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr) 33 { 34 return 1; 35 } 36 37 /* 38 * Return the ROTPK hash in the following ASN.1 structure in DER format: 39 * 40 * AlgorithmIdentifier ::= SEQUENCE { 41 * algorithm OBJECT IDENTIFIER, 42 * parameters ANY DEFINED BY algorithm OPTIONAL 43 * } 44 * 45 * DigestInfo ::= SEQUENCE { 46 * digestAlgorithm AlgorithmIdentifier, 47 * digest OCTET STRING 48 * } 49 */ 50 int plat_get_rotpk_info(void *cookie, void **key_ptr, unsigned int *key_len, 51 unsigned int *flags) 52 { 53 return arm_get_rotpk_info(cookie, key_ptr, key_len, flags); 54 } 55