jk-arm | 957cfea | 2021-06-18 15:52:12 +0530 | [diff] [blame] | 1 | /** @file |
| 2 | * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved. |
| 3 | * SPDX-License-Identifier : Apache-2.0 |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | **/ |
| 17 | |
| 18 | #include <stdio.h> |
| 19 | #include <stdlib.h> |
| 20 | #include "pal_common.h" |
| 21 | #include "unix_msg.h" |
| 22 | |
| 23 | int32_t val_entry(void); |
| 24 | |
| 25 | /** |
| 26 | @brief - PSA C main function, used for generating host-side test binaries. |
| 27 | @param - argc : the number of command line arguments. |
| 28 | argv : array containing command line arguments. |
| 29 | @return - error status |
| 30 | **/ |
| 31 | extern uint8_t buffer[4096]; |
| 32 | uint8_t buffer[4096]; |
| 33 | char *key_file, *chain_file; |
| 34 | |
| 35 | int main(int argc, char *argv[]) |
| 36 | { |
| 37 | if (argc < 4) { |
| 38 | printf("Usage:\n\tpsa_adac_test <keyfile> <chainfile> <socket>\n\n"); |
| 39 | exit(-1); |
| 40 | } |
| 41 | |
| 42 | key_file = argv[1]; |
| 43 | chain_file = argv[2]; |
| 44 | char *socket_path = argv[3]; |
| 45 | int fd; |
| 46 | |
| 47 | fd = unix_socket_client(socket_path); |
| 48 | if (-1 == fd) |
| 49 | exit(-1); |
| 50 | |
| 51 | msg_interface_init((void *) &fd, buffer, sizeof(buffer)); |
| 52 | |
| 53 | return val_entry(); |
| 54 | |
| 55 | msg_interface_free(NULL); |
| 56 | return 0; |
| 57 | } |