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