1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-05 21:10:57 +00:00

refactor(core): introduce global trezor_rtl/bsp/model headers

[no changelog]
This commit is contained in:
cepetr 2024-11-01 12:55:31 +01:00
parent e2b85a5105
commit 8c7a3ab0e6
240 changed files with 598 additions and 682 deletions

View File

@ -17,20 +17,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include TREZOR_BOARD
#include "board_capabilities.h"
#include "bootutils.h"
#include "buffers.h"
#include "common.h"
#include "compiler_traits.h"
#include "display.h"
#include "display_draw.h"
#include "flash.h"
#include "flash_utils.h"
#include "image.h"
#include "model.h"
#include "mpu.h"
#include "pvd.h"
#include "reset_flags.h"
@ -38,6 +36,7 @@
#include "rsod.h"
#include "secret.h"
#include "system.h"
#include "systick.h"
#include "terminal.h"
#ifdef USE_SD_CARD
@ -59,7 +58,6 @@
#endif
#include "memzero.h"
#include "model.h"
#include "monoctr.h"
#include "option_bytes.h"
#include "tamper.h"

View File

@ -17,9 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include TREZOR_BOARD
#include <trezor_rtl.h>
#include "bootui.h"
#include "colors.h"

View File

@ -20,10 +20,9 @@
#ifndef __BOOTUI_H__
#define __BOOTUI_H__
#include <trezor_types.h>
#include "image.h"
#include "secbool.h"
#include "stdbool.h"
#include TREZOR_BOARD
typedef enum {
SCREEN_INTRO = 0,

View File

@ -1,20 +1,20 @@
#include <stdio.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include <unistd.h>
#include <SDL.h>
#include TREZOR_BOARD
#include "bootargs.h"
#include "bootui.h"
#include "common.h"
#include "display.h"
#include "flash.h"
#include "flash_otp.h"
#include "model.h"
#include "rust_ui.h"
#ifdef USE_OPTIGA
#include "secret.h"
#endif
#include "systick.h"
#include "emulator.h"

View File

@ -1,10 +1,9 @@
#ifndef __EMULATOR_H__
#define __EMULATOR_H__
#undef FIRMWARE_START
#include <trezor_types.h>
#include <stdint.h>
#include <stdio.h>
#undef FIRMWARE_START
extern uint8_t *FIRMWARE_START;

View File

@ -17,12 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_bsp.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include <sys/types.h>
#include "bootargs.h"
#include "bootutils.h"
#include "common.h"
#include "display.h"
#include "display_utils.h"
#include "flash.h"
@ -35,9 +37,9 @@
#include "pvd.h"
#include "random_delays.h"
#include "rsod.h"
#include "secbool.h"
#include "secret.h"
#include "system.h"
#include "systick.h"
#include "systimer.h"
#ifdef USE_DMA2D
@ -66,7 +68,6 @@
#include "hash_processor.h"
#endif
#include "model.h"
#include "usb.h"
#include "version.h"

View File

@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include <pb.h>
#include <pb_decode.h>
@ -25,11 +26,9 @@
#include "messages.pb.h"
#include "bootargs.h"
#include "common.h"
#include "flash.h"
#include "flash_utils.h"
#include "image.h"
#include "secbool.h"
#include "secret.h"
#include "unit_properties.h"
#include "usb.h"
@ -41,7 +40,6 @@
#include "version_check.h"
#include "memzero.h"
#include "model.h"
#ifdef TREZOR_EMULATOR
#include "emulator.h"

View File

@ -20,10 +20,9 @@
#ifndef __MESSAGES_H__
#define __MESSAGES_H__
#include <stdint.h>
#include <trezor_types.h>
#include "image.h"
#include "secbool.h"
#include TREZOR_BOARD
#define USB_TIMEOUT 500
#define USB_PACKET_SIZE 64

View File

@ -17,13 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_rtl.h>
#include "version_check.h"
#include "error_handling.h"
#include "model_version.h"
#include "monoctr.h"
#include "version_check.h"
void ensure_bootloader_min_version(void) {
monoctr_write(MONOCTR_BOOTLOADER_VERSION, BOOTLOADER_MONOTONIC_VERSION);

View File

@ -19,8 +19,7 @@
#pragma once
#include <stdint.h>
#include "secbool.h"
#include <trezor_types.h>
// Protection against bootloader downgrade

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_rtl.h>
#include "bootui.h"
#include "display.h"

View File

@ -20,7 +20,7 @@
#ifndef __BOOTUI_H__
#define __BOOTUI_H__
#include "secbool.h"
#include <trezor_types.h>
void ui_screen_welcome_third(void);

View File

@ -17,11 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <sys/types.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include <sys/types.h>
#include "bootutils.h"
#include "common.h"
#include "display.h"
#include "display_draw.h"
#include "flash.h"
@ -32,8 +32,8 @@
#include "random_delays.h"
#include "rng.h"
#include "rsod.h"
#include "secbool.h"
#include "system.h"
#include "systick.h"
#ifdef USE_TOUCH
#include "touch.h"
#endif
@ -42,7 +42,6 @@
#include "bootui.h"
#include "messages.h"
#include "model.h"
#include "version_check.h"
#ifdef USE_HASH_PROCESSOR

View File

@ -17,19 +17,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include <pb.h>
#include <pb_decode.h>
#include <pb_encode.h>
#include "messages.pb.h"
#include "common.h"
#include "flash.h"
#include "flash_utils.h"
#include "image.h"
#include "model.h"
#include "secbool.h"
#include "usb.h"
#include "version.h"

View File

@ -20,9 +20,9 @@
#ifndef __MESSAGES_H__
#define __MESSAGES_H__
#include <stdint.h>
#include <trezor_types.h>
#include "image.h"
#include "secbool.h"
#define USB_TIMEOUT 500
#define USB_PACKET_SIZE 64

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_rtl.h>
#include "py/mphal.h"
#include "py/objstr.h"
@ -27,7 +27,6 @@
#include "embed/extmod/trezorobj.h"
#include "common.h"
#include "entropy.h"
#include "memzero.h"
#include "storage.h"

View File

@ -20,9 +20,10 @@
#ifndef __NORCOW_CONFIG_H__
#define __NORCOW_CONFIG_H__
#include TREZOR_BOARD
#include <trezor_model.h>
#include <trezor_types.h>
#include "flash.h"
#include "model.h"
#define NORCOW_HEADER_LEN 0
#define NORCOW_SECTOR_COUNT 2

View File

@ -20,7 +20,7 @@
#ifndef __CRC_H__
#define __CRC_H__
#include <stdint.h>
#include <trezor_types.h>
uint32_t checksum_crc32(const uint8_t *data, uint32_t length, uint32_t crc);

View File

@ -17,16 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
#include <trezor_rtl.h>
#include "py/runtime.h"
#include TREZOR_BOARD
#if MICROPY_PY_TREZORCRYPTO
static mp_obj_t ui_wait_callback = mp_const_none;

View File

@ -21,7 +21,8 @@
/----------------------------------------------------------------------------*/
#include <string.h>
#include <trezor_rtl.h>
#include "ff.h" /* Declarations of FatFs API */
#include "diskio.h" /* Declarations of device I/O functions */

View File

@ -17,11 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_types.h>
#include "button.h"
#include "common.h"
#include "display.h"
#include "systick.h"
#include "embed/extmod/trezorobj.h"
#ifdef TREZOR_EMULATOR

View File

@ -17,7 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_rtl.h>
#include <unistd.h>
#include "py/mphal.h"
#include "py/objstr.h"
@ -25,9 +27,6 @@
#if MICROPY_PY_TREZORIO
#include <unistd.h>
#include TREZOR_BOARD
#include "button.h"
#include "touch.h"
#include "usb.h"

View File

@ -17,9 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <trezor_rtl.h>
#include "py/runtime.h"

View File

@ -22,6 +22,8 @@
#else
#include <trezor_types.h>
#include "py/bc.h"
#include "py/gc.h"
#include "py/nlr.h"
@ -36,9 +38,6 @@
#include "embed/rust/librust.h"
#include "embed/trezorhal/usb.h"
#include <stdio.h>
#include <string.h>
#define WORDS_PER_BLOCK ((MICROPY_BYTES_PER_GC_BLOCK) / MP_BYTES_PER_OBJ_WORD)
#define BYTES_PER_BLOCK (MICROPY_BYTES_PER_GC_BLOCK)

View File

@ -17,6 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "py/objstr.h"
#include "py/runtime.h"
@ -28,15 +31,11 @@
#include "embed/extmod/modtrezorutils/modtrezorutils-meminfo.h"
#include "embed/extmod/trezorobj.h"
#include <string.h>
#include "blake2s.h"
#include "bootutils.h"
#include "error_handling.h"
#include "fwutils.h"
#include "unit_properties.h"
#include "usb.h"
#include TREZOR_BOARD
#include "model.h"
#if USE_OPTIGA && !defined(TREZOR_EMULATOR)
#include "secret.h"

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_rtl.h>
#include "memzero.h"
#include "py/obj.h"

View File

@ -17,11 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include STM32_HAL_H
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <trezor_rtl.h>
#include "py/builtin.h"
#include "py/compile.h"
@ -36,10 +32,8 @@
#include "ports/stm32/gccollect.h"
#include "ports/stm32/pendsv.h"
#include "error_handling.h"
#include "rsod.h"
#include "rust_ui_common.h"
#include "secbool.h"
#include "systask.h"
#include "system.h"

View File

@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
#include <trezor_rtl.h>
#include "py/mphal.h"
#include "systick.h"

View File

@ -19,9 +19,10 @@
#ifdef SYSTEM_VIEW
#include "systemview.h"
#include <string.h>
#include <trezor_rtl.h>
#include "mpconfigport.h"
#include "systemview.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_rtl.h>
#include "applet.h"
#include "bl_check.h"

View File

@ -17,15 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <string.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "blake2s.h"
#include "board_capabilities.h"
#include "common.h"
#include "flash.h"
#include "image.h"
#include "memzero.h"
#include "model.h"
#include "mpu.h"
#include "uzlib.h"

View File

@ -17,8 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <trezor_rtl.h>
#include "buffers.h"
#include "common.h"
#include "fonts/fonts.h"
#include "memzero.h"

View File

@ -20,11 +20,8 @@
#ifndef _BUFFERS_H
#define _BUFFERS_H
#include <stdbool.h>
#include "common.h"
#include "model.h"
#include TREZOR_BOARD
#include <trezor_model.h>
#include <trezor_types.h>
#define BUFFER_PIXELS DISPLAY_RESX

View File

@ -20,8 +20,7 @@
#ifndef _COLORS_H
#define _COLORS_H
#include "common.h"
#include TREZOR_BOARD
#include <trezor_types.h>
#ifdef USE_RGB_COLORS
#define RGB16(R, G, B) ((R & 0xF8) << 8) | ((G & 0xFC) << 3) | ((B & 0xF8) >> 3)

31
core/embed/lib/common.h Normal file
View File

@ -0,0 +1,31 @@
/*
* This file is part of the Trezor project, https://trezor.io/
*
* Copyright (c) SatoshiLabs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIB_COMMON_H
// This header is included in storage modules that expect to find common
// functions like `ensure()`, `error_shutdown()`, or `hal_delay()`.
//
// Do not include this header or add dependencies to it unless required by
// storage.
#include "error_handling.h"
#include "systick.h"
#endif // LIB_COMMON_H

View File

@ -19,23 +19,20 @@
#define _GNU_SOURCE
#include "display_draw.h"
#include <trezor_rtl.h>
#include <stdarg.h>
#include "buffers.h"
#include "common.h"
#include "display.h"
#include "display_draw.h"
#include "fonts/fonts.h"
#include "memzero.h"
#ifdef USE_DMA2D
#include "dma2d.h"
#endif
#include "fonts/fonts.h"
#include <stdarg.h>
#include <string.h>
#include "memzero.h"
#include "display.h"
static struct {
int x, y;
} DISPLAY_OFFSET;

View File

@ -20,13 +20,10 @@
#ifndef __DISPLAY_DRAW_H__
#define __DISPLAY_DRAW_H__
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
#include "buffers.h"
#include "colors.h"
#include TREZOR_BOARD
#include "fonts/fonts.h"
// provided by common

View File

@ -17,8 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
#include <trezor_rtl.h>
#include "display.h"
#include "systick.h"
void display_fade(int start, int end, int delay) {
#ifdef USE_BACKLIGHT

View File

@ -17,10 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#include <stdint.h>
#include <trezor_rtl.h>
#include "error_handling.h"
#include "system.h"
#ifndef TREZOR_EMULATOR

View File

@ -17,14 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include TREZOR_BOARD
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "flash_utils.h"
#include "common.h"
#include "flash_area.h"
#include "model.h"
#include "flash_utils.h"
#include "mpu.h"
#include "secbool.h"
typedef struct {
const flash_area_t* area;

View File

@ -20,7 +20,7 @@
#ifndef LIB_FLASH_UTILS_H
#define LIB_FLASH_UTILS_H
#include "secbool.h"
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -1,3 +1,3 @@
#include <stdint.h>
#include <trezor_types.h>
extern const uint8_t* const Font_Bitmap;

View File

@ -17,11 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <trezor_rtl.h>
#include "fonts.h"
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#ifdef TRANSLATIONS
#include "librust_fonts.h"
#endif

View File

@ -23,7 +23,6 @@
#include <stdbool.h>
#include "fonts/font_bitmap.h"
#include TREZOR_BOARD
#ifdef USE_RGB_COLORS
#define TREZOR_FONT_BPP 4

View File

@ -20,8 +20,7 @@
#ifndef GFX_BITBLT_H
#define GFX_BITBLT_H
#include <stdbool.h>
#include <stdint.h>
#include <trezor_types.h>
#include "gfx_color.h"

View File

@ -20,7 +20,7 @@
#ifndef GFX_COLOR_H
#define GFX_COLOR_H
#include <stdint.h>
#include <trezor_types.h>
#ifdef UI_COLOR_32BIT
#define GFX_COLOR_32BIT

View File

@ -17,8 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <display.h>
#include <trezor_rtl.h>
#include "display.h"
#include "display_draw.h"
#include "fonts/fonts.h"
#include "gfx_draw.h"

View File

@ -17,14 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "ed25519-donna/ed25519.h"
#include "common.h"
#include "flash.h"
#include "image.h"
#include "model.h"
_Static_assert(VENDOR_HEADER_MAX_SIZE + IMAGE_HEADER_SIZE <= IMAGE_CHUNK_SIZE,
"The size of the firmware headers must be less than or equal to "

View File

@ -20,12 +20,12 @@
#ifndef __TREZORHAL_IMAGE_H__
#define __TREZORHAL_IMAGE_H__
#include <stdint.h>
#include <trezor_model.h>
#include <trezor_types.h>
#include "blake2s.h"
#include "flash.h"
#include "image_hash_conf.h"
#include "model.h"
#include "secbool.h"
#define VENDOR_HEADER_MAX_SIZE (64 * 1024)
#define IMAGE_HEADER_SIZE 0x400 // size of the bootloader or firmware header

View File

@ -1,8 +1,8 @@
#ifndef LIB_IMAGE_HASH_H_
#define LIB_IMAGE_HASH_H_
#include "model.h"
#include TREZOR_BOARD
#include <trezor_model.h>
#include <trezor_types.h>
#ifdef IMAGE_HASH_SHA256
#include "sha2.h"

View File

@ -43,8 +43,8 @@
*
*/
#include <string.h>
#include <stdarg.h>
#include <trezor_rtl.h>
#include "mini_printf.h"
static unsigned int

View File

@ -33,12 +33,14 @@
#ifndef __MINI_PRINTF__
#define __MINI_PRINTF__
#include <trezor_types.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
int mini_vsnprintf(char* buffer, unsigned int buffer_len, const char *fmt, va_list va) __attribute__ ((__format__ (__printf__, 3, 0)));
int mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));

