blob: 26354f42aa23cbff9ba84708fb7e0107a14286fd [file] [log] [blame]
Soby Mathewf05d93a2022-03-22 16:21:19 +00001/*
Manish V Badarkhe37f9ac22023-03-12 21:34:44 +00002 * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
Soby Mathewf05d93a2022-03-22 16:21:19 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <assert.h>
Manish V Badarkhe37f9ac22023-03-12 21:34:44 +00008#include <delegated_attestation.h>
9#include <psa/error.h>
Soby Mathewf05d93a2022-03-22 16:21:19 +000010#include <services/rmmd_svc.h>
11
Manish V Badarkhe37f9ac22023-03-12 21:34:44 +000012/*
13 * Get the delegated realm attestation key through the PSA delegated
14 * attestation layer.
15 *
16 * FVP cannot support RSS hardware at the moment, but it can still mock
17 * the RSS implementation of the PSA interface (see PLAT_RSS_NOT_SUPPORTED).
18 */
Javier Almansa Sobrino7176a772021-11-24 18:37:37 +000019int plat_rmmd_get_cca_realm_attest_key(uintptr_t buf, size_t *len,
20 unsigned int type)
Soby Mathewf05d93a2022-03-22 16:21:19 +000021{
Manish V Badarkhe37f9ac22023-03-12 21:34:44 +000022 psa_status_t ret;
Soby Mathewf05d93a2022-03-22 16:21:19 +000023
Manish V Badarkhe37f9ac22023-03-12 21:34:44 +000024 assert(type == ATTEST_KEY_CURVE_ECC_SECP384R1);
Soby Mathewf05d93a2022-03-22 16:21:19 +000025
Manish V Badarkhe37f9ac22023-03-12 21:34:44 +000026 ret = rss_delegated_attest_get_delegated_key(0U, 0U, (uint8_t *)buf,
27 *len, len, 0U);
Soby Mathewf05d93a2022-03-22 16:21:19 +000028
Manish V Badarkhe37f9ac22023-03-12 21:34:44 +000029 return ret;
Soby Mathewf05d93a2022-03-22 16:21:19 +000030}