Julian Hall | 4834e63 | 2021-05-26 15:33:06 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <cstdint> |
| 8 | #include <cstdio> |
| 9 | #include <string> |
| 10 | #include <vector> |
| 11 | #include <psa/crypto.h> |
| 12 | #include <service_locator.h> |
| 13 | #include <service/attestation/reporter/dump/raw/raw_report_dump.h> |
| 14 | #include <service/attestation/reporter/dump/pretty/pretty_report_dump.h> |
| 15 | #include "attest_report_fetcher.h" |
| 16 | |
| 17 | int main(int argc, char *argv[]) |
| 18 | { |
| 19 | int rval = -1; |
| 20 | |
Julian Hall | b2954bc | 2021-08-12 11:52:11 +0100 | [diff] [blame^] | 21 | psa_status_t psa_status = psa_crypto_init(); |
| 22 | |
| 23 | if (psa_status != PSA_SUCCESS) { |
| 24 | |
| 25 | printf("psa_crypto_init failed: %d\n", psa_status); |
| 26 | return rval; |
| 27 | } |
| 28 | |
Julian Hall | 4834e63 | 2021-05-26 15:33:06 +0100 | [diff] [blame] | 29 | service_locator_init(); |
| 30 | |
| 31 | /* Fetch platform info */ |
| 32 | std::string error_msg; |
| 33 | std::vector<uint8_t> attest_report; |
| 34 | |
| 35 | if (fetch_attest_report(attest_report, error_msg)) { |
| 36 | |
| 37 | rval = pretty_report_dump(attest_report.data(), attest_report.size()); |
| 38 | } |
| 39 | else { |
| 40 | |
| 41 | printf("%s\n", error_msg.c_str()); |
| 42 | } |
| 43 | |
| 44 | return rval; |
| 45 | } |