Skip to content

Commit f8c6c23

Browse files
committed
TRNG - protect HAL implementation if DEVICE_TRNG is not defined
1 parent 9048113 commit f8c6c23

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_MCU_K64F/trng_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* Reference: "K64 Sub-Family Reference Manual, Rev. 2", chapter 34
2323
*/
2424

25+
#if defined(DEVICE_TRNG)
26+
2527
#include <stdlib.h>
2628
#include "cmsis.h"
2729
#include "fsl_common.h"
@@ -81,3 +83,5 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
8183

8284
return 0;
8385
}
86+
87+
#endif

hal/targets/hal/TARGET_NUVOTON/TARGET_NUC472/trng_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*
1919
*/
2020

21+
#if DEVICE_TRNG
2122

2223
#include <stdlib.h>
2324
#include <string.h>
@@ -95,5 +96,5 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
9596
return 0;
9697
}
9798

98-
99+
#endif
99100

hal/targets/hal/TARGET_STM/TARGET_STM32F4/trng_api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*
1919
*/
2020

21+
#if defined(DEVICE_TRNG)
2122

2223
#if defined(TARGET_STM32F405xx) || defined(TARGET_STM32F415xx) || defined(TARGET_STM32F407xx) || defined(TARGET_STM32F417xx) ||\
2324
defined(TARGET_STM32F427xx) || defined(TARGET_STM32F437xx) || defined(TARGET_STM32F429xx) || defined(TARGET_STM32F439xx) ||\
@@ -78,3 +79,4 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
7879
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
7980
STM32F429xx || STM32F439xx || STM32F410xx || STM32F469xx || STM32F479xx */
8081

82+
#endif

hal/targets/hal/TARGET_STM/TARGET_STM32F7/trng_api.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*
1919
*/
2020

21+
#if defined(DEVICE_TRNG)
2122

2223
#include <stdlib.h>
2324
#include "cmsis.h"
@@ -71,3 +72,4 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
7172
return( ret );
7273
}
7374

75+
#endif

0 commit comments

Comments
 (0)