/*
 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <stdint.h>

#include <lib/utils.h>
#include <lib/utils_def.h>

#include "rpi3_private.h"

/* Get 128 bits of entropy and fuse the values together to form the canary. */
#define TRNG_NBYTES	16U

u_register_t plat_get_stack_protector_canary(void)
{
	size_t i;
	u_register_t buf[TRNG_NBYTES / sizeof(u_register_t)];
	u_register_t ret = 0U;

	rpi3_rng_read(buf, sizeof(buf));

	for (i = 0U; i < ARRAY_SIZE(buf); i++)
		ret ^= buf[i];

	return ret;
}

/*
 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <stdint.h>

#include <lib/utils.h>

#include "rpi3_private.h"

/* Get 128 bits of entropy and fuse the values together to form the canary. */
#define TRNG_NBYTES	16U

u_register_t plat_get_stack_protector_canary(void)
{
	size_t i;
	u_register_t buf[TRNG_NBYTES / sizeof(u_register_t)];
	u_register_t ret = 0U;

	rpi3_rng_read(buf, sizeof(buf));

	for (i = 0U; i < ARRAY_SIZE(buf); i++)
		ret ^= buf[i];

	return ret;
}

--- 
+++ 
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -7,6 +7,7 @@
 #include <stdint.h>
 
 #include <lib/utils.h>
+#include <lib/utils_def.h>
 
 #include "rpi3_private.h"
 
rpi3: Fix compilation error when stack protector is enabled

Include necessary header file to use ARRAY_SIZE() macro

Change-Id: I5b7caccd02c14c598b7944cf4f347606c1e7a8e7
Signed-off-by: Madhukar Pappireddy <c854e377c0ff08e0fa4357b6357bedff114c98a6@arm.com>
