Antonio de Angelis | 7557e68 | 2022-11-30 15:37:51 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | #include <string.h> |
| 11 | |
| 12 | #include "config_crypto.h" |
| 13 | |
| 14 | #include "crypto_library.h" |
| 15 | |
| 16 | #include "mbedtls/build_info.h" |
| 17 | |
| 18 | #ifndef MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER |
| 19 | #error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER must be selected in Mbed TLS config file" |
| 20 | #endif |
| 21 | |
| 22 | /* Mbed TLS is guaranteed not to have a version string longer than 18 bytes */ |
| 23 | static char mbedtls_version_full[18]; |
| 24 | |
| 25 | /*! |
| 26 | * \defgroup tfm_crypto_library Set of functions implementing the abstractions of the underlying cryptographic |
| 27 | * library that implements the PSA Crypto APIs to provide the PSA Crypto core |
| 28 | * functionality to the TF-M Crypto service. Currently it supports only an |
| 29 | * mbed TLS based abstraction. |
| 30 | */ |
| 31 | /*!@{*/ |
| 32 | tfm_crypto_library_key_id_t tfm_crypto_library_key_id_init(int32_t owner, psa_key_id_t key_id) |
| 33 | { |
| 34 | return mbedtls_svc_key_id_make(owner, key_id); |
| 35 | } |
| 36 | |
| 37 | char *tfm_crypto_library_get_info(void) |
| 38 | { |
| 39 | memcpy(mbedtls_version_full, MBEDTLS_VERSION_STRING_FULL, sizeof(MBEDTLS_VERSION_STRING_FULL)); |
| 40 | return mbedtls_version_full; |
| 41 | } |
| 42 | /*!@}*/ |