aboutsummaryrefslogtreecommitdiff
path: root/components/app/platform-inspect/platform_inspect.cpp
blob: fd0e05ba9c2c0b068e5df5d27042da4a91cabec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <cstdint>
#include <cstdio>
#include <string>
#include <vector>
#include <psa/crypto.h>
#include <service_locator.h>
#include <service/attestation/reporter/dump/raw/raw_report_dump.h>
#include <service/attestation/reporter/dump/pretty/pretty_report_dump.h>
#include "attest_report_fetcher.h"

int main(int argc, char *argv[])
{
    int rval = -1;

    psa_crypto_init();
    service_locator_init();

    /* Fetch platform info */
    std::string error_msg;
    std::vector<uint8_t> attest_report;

    if (fetch_attest_report(attest_report, error_msg)) {

        rval = pretty_report_dump(attest_report.data(), attest_report.size());
    }
    else {

        printf("%s\n", error_msg.c_str());
    }

    return rval;
}