View File

@ -17,11 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include TREZOR_BOARD
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "display.h"
#include "fonts/fonts.h"

View File

@ -1,11 +1,9 @@
#include "translations.h"
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include "common.h"
#include <trezor_model.h>
#include <trezor_rtl.h>
#include "flash.h"
#include "model.h"
#include "mpu.h"
#include "translations.h"
#ifdef KERNEL_MODE

View File

@ -20,8 +20,7 @@
#ifndef LIB_TRANSLATIONS_H
#define LIB_TRANSLATIONS_H
#include <stdbool.h>
#include <stdint.h>
#include <trezor_types.h>
bool translations_write(const uint8_t* data, uint32_t offset, uint32_t len);

View File

@ -17,15 +17,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __TREZORHAL_COMMON_H__
#define __TREZORHAL_COMMON_H__
#ifndef TREZOR_RTL_H
#define TREZOR_RTL_H
#include <stddef.h>
#include <stdint.h>
#include "secbool.h"
// `trezor_rtl.h` consolidates common includes for implementation files
// (.c files) and provides essential types and functions.
//
// Do not include `trezor_rtl.h` in interface headers to prevent global
// namespace pollution; use `trezor_types.h` instead.
#include <trezor_types.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "error_handling.h"
#include "systick.h"
#ifndef MIN_8bits
#define MIN_8bits(a, b) \
@ -54,4 +61,4 @@
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
#endif
#endif // TREZOR_RTL_H

