blob: e055bad1cc26a26159642c8ec231df71abbc13a9 [file] [log] [blame]
Julian Halleff4b282020-11-23 18:24:12 +01001// SPDX-License-Identifier: BSD-2-Clause
2/*
3 * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
4 */
5
6#include <service/crypto/client/cpp/crypto_client.h>
7#include <app/ts-demo/ts-demo.h>
8#include <service_locator.h>
9#include <rpc_caller.h>
10
11int main(int argc, char *argv[]) {
12 (void) argc;
13 (void) argv;
14
15 int status = -1;
16 struct service_context *crypto_service_context = NULL;
17
18 service_locator_init();
19
20 crypto_service_context = service_locator_query("sn:trustedfirmware.org:crypto:0", &status);
21
22 if (crypto_service_context) {
23
24 struct rpc_caller *caller;
25 rpc_session_handle rpc_session_handle;
26
27 rpc_session_handle = service_context_open(crypto_service_context, &caller);
28
29 if (rpc_session_handle) {
30
31 crypto_client crypto_client(caller);
32
33 status = run_ts_demo(&crypto_client, true);
34
35 if (status != 0) {
36 printf("run_ts_demo failed\n");
37 }
38
39 service_context_close(crypto_service_context, rpc_session_handle);
40 }
41 else {
42 printf("Failed to open rpc session\n");
43 }
44
45 service_context_relinquish(crypto_service_context);
46 }
47 else {
48 printf("Failed to discover crypto service\n");
49 }
50
51 return status;
52}