14353bb20SYann Gautier /* 24353bb20SYann Gautier * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. 34353bb20SYann Gautier * 44353bb20SYann Gautier * SPDX-License-Identifier: BSD-3-Clause 54353bb20SYann Gautier */ 64353bb20SYann Gautier 74353bb20SYann Gautier #include <stdint.h> 84353bb20SYann Gautier 9*09d40e0eSAntonio Nino Diaz #include <arch_helpers.h> 10*09d40e0eSAntonio Nino Diaz #include <plat/common/platform.h> 11*09d40e0eSAntonio Nino Diaz 124353bb20SYann Gautier #define RANDOM_CANARY_VALUE 2144346116U 134353bb20SYann Gautier 144353bb20SYann Gautier u_register_t plat_get_stack_protector_canary(void) 154353bb20SYann Gautier { 164353bb20SYann Gautier /* 174353bb20SYann Gautier * Ideally, a random number should be returned instead of the 184353bb20SYann Gautier * combination of a timer's value and a compile-time constant. 194353bb20SYann Gautier */ 204353bb20SYann Gautier return RANDOM_CANARY_VALUE ^ (u_register_t)read_cntpct_el0(); 214353bb20SYann Gautier } 224353bb20SYann Gautier 23