View File

@ -0,0 +1,35 @@
/*
* This file is part of the Trezor project, https://trezor.io/
*
* Copyright (c) SatoshiLabs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TREZOR_TYPES_H
#define TREZOR_TYPES_H
// `trezor_types.h` consolidates commonly needed includes for interface
// header files and provides essential types required in most files.
//
// Avoid adding additional includes here unless absolutely necessary,
// as it may pollute the global namespace across the project.
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "secbool.h"
#endif // TREZOR_TYPES_H

View File

@ -0,0 +1,36 @@
/*
* This file is part of the Trezor project, https://trezor.io/
*
* Copyright (c) SatoshiLabs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TREZOR_BSP_H
#define TREZOR_BSP_H
// Trezor 'board support package' (BSP) header file that includes
// all necessary headers for the specific board including STM32 HAL and
// pin definitions.
//
// This file should by only included by driver implementations and
// should not be included by application code.
#include TREZOR_BOARD
#ifndef TREZOR_EMULATOR
#include STM32_HAL_H
#endif
#endif // TREZOR_BOARD_H

View File

@ -17,17 +17,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <trezor_bsp.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include STM32_HAL_H
#include "board_capabilities.h"
#include "bootutils.h"
#include "button.h"
#include "common.h"
#include "display.h"
#include "display_draw.h"
#include "display_utils.h"
@ -35,15 +35,14 @@
#include "flash_otp.h"
#include "fwutils.h"
#include "image.h"
#include "model.h"
#include "mpu.h"
#include "prodtest_common.h"
#include "random_delays.h"
#include "rsod.h"
#include "sbu.h"
#include "sdcard.h"
#include "secbool.h"
#include "system.h"
#include "systick.h"
#include "systimer.h"
#include "touch.h"
#include "usb.h"

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <trezor_rtl.h>
#include "aes/aes.h"
#include "buffer.h"
@ -33,8 +33,6 @@
#include "secret.h"
#include "sha2.h"
#include TREZOR_BOARD
#ifdef USE_STORAGE_HWKEY
#include "secure_aes.h"
#endif

View File

@ -20,9 +20,7 @@
#ifndef PRODTEST_OPTIGA_PRODTEST_H
#define PRODTEST_OPTIGA_PRODTEST_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
#define OID_CERT_INF (OPTIGA_OID_CERT + 0)
#define OID_CERT_DEV (OPTIGA_OID_CERT + 1)

View File

@ -20,8 +20,7 @@
#ifndef PRODTEST_COMMON_H
#define PRODTEST_COMMON_H
#include <stdint.h>
#include <stdlib.h>
#include <trezor_types.h>
enum { VCP_IFACE = 0x00 };

View File

@ -17,24 +17,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <trezor_bsp.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include STM32_HAL_H
#include <sys/types.h>
#include <trezor_rtl.h>
#include "bootutils.h"
#include "common.h"
#include "display.h"
#include "display_draw.h"
#include "flash.h"
#include "image.h"
#include "model.h"
#include "rng.h"
#include "rsod.h"
#include "sbu.h"
#include "sdcard.h"
#include "secbool.h"
#include "system.h"
#include "systimer.h"
#include "terminal.h"

View File

@ -1,6 +1,2 @@
#include <stdbool.h>
#include "common.h"
#include "rust_ui_bootloader.h"
#include "rust_ui_common.h"

View File

@ -1,4 +1,4 @@
#include "common.h"
#include <trezor_types.h>
uint32_t screen_install_confirm(const char* vendor_str, uint8_t vendor_str_len,
const char* version_str,

View File

@ -1,4 +1,4 @@
#include "common.h"
#include <trezor_types.h>
void display_rsod_rust(const char* title, const char* message,
const char* footer);

View File

@ -1,8 +1,8 @@
#include TREZOR_BOARD
#include <trezor_bsp.h>
#include <trezor_model.h>
#include "buffers.h"
#include "button.h"
#include "common.h"
#include "display.h"
#include "display_draw.h"
#include "dma2d.h"
@ -12,10 +12,10 @@
#include "fonts/fonts.h"
#include "gfx_bitblt.h"
#include "haptic.h"
#include "model.h"
#include "rgb_led.h"
#include "secbool.h"
#include "storage.h"
#include "systick.h"
#include "touch.h"
#include "translations.h"
#include "usb.h"

View File

@ -20,8 +20,7 @@
#ifndef TREZORHAL_APPLET_H
#define TREZORHAL_APPLET_H
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
#ifdef SYSCALL_DISPATCH

View File

@ -2,9 +2,7 @@
#ifndef TREZORHAL_BG_COPY_H
#define TREZORHAL_BG_COPY_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -33,7 +33,7 @@ Simple key-tag-length-value structure at fixed boardloader address.
Last tag must be terminator or all space used.
*/
#include <stdint.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,8 +20,7 @@
#ifndef TREZORHAL_BOOTARGS_H
#define TREZORHAL_BOOTARGS_H
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
// Defines boot command processed in bootloader on next reboot
typedef enum {

View File

@ -20,8 +20,7 @@
#ifndef TREZORHAL_BOOTUTILS_H
#define TREZORHAL_BOOTUTILS_H
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
// Immediately resets the device and initiates the normal boot sequence.
void __attribute__((noreturn)) reboot_device(void);

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_BUTTON_H
#define TREZORHAL_BUTTON_H
#include <stdint.h>
#include <trezor_types.h>
#define BTN_EVT_DOWN (1U << 24)
#define BTN_EVT_UP (1U << 25)

View File

@ -24,10 +24,8 @@
#include <xdisplay.h>
#else
#include <stdint.h>
#include "common.h"
#include TREZOR_BOARD
#include <trezor_bsp.h>
#include <trezor_types.h>
#ifdef DISPLAY_LEGACY_HEADER
#include DISPLAY_LEGACY_HEADER

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_DMA2D_H
#define TREZORHAL_DMA2D_H
#include "common.h"
#include <trezor_types.h>
void dma2d_init(void);

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_ENTROPY_H
#define TREZORHAL_ENTROPY_H
#include <stdint.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,11 +20,9 @@
#ifndef TREZORHAL_FLASH_H
#define TREZORHAL_FLASH_H
#include <stdint.h>
#include <stdlib.h>
#include <trezor_types.h>
#include "flash_ll.h"
#include "secbool.h"
#ifdef USE_FLASH_BURST

View File

@ -1,7 +1,7 @@
#ifndef TREZORHAL_FLASH_OTP_H
#define TREZORHAL_FLASH_OTP_H
#include <common.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,9 +20,7 @@
#ifndef TREZORHAL_FWUTILS_H
#define TREZORHAL_FWUTILS_H
#include <stdint.h>
#include "secbool.h"
#include <trezor_types.h>
// Callback function for firmware hash calculation.
typedef void (*firmware_hash_callback_t)(void* context, uint32_t progress,

View File

@ -20,8 +20,7 @@
#ifndef TREZORHAL_HAPTIC_H
#define TREZORHAL_HAPTIC_H
#include <stdbool.h>
#include <stdint.h>
#include <trezor_types.h>
typedef enum {
// Effect at the start of a button press

View File

@ -1,7 +1,7 @@
#ifndef TREZORHAL_HASH_PROCESSOR_H_
#define TREZORHAL_HASH_PROCESSOR_H_
#include <stdint.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,9 +20,7 @@
#ifndef TREZORHAL_I2C_BUS_H
#define TREZORHAL_I2C_BUS_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -22,13 +22,12 @@
#ifdef KERNEL_MODE
#include <trezor_types.h>
// Monoctr module provides monotonic counter functionality
#define MONOCTR_MAX_VALUE 63
#include <stdint.h>
#include "secbool.h"
typedef enum {
MONOCTR_BOOTLOADER_VERSION = 0,
MONOCTR_FIRMWARE_VERSION = 1,

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_MPU_H
#define TREZORHAL_MPU_H
#include <stddef.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,9 +20,8 @@
#ifndef TREZORHAL_OPTIGA_H
#define TREZORHAL_OPTIGA_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
#include "optiga_common.h"
#include "storage.h"

View File

@ -17,11 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "optiga.h"
#include <string.h>
#include <trezor_rtl.h>
#include "hash_to_curve.h"
#include "hmac.h"
#include "memzero.h"
#include "optiga.h"
#include "optiga_commands.h"
#include "optiga_transport.h"
#include "rand.h"

View File

@ -23,13 +23,14 @@
* https://github.com/Infineon/optiga-trust-m/blob/develop/documents/Infineon_I2C_Protocol_v2.03.pdf
*/
#include "optiga_commands.h"
#include <string.h>
#include <trezor_rtl.h>
#include "der.h"
#include "ecdsa.h"
#include "hmac.h"
#include "memzero.h"
#include "nist256p1.h"
#include "optiga_commands.h"
#include "optiga_transport.h"
#include "sha2.h"

View File

@ -22,19 +22,19 @@
* https://github.com/Infineon/optiga-trust-m/blob/develop/documents/Infineon_I2C_Protocol_v2.03.pdf
*/
#include "optiga_transport.h"
#include <string.h>
#include <trezor_bsp.h>
#include <trezor_rtl.h>
#include "aes/aesccm.h"
#include "common.h"
#include "i2c_bus.h"
#include "memzero.h"
#include "optiga_hal.h"
#include "optiga_transport.h"
#include "systick.h"
#include "tls_prf.h"
#ifdef KERNEL_MODE
#include TREZOR_BOARD
// Maximum possible packet size that can be transmitted.
#define OPTIGA_MAX_PACKET_SIZE (OPTIGA_DATA_REG_LEN - 5)

View File

@ -20,9 +20,8 @@
#ifndef TREZORHAL_OPTIGA_COMMANDS_H
#define TREZORHAL_OPTIGA_COMMANDS_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
#include "optiga_common.h"
// Data object identifiers.

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_OPTIGA_COMMON_H
#define TREZORHAL_OPTIGA_COMMON_H
#include "secbool.h"
#include <trezor_types.h>
typedef enum _optiga_result {
OPTIGA_SUCCESS = 0, // Operation completed successfully.

View File

@ -2,8 +2,7 @@
#ifndef CORE_OPTIGA_HAL_H
#define CORE_OPTIGA_HAL_H
#include <stdint.h>
#include "secbool.h"
#include <trezor_types.h>
void optiga_hal_init(void);

View File

@ -20,9 +20,8 @@
#ifndef TREZORHAL_OPTIGA_TRANSPORT_H
#define TREZORHAL_OPTIGA_TRANSPORT_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <trezor_types.h>
#include "optiga_common.h"
// Maximum data register length supported by OPTIGA.

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_OPTION_BYTES_H
#define TREZORHAL_OPTION_BYTES_H
#include "secbool.h"
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_RANDOM_DELAYS_H
#define TREZORHAL_RANDOM_DELAYS_H
#include <stdint.h>
#include <trezor_types.h>
/*
Random delay interrupts (RDI) is a contermeasure against side channel attacks.

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_RESET_FLAGS_H
#define TREZORHAL_RESET_FLAGS_H
#include "secbool.h"
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_RGB_LED_H
#define TREZORHAL_RGB_LED_H
#include <stdint.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,7 +20,7 @@
#ifndef TREZORHAL_RNG_H
#define TREZORHAL_RNG_H
#include <stdint.h>
#include <trezor_types.h>
#ifdef KERNEL_MODE

View File

@ -20,7 +20,7 @@
#ifndef __TREZORHAL_SBU_H__
#define __TREZORHAL_SBU_H__
#include "secbool.h"
#include <trezor_types.h>
#if KERNEL_MODE

View File

@ -46,8 +46,7 @@
#ifndef __TREZORHAL_SDCARD_H__
#define __TREZORHAL_SDCARD_H__
#include <stdbool.h>
#include "secbool.h"
#include <trezor_types.h>
// this is a fixed size and should not be changed
#define SDCARD_BLOCK_SIZE (512)

Some files were not shown because too many files have changed in this diff Show More