blob: c7dc47f1089505bcf462da815d2528443397c522 [file] [log] [blame]
sah016ec01e82021-06-06 14:38:01 +05301/*
2 * Copyright (c) 2022, 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 */
17int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr)
18{
19 *nv_ctr = N1SDP_FW_NVCTR_VAL;
20 return 0;
21}
22
23/*
24 * Store a new non-volatile counter value. By default on ARM development
25 * platforms, the non-volatile counters are RO and cannot be modified. We expect
26 * the values in the certificates to always match the RO values so that this
27 * function is never called.
28 *
29 * Return: 0 = success, Otherwise = error
30 */
31int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr)
32{
33 return 1;
34}
35
36/*
37 * Return the ROTPK hash in the following ASN.1 structure in DER format:
38 *
39 * AlgorithmIdentifier ::= SEQUENCE {
40 * algorithm OBJECT IDENTIFIER,
41 * parameters ANY DEFINED BY algorithm OPTIONAL
42 * }
43 *
44 * DigestInfo ::= SEQUENCE {
45 * digestAlgorithm AlgorithmIdentifier,
46 * digest OCTET STRING
47 * }
48 */
49int plat_get_rotpk_info(void *cookie, void **key_ptr, unsigned int *key_len,
50 unsigned int *flags)
51{
52 return arm_get_rotpk_info(cookie, key_ptr, key_len, flags);
53}
54