|
1 | 1 | /* |
2 | | -* Copyright (c) 2018 ARM Limited. All rights reserved. |
| 2 | +* Copyright (c) 2018-2020 ARM Limited. All rights reserved. |
3 | 3 | * SPDX-License-Identifier: Apache-2.0 |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
5 | 5 | * not use this file except in compliance with the License. |
|
69 | 69 |
|
70 | 70 | using namespace utest::v1; |
71 | 71 |
|
72 | | -#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C)) |
73 | | -#include "entropy.h" |
74 | | -#include "entropy_poll.h" |
75 | | -#include "crypto.h" |
76 | | -#if !defined(MAX) |
77 | | -#define MAX(a,b) (((a)>(b))?(a):(b)) |
78 | | -#endif |
79 | | - |
80 | | -/* Calculating the minimum allowed entropy size in bytes */ |
81 | | -#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE \ |
82 | | - MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE) |
83 | | - |
84 | | -void inject_entropy_for_psa() |
85 | | -{ |
86 | | - if (psa_crypto_init() == PSA_ERROR_INSUFFICIENT_ENTROPY) { |
87 | | - uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0}; |
88 | | - /* inject some a seed for test*/ |
89 | | - for (int i = 0; i < MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE; ++i) { |
90 | | - seed[i] = i; |
91 | | - } |
92 | | - |
93 | | - /* don't really care if this succeed this is just to make crypto init pass*/ |
94 | | - mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE); |
95 | | - } |
96 | | -} |
97 | | -#endif // (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C)) |
98 | | - |
99 | 72 | static int fill_buffer_trng(uint8_t *buffer, trng_t *trng_obj, size_t trng_len) |
100 | 73 | { |
101 | 74 | size_t temp_size = 0, output_length = 0; |
@@ -275,9 +248,6 @@ int main() |
275 | 248 | #if defined(MBEDTLS_PLATFORM_C) |
276 | 249 | ret = mbedtls_platform_setup(NULL); |
277 | 250 | #endif /* MBEDTLS_PLATFORM_C */ |
278 | | -#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C)) |
279 | | - inject_entropy_for_psa(); |
280 | | -#endif |
281 | 251 | ret = !Harness::run(specification); |
282 | 252 | #if defined(MBEDTLS_PLATFORM_C) |
283 | 253 | mbedtls_platform_teardown(NULL); |
|
0 commit comments