diff --git a/include/mbedtls/psa_util.h b/include/mbedtls/psa_util.h index 81de5fc81f..8e4366d938 100644 --- a/include/mbedtls/psa_util.h +++ b/include/mbedtls/psa_util.h @@ -3,7 +3,7 @@ * * \brief Utility functions for the use of the PSA Crypto library. * - * \warning This function is not part of the public API and may + * \warning These functions are not part of the public API and may * change at any time. */ /* diff --git a/library/cipher.c b/library/cipher.c index 015e25d799..2a8e257492 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -56,7 +56,7 @@ #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "psa/crypto.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #endif /* MBEDTLS_USE_PSA_CRYPTO */ #if defined(MBEDTLS_NIST_KW_C) diff --git a/library/lmots.c b/library/lmots.c index 4ef2c5178e..40306546d0 100644 --- a/library/lmots.c +++ b/library/lmots.c @@ -41,7 +41,7 @@ #include "mbedtls/lms.h" #include "mbedtls/platform_util.h" #include "mbedtls/error.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "psa/crypto.h" diff --git a/library/lms.c b/library/lms.c index 823ce09f89..4a42f679ac 100644 --- a/library/lms.c +++ b/library/lms.c @@ -39,7 +39,7 @@ #include "lmots.h" #include "psa/crypto.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "mbedtls/lms.h" #include "mbedtls/error.h" #include "mbedtls/platform_util.h" diff --git a/library/md.c b/library/md.c index a29d876e9e..964d4bd301 100644 --- a/library/md.c +++ b/library/md.c @@ -56,7 +56,7 @@ #if defined(MBEDTLS_PSA_CRYPTO_C) #include #include "md_psa.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #endif #if defined(MBEDTLS_MD_SOME_PSA) diff --git a/library/pk.c b/library/pk.c index 77bf29183b..03c1e353bd 100644 --- a/library/pk.c +++ b/library/pk.c @@ -39,7 +39,7 @@ #endif #if defined(MBEDTLS_PSA_CRYPTO_C) -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "md_psa.h" #endif diff --git a/library/pk_internal.h b/library/pk_internal.h index 3d05f57b9f..416ef234f6 100644 --- a/library/pk_internal.h +++ b/library/pk_internal.h @@ -34,7 +34,7 @@ #endif #if defined(MBEDTLS_PSA_CRYPTO_C) -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #define PSA_PK_TO_MBEDTLS_ERR(status) psa_pk_status_to_mbedtls(status) #define PSA_PK_RSA_TO_MBEDTLS_ERR(status) PSA_TO_MBEDTLS_ERR_LIST(status, \ psa_to_pk_rsa_errors, \ diff --git a/library/pk_wrap.c b/library/pk_wrap.c index 3c14fd1f49..3fe2c3e0d2 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -43,7 +43,7 @@ #endif #if defined(MBEDTLS_PSA_CRYPTO_C) -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #endif #if defined(MBEDTLS_USE_PSA_CRYPTO) diff --git a/library/pkcs12.c b/library/pkcs12.c index 2f1495a1a0..db31722c1b 100644 --- a/library/pkcs12.c +++ b/library/pkcs12.c @@ -39,7 +39,7 @@ #include "mbedtls/des.h" #endif -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #if defined(MBEDTLS_ASN1_PARSE_C) diff --git a/library/pkcs5.c b/library/pkcs5.c index d620dc1ceb..5d415ca41f 100644 --- a/library/pkcs5.c +++ b/library/pkcs5.c @@ -44,7 +44,7 @@ #include "mbedtls/platform.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #if defined(MBEDTLS_ASN1_PARSE_C) static int pkcs5_parse_pbkdf2_params(const mbedtls_asn1_buf *params, diff --git a/library/pkparse.c b/library/pkparse.c index 483176abc2..e3d84c266a 100644 --- a/library/pkparse.c +++ b/library/pkparse.c @@ -54,7 +54,7 @@ #endif #if defined(MBEDTLS_PSA_CRYPTO_C) -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #endif #if defined(MBEDTLS_USE_PSA_CRYPTO) diff --git a/library/pkwrite.c b/library/pkwrite.c index 5f801e27d4..4ec0b81c58 100644 --- a/library/pkwrite.c +++ b/library/pkwrite.c @@ -53,7 +53,7 @@ #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "psa/crypto.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #endif #include "mbedtls/platform.h" diff --git a/library/psa_crypto_pake.c b/library/psa_crypto_pake.c index e22bcf825b..c2e7dba241 100644 --- a/library/psa_crypto_pake.c +++ b/library/psa_crypto_pake.c @@ -28,7 +28,7 @@ #include "psa_crypto_slot_management.h" #include -#include +#include #include #include diff --git a/library/psa_crypto_random_impl.h b/library/psa_crypto_random_impl.h index 4197b4be42..2a75a439a2 100644 --- a/library/psa_crypto_random_impl.h +++ b/library/psa_crypto_random_impl.h @@ -3,12 +3,12 @@ * \brief PSA crypto random generator implementation abstraction. * * The definitions here need to be consistent with the declarations - * in include/mbedtls/psa_util.h. This file contains some redundant + * in include/psa_util_internal.h. This file contains some redundant * declarations to increase the chance that a compiler will detect * inconsistencies if one file is changed without updating the other, * but not all potential inconsistencies can be enforced, so make sure * to check the public declarations and contracts in - * include/mbedtls/psa_util.h if you modify this file. + * include/psa_util_internal.h if you modify this file. */ /* * Copyright The Mbed TLS Contributors @@ -30,7 +30,7 @@ #ifndef PSA_CRYPTO_RANDOM_IMPL_H #define PSA_CRYPTO_RANDOM_IMPL_H -#include +#include #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) @@ -123,7 +123,7 @@ typedef struct { mbedtls_psa_drbg_context_t drbg; } mbedtls_psa_random_context_t; -/* Defined in include/mbedtls/psa_util.h so that it's visible to +/* Defined in include/psa_util_internal.h so that it's visible to * application code. The declaration here is redundant, but included * as a safety net to make it more likely that a future change that * accidentally causes the implementation to diverge from the interface @@ -154,7 +154,7 @@ static mbedtls_f_rng_t *const mbedtls_psa_get_random; /* psa_crypto.c sets this variable to a pointer to the DRBG state in the * global PSA crypto state. */ /* The type `mbedtls_psa_drbg_context_t` is defined in - * include/mbedtls/psa_util.h so that `mbedtls_psa_random_state` can be + * include/psa_util_internal.h so that `mbedtls_psa_random_state` can be * declared there and be visible to application code. */ extern mbedtls_psa_drbg_context_t *const mbedtls_psa_random_state; diff --git a/library/psa_util.c b/library/psa_util.c index 70b80d84c4..4469520c0a 100644 --- a/library/psa_util.c +++ b/library/psa_util.c @@ -25,7 +25,7 @@ #include #include "psa_crypto_core.h" -#include +#include #include #include #include diff --git a/library/psa_util_internal.h b/library/psa_util_internal.h new file mode 100644 index 0000000000..5e4dc63bd9 --- /dev/null +++ b/library/psa_util_internal.h @@ -0,0 +1,32 @@ +/** + * \file psa_util_internal.h + * + * \brief Internal utility functions for use of PSA Crypto. + */ +/* + * Copyright The Mbed TLS Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MBEDTLS_PSA_UTIL_INTERNAL_H +#define MBEDTLS_PSA_UTIL_INTERNAL_H + +/* Include the public header so that users only need one include. */ +#include "mbedtls/psa_util.h" + +#if defined(MBEDTLS_PSA_CRYPTO_C) + +#endif /* MBEDTLS_PSA_CRYPTO_C */ +#endif /* MBEDTLS_PSA_UTIL_INTERNAL_H */ diff --git a/library/ssl_misc.h b/library/ssl_misc.h index 2b115dc321..325bb097ca 100644 --- a/library/ssl_misc.h +++ b/library/ssl_misc.h @@ -29,7 +29,7 @@ #if defined(MBEDTLS_USE_PSA_CRYPTO) || defined(MBEDTLS_SSL_PROTO_TLS1_3) #include "psa/crypto.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #endif #if defined(MBEDTLS_MD_CAN_MD5) diff --git a/library/ssl_msg.c b/library/ssl_msg.c index e9050230b3..2aba17b57e 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -40,7 +40,7 @@ #include #if defined(MBEDTLS_USE_PSA_CRYPTO) -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "psa/crypto.h" #endif diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 06637a951d..46b0a2224f 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -42,7 +42,7 @@ #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "md_psa.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "psa/crypto.h" #endif diff --git a/library/ssl_tls12_client.c b/library/ssl_tls12_client.c index e4f38212fa..8aaf37a7d6 100644 --- a/library/ssl_tls12_client.c +++ b/library/ssl_tls12_client.c @@ -31,7 +31,7 @@ #include "mbedtls/constant_time.h" #if defined(MBEDTLS_USE_PSA_CRYPTO) -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "psa/crypto.h" #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) /* Define a local translating function to save code size by not using too many diff --git a/library/ssl_tls13_generic.c b/library/ssl_tls13_generic.c index 1bf627d609..5d5b853d8e 100644 --- a/library/ssl_tls13_generic.c +++ b/library/ssl_tls13_generic.c @@ -37,7 +37,7 @@ #include "ssl_debug_helpers.h" #include "psa/crypto.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #if defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED) || \ defined(PSA_WANT_ALG_ECDH) || defined(PSA_WANT_ALG_FFDH) diff --git a/library/x509_crt.c b/library/x509_crt.c index a783b185a6..b3bcdaf669 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -46,7 +46,7 @@ #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "psa/crypto.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "md_psa.h" #endif /* MBEDTLS_USE_PSA_CRYPTO */ #include "pk_internal.h" diff --git a/library/x509write_crt.c b/library/x509write_crt.c index 59fd589003..bcee4dcca5 100644 --- a/library/x509write_crt.c +++ b/library/x509write_crt.c @@ -44,7 +44,7 @@ #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "psa/crypto.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "md_psa.h" #endif /* MBEDTLS_USE_PSA_CRYPTO */ diff --git a/library/x509write_csr.c b/library/x509write_csr.c index d792d34509..b67cdde282 100644 --- a/library/x509write_csr.c +++ b/library/x509write_csr.c @@ -35,7 +35,7 @@ #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "psa/crypto.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "md_psa.h" #endif /* MBEDTLS_USE_PSA_CRYPTO */ diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index 6ff235dbb4..753cb4396f 100644 --- a/tests/include/test/psa_crypto_helpers.h +++ b/tests/include/test/psa_crypto_helpers.h @@ -29,7 +29,7 @@ #endif #if defined(MBEDTLS_USE_PSA_CRYPTO) -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #endif #if defined(MBEDTLS_MD_LIGHT) diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function index a204841eac..1519cf598b 100644 --- a/tests/suites/test_suite_pk.function +++ b/tests/suites/test_suite_pk.function @@ -19,7 +19,7 @@ #include "md_psa.h" /* Used for properly sizing the key buffer in pk_genkey_ec() */ -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #define RSA_KEY_SIZE 512 #define RSA_KEY_LEN 64 diff --git a/tests/suites/test_suite_random.function b/tests/suites/test_suite_random.function index 0df92b044b..22c6d434c3 100644 --- a/tests/suites/test_suite_random.function +++ b/tests/suites/test_suite_random.function @@ -7,7 +7,7 @@ #include "mbedtls/ecdsa.h" #include "mbedtls/entropy.h" #include "mbedtls/hmac_drbg.h" -#include "mbedtls/psa_util.h" +#include "psa_util_internal.h" #include "psa/crypto.h" /* How many bytes to generate in each test case for repeated generation.