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 | |
| 21 | psa_crypto_init(); |
| 22 | service_locator_init(); |
| 23 | |
| 24 | /* Fetch platform info */ |
| 25 | std::string error_msg; |
| 26 | std::vector<uint8_t> attest_report; |
| 27 | |
| 28 | if (fetch_attest_report(attest_report, error_msg)) { |
| 29 | |
| 30 | rval = pretty_report_dump(attest_report.data(), attest_report.size()); |
| 31 | } |
| 32 | else { |
| 33 | |
| 34 | printf("%s\n", error_msg.c_str()); |
| 35 | } |
| 36 | |
| 37 | return rval; |
| 38 | } |