Tamas Ban | c034b73 | 2022-02-11 15:24:05 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018-2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <initial_attestation.h> |
| 9 | #include <psa/client.h> |
| 10 | #include <psa_manifest/sid.h> |
| 11 | |
| 12 | psa_status_t |
| 13 | psa_initial_attest_get_token(const uint8_t *auth_challenge, |
| 14 | size_t challenge_size, |
| 15 | uint8_t *token_buf, |
| 16 | size_t token_buf_size, |
| 17 | size_t *token_size) |
| 18 | { |
| 19 | psa_status_t status; |
| 20 | psa_invec in_vec[] = { |
| 21 | {auth_challenge, challenge_size} |
| 22 | }; |
| 23 | psa_outvec out_vec[] = { |
| 24 | {token_buf, token_buf_size}, |
| 25 | }; |
| 26 | |
| 27 | status = psa_call(RSS_ATTESTATION_SERVICE_HANDLE, RSS_ATTEST_GET_TOKEN, |
| 28 | in_vec, IOVEC_LEN(in_vec), |
| 29 | out_vec, IOVEC_LEN(out_vec)); |
| 30 | |
| 31 | if (status == PSA_SUCCESS) { |
| 32 | *token_size = out_vec[0].len; |
| 33 | } |
| 34 | |
| 35 | return status; |
| 36 | } |