mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-30 16:20:11 +00:00
psa_util: change guard for mbedtls_psa_get_random() to CRYPTO_CLIENT
This commit also: - updates changelog - add a stub function to be used in component_test_psa_crypto_client() test Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
a50190e2df
commit
1a58e9a232
@ -1,6 +1,6 @@
|
||||
Features
|
||||
* mbedtls_psa_get_random() is always available as soon as
|
||||
MBEDTLS_PSA_CRYPTO_C is enabled at build time and psa_crypto_init() is
|
||||
MBEDTLS_PSA_CRYPTO_CLIENT is enabled at build time and psa_crypto_init() is
|
||||
called at runtime. This together with MBEDTLS_PSA_RANDOM_STATE can be
|
||||
used as random number generator function(f_rng) and context (p_rng) in
|
||||
legacy functions.
|
||||
|
@ -21,7 +21,7 @@
|
||||
* otherwise error codes would be unknown in test_suite_psa_crypto_util.data.*/
|
||||
#include <mbedtls/asn1write.h>
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT)
|
||||
|
||||
/** The random generator function for the PSA subsystem.
|
||||
*
|
||||
@ -139,7 +139,7 @@ static inline mbedtls_md_type_t mbedtls_md_type_from_psa_alg(psa_algorithm_t psa
|
||||
{
|
||||
return (mbedtls_md_type_t) (psa_alg & PSA_ALG_HASH_MASK);
|
||||
}
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_CLIENT */
|
||||
|
||||
#if defined(MBEDTLS_PSA_UTIL_HAVE_ECDSA)
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "psa_util_internal.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT)
|
||||
|
||||
#include <psa/crypto.h>
|
||||
|
||||
@ -363,7 +363,7 @@ int mbedtls_psa_get_random(void *p_rng,
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_CLIENT */
|
||||
|
||||
#if defined(MBEDTLS_PSA_UTIL_HAVE_ECDSA)
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "psa/crypto.h"
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_C)
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT)
|
||||
|
||||
/*************************************************************************
|
||||
* FFDH
|
||||
@ -96,5 +96,5 @@ int psa_pk_status_to_mbedtls(psa_status_t status);
|
||||
sizeof(error_list)/sizeof(error_list[0]), \
|
||||
fallback_f)
|
||||
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_C */
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_CLIENT */
|
||||
#endif /* MBEDTLS_PSA_UTIL_INTERNAL_H */
|
||||
|
25
tests/src/psa_crypto_stubs.c
Normal file
25
tests/src/psa_crypto_stubs.c
Normal file
@ -0,0 +1,25 @@
|
||||
/** \file psa_crypto_stubs.c
|
||||
*
|
||||
* \brief Stub functions when MBEDTLS_PSA_CRYPTO_CLIENT is enabled but
|
||||
* MBEDTLS_PSA_CRYPTO_C is disabled.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <psa/crypto.h>
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
|
||||
|
||||
psa_status_t psa_generate_random(uint8_t *output,
|
||||
size_t output_size)
|
||||
{
|
||||
(void) output;
|
||||
(void) output_size;
|
||||
|
||||
return PSA_ERROR_COMMUNICATION_FAILURE;
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_CLIENT !MBEDTLS_PSA_CRYPTO_C */
|
Loading…
x
Reference in New Issue
Block a user