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 | #ifndef _VAL_ADAC_H_ |
| 19 | #define _VAL_ADAC_H_ |
| 20 | #include <psa_adac.h> |
| 21 | |
| 22 | /** \brief Token header |
| 23 | * |
| 24 | */ |
| 25 | typedef struct { |
| 26 | uint16_t type; |
| 27 | uint8_t *data; |
| 28 | size_t size; |
| 29 | } adac_command_frame_t; |
| 30 | |
| 31 | void val_adac_host_init(void); |
| 32 | psa_status_t val_load_certificate_chain(const char *chain_file, uint8_t **chain, |
| 33 | size_t *chain_size); |
| 34 | psa_status_t val_infer_cryptosystem(uint32_t *chain, size_t chain_size, psa_tlv_t **extns_list, |
| 35 | size_t *extns_count, uint8_t *key_system); |
| 36 | psa_status_t val_get_private_key(const char *key_file, uint8_t *type, psa_key_handle_t *handle, |
| 37 | uint8_t **key_ptr, size_t *size); |
| 38 | request_packet_t *val_construct_command(uint16_t command, uint8_t *data, size_t data_size); |
| 39 | psa_status_t val_issue_command(uint32_t command, request_packet_t *packet, |
| 40 | uint8_t *data, size_t data_size); |
| 41 | response_packet_t *val_await_response(void); |
| 42 | psa_status_t val_parse_response(uint32_t command, response_packet_t *packet); |
| 43 | |
| 44 | psa_status_t val_sign_token(uint8_t challenge[], size_t challenge_size, uint8_t signature_type, |
| 45 | uint8_t exts[], size_t exts_size, uint8_t *fragment[], |
| 46 | size_t *fragment_size, psa_key_handle_t handle, |
| 47 | uint8_t *key, size_t key_size); |
| 48 | psa_status_t val_send_certificate(psa_tlv_t **extns_list, size_t extns_count); |
| 49 | int val_check_cryptosystem_support(response_packet_t *packet, uint8_t key_system); |
| 50 | |
| 51 | #endif /* _VAL_ADAC_H_ */ |