mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 07:00:05 +08:00
Merge branch 'bugfix/fix_unaligned_access_to_flash' into 'master'
Fix unaligned access to the flash if some LUT is type of "uint8_t" or "uint16_t" See merge request sdk/ESP8266_RTOS_SDK!929
This commit is contained in:
@ -52,6 +52,8 @@
|
||||
|
||||
#ifdef USING_IBUS_FASTER_GET
|
||||
|
||||
#include "esp_attr.h"
|
||||
|
||||
#ifndef DISABLE_IBUS_INLINE_FUNC
|
||||
#define IBUS_INLINE inline
|
||||
#else
|
||||
@ -83,9 +85,13 @@ typedef union _ibus_data {
|
||||
__ESP_IBUS_GET_DATA(uint8_t)
|
||||
__ESP_IBUS_GET_DATA(uint16_t)
|
||||
|
||||
#define ESP_IBUS_ATTR WORD_ALIGNED_ATTR
|
||||
|
||||
#define ESP_IBUS_GET_U8_DATA(_index, _pbuf) __esp_ibus_get_uint8_t_data(_index, _pbuf)
|
||||
#define ESP_IBUS_GET_U16_DATA(_index, _pbuf) __esp_ibus_get_uint16_t_data(_index, _pbuf)
|
||||
#else
|
||||
#define ESP_IBUS_ATTR
|
||||
|
||||
#define ESP_IBUS_GET_U8_DATA(_index, _pbuf) ((const uint8_t *)_pbuf)[_index]
|
||||
#define ESP_IBUS_GET_U16_DATA(_index, _pbuf) ((const uint16_t *)_pbuf)[_index]
|
||||
#endif
|
||||
|
@ -92,7 +92,7 @@
|
||||
/*
|
||||
* Forward S-box
|
||||
*/
|
||||
static const uint8_t s_aes_fsb[256] __attribute__((aligned(4))) =
|
||||
static const uint8_t s_aes_fsb[256] ESP_IBUS_ATTR =
|
||||
{
|
||||
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
|
||||
0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
|
||||
@ -219,7 +219,7 @@ static const uint32_t s_aes_ft3[256] = { FT };
|
||||
/*
|
||||
* Reverse S-box
|
||||
*/
|
||||
static const uint8_t s_aes_rsb[256] __attribute__((aligned(4))) =
|
||||
static const uint8_t s_aes_rsb[256] ESP_IBUS_ATTR =
|
||||
{
|
||||
0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38,
|
||||
0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
|
||||
|
@ -53,7 +53,7 @@ static const uint32_t crc32_le_table[256] = {
|
||||
0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL
|
||||
};
|
||||
|
||||
static const uint16_t crc16_le_table[256] = {
|
||||
static const uint16_t crc16_le_table[256] ESP_IBUS_ATTR = {
|
||||
0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
|
||||
0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
|
||||
0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
|
||||
@ -88,7 +88,7 @@ static const uint16_t crc16_le_table[256] = {
|
||||
0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
|
||||
};
|
||||
|
||||
static const uint8_t crc8_le_table[] = {
|
||||
static const uint8_t crc8_le_table[] ESP_IBUS_ATTR = {
|
||||
0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41,
|
||||
0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc,
|
||||
0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62,
|
||||
|
Reference in New Issue
Block a user