# Bug: `stse_perso_info_t` AC status 2-bit mask truncates valid AC values
Maintainer thường phản hồi trong vòng 1 ngày
@Grom- đang làm issue này rồi.
Từ ngày 26/3/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
The cmd_AC_status and ext_cmd_AC_status fields are packed structures where each command occupies a 2-bit slot. This 2-bit assumption is inconsistent with the stse_cmd_access_conditions_t enum which defines 6 values, requiring at least 3 bits.
This affects initialization, write, and read operations consistently across both cmd and ext_cmd variants.
The 2-bit mask 0x03 is used throughout:
Initialization — all slots default to 0b01 (STSE_CMD_AC_FREE), but any value ≥ 4 could never be represented anyway:
pSTSE->perso_info.cmd_AC_status = 0x5555555555555555;
pSTSE->perso_info.ext_cmd_AC_status = 0x5555555555555555;
Write — STSE_CMD_AC_ADMIN_OR_PWD (4) and STSE_CMD_AC_ADMIN_OR_HOST (5) are silently truncated:
pPerso->cmd_AC_status &= ~((PLAT_UI64)0x03 << offset);
pPerso->cmd_AC_status |= (PLAT_UI64)protection << offset;
Read — the getter masks the result to 2 bits, so values 4 and 5 can never be read back:
return (pPerso->cmd_AC_status >> offset) & 0x03;
The same three issues apply identically to ext_cmd_AC_status.
typedef enum stse_cmd_access_conditions_t {
STSE_CMD_AC_NEVER = 0,
STSE_CMD_AC_FREE = 1,
STSE_CMD_AC_ADMIN = 2,
STSE_CMD_AC_HOST = 3,
STSE_CMD_AC_ADMIN_OR_PWD = 4, // ← truncated to NEVER (0)
STSE_CMD_AC_ADMIN_OR_HOST = 5 // ← truncated to FREE (1)
} stse_cmd_access_conditions_t;
Setting or reading STSE_CMD_AC_ADMIN_OR_PWD or STSE_CMD_AC_ADMIN_OR_HOST produces silent security misconfigurations with no error.
Proposed fix
Widen the mask and slot size from 2 bits to 3 bits (0x07) across initialization, setter, and getter — for both cmd and ext_cmdvariants. However, the offset, currently computed as cmd_code * 2, would need to become cmd_code * 3.
This makes packing into a PLAT_UI64 no longer viable: at 3 bits per slot, a PLAT_UI64 is limited to 21 commands, which is insufficient for the current 29 commands.
The only correct solution is to switch to a PLAT_UI8 array:
PLAT_UI8 cmd_AC_status[STSE_CMD_COUNT];
PLAT_UI8 ext_cmd_AC_status[STSE_EXT_CMD_COUNT];
This comes at a memory cost of 29 * 2 - 8 * 2 = 42 additional bytes compared to the current two PLAT_UI64 fields.
- Ngôn ngữ chính
- C
- Star
- 15
- Fork
- 12
- Merge trung bình
- 1 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của STMicroelectronics/STSELib
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
STMicroelectronics/STSELib#115 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Max `pBuffer` size for `stse_data_storage_update_data_zone()` unclear due to hidden overhead bytesĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
STMicroelectronics/STSELib#84 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`stse_platform_Crc16_Accumulate()` is not safeCó thể làm lại được @nils-cercariolo-st đã nhận 190 ngày trước và không có pull request nào đang mở. Đang mở
STMicroelectronics/STSELib#65 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
STSAFE A120: Reprovisioning is successful, but returns error STSE_INVALID_C_MACCó thể làm lại được @Grom- đã nhận 334 ngày trước và không có pull request nào đang mở. Đang mởbug
STMicroelectronics/STSELib#47 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của STMicroelectronics/STSELib
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
area:gates bug good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
InauguralSystems/EigenScript#1782 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fluent/fluent-bit#12579 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
obsproject/obs-studio#14036 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày