1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

setup: move stack smashing protection code to setup.c

This commit is contained in:
Pavol Rusnak 2017-07-26 16:50:52 +02:00
parent e33e1ec0b1
commit 0760ff0468
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 12 additions and 14 deletions

View File

@ -120,13 +120,7 @@ void bootloader_loop(void)
usbLoop(firmware_present());
}
uint32_t __stack_chk_guard;
void __attribute__((noreturn)) __stack_chk_fail(void)
{
layoutDialog(&bmp_icon_error, NULL, NULL, NULL, "Stack smashing", "detected.", NULL, "Please unplug", "the device.", NULL);
for (;;) {} // loop forever
}
extern uint32_t __stack_chk_guard;
int main(void)
{

View File

@ -31,13 +31,7 @@
#include "buttons.h"
#include "fastflash.h"
uint32_t __stack_chk_guard;
void __attribute__((noreturn)) __stack_chk_fail(void)
{
layoutDialog(&bmp_icon_error, NULL, NULL, NULL, "Stack smashing", "detected.", NULL, "Please unplug", "the device.", NULL);
for (;;) {} // loop forever
}
extern uint32_t __stack_chk_guard;
void check_lock_screen(void)
{

10
setup.c
View File

@ -21,7 +21,17 @@
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/spi.h>
#include <libopencm3/stm32/f2/rng.h>
#include "rng.h"
#include "layout.h"
uint32_t __stack_chk_guard;
void __attribute__((noreturn)) __stack_chk_fail(void)
{
layoutDialog(&bmp_icon_error, NULL, NULL, NULL, "Stack smashing", "detected.", NULL, "Please unplug", "the device.", NULL);
for (;;) {} // loop forever
}
void setup(void)
{