1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3 * Copyright (C) Foundries Ltd. 2021 - All Rights Reserved
4 * Author: Jorge Ramirez <jorge@foundries.io>
5 */
6
7 #include <apdu.h>
8 #include <config.h>
9 #include <crypto/crypto_se.h>
10 #include <se050.h>
11
crypto_se_do_apdu(enum crypto_apdu_type type,uint8_t * hdr,size_t hdr_len,uint8_t * src_data,size_t src_len,uint8_t * dst_data,size_t * dst_len)12 TEE_Result crypto_se_do_apdu(enum crypto_apdu_type type,
13 uint8_t *hdr, size_t hdr_len,
14 uint8_t *src_data, size_t src_len,
15 uint8_t *dst_data, size_t *dst_len)
16 {
17 sss_status_t status = kStatus_SSS_Fail;
18
19 status = sss_se05x_do_apdu(&se050_session->s_ctx, type,
20 hdr, hdr_len, src_data, src_len,
21 dst_data, dst_len);
22 if (status != kStatus_SSS_Success)
23 return TEE_ERROR_GENERIC;
24
25 return TEE_SUCCESS;
26 }
27