summaryrefslogtreecommitdiffstats
path: root/lib/psa/delegated_attestation.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 17:43:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 17:43:51 +0000
commitbe58c81aff4cd4c0ccf43dbd7998da4a6a08c03b (patch)
tree779c248fb61c83f65d1f0dc867f2053d76b4e03a /lib/psa/delegated_attestation.c
parentInitial commit. (diff)
downloadarm-trusted-firmware-be58c81aff4cd4c0ccf43dbd7998da4a6a08c03b.tar.xz
arm-trusted-firmware-be58c81aff4cd4c0ccf43dbd7998da4a6a08c03b.zip
Adding upstream version 2.10.0+dfsg.upstream/2.10.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/psa/delegated_attestation.c')
-rw-r--r--lib/psa/delegated_attestation.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/psa/delegated_attestation.c b/lib/psa/delegated_attestation.c
new file mode 100644
index 0000000..81e2621
--- /dev/null
+++ b/lib/psa/delegated_attestation.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include <delegated_attestation.h>
+#include <psa/client.h>
+#include <psa_manifest/sid.h>
+
+psa_status_t
+rss_delegated_attest_get_delegated_key(uint8_t ecc_curve,
+ uint32_t key_bits,
+ uint8_t *key_buf,
+ size_t key_buf_size,
+ size_t *key_size,
+ uint32_t hash_algo)
+{
+ psa_status_t status;
+ psa_invec in_vec[] = {
+ {&ecc_curve, sizeof(ecc_curve)},
+ {&key_bits, sizeof(key_bits)},
+ {&hash_algo, sizeof(hash_algo)}
+ };
+ psa_outvec out_vec[] = {
+ {key_buf, key_buf_size}
+ };
+
+ if (key_size == NULL) {
+ return PSA_ERROR_INVALID_ARGUMENT;
+ }
+
+ status = psa_call(RSS_DELEGATED_SERVICE_HANDLE,
+ RSS_DELEGATED_ATTEST_GET_DELEGATED_KEY,
+ in_vec, IOVEC_LEN(in_vec),
+ out_vec, IOVEC_LEN(out_vec));
+ if (status == PSA_SUCCESS) {
+ *key_size = out_vec[0].len;
+ }
+
+ return status;
+}
+
+psa_status_t
+rss_delegated_attest_get_token(const uint8_t *dak_pub_hash,
+ size_t dak_pub_hash_size,
+ uint8_t *token_buf,
+ size_t token_buf_size,
+ size_t *token_size)
+{
+ psa_status_t status;
+ psa_invec in_vec[] = {
+ {dak_pub_hash, dak_pub_hash_size}
+ };
+ psa_outvec out_vec[] = {
+ {token_buf, token_buf_size}
+ };
+
+ if (token_size == NULL) {
+ return PSA_ERROR_INVALID_ARGUMENT;
+ }
+
+ status = psa_call(RSS_DELEGATED_SERVICE_HANDLE,
+ RSS_DELEGATED_ATTEST_GET_PLATFORM_TOKEN,
+ in_vec, IOVEC_LEN(in_vec),
+ out_vec, IOVEC_LEN(out_vec));
+ if (status == PSA_SUCCESS) {
+ *token_size = out_vec[0].len;
+ }
+
+ return status;
+}