Repository navigation
Commit 02341a8
io_legacy: send the status word in the buffer that is transmitted
`apdu_send` picks the response buffer from `tx`: non-zero means the caller
filled `apdu_buffer`, zero means it filled `io_buffer` and set `tx_length`.
`Comm::reply` ignored that split and always wrote the status word into
`io_buffer`, so a caller using the `apdu_buffer`/`tx` pair transmitted its
data with no status word at all - the two bytes went into a buffer that was
never sent.
The host does not see a short response, it sees a wrong one: it reads the
last two data bytes as the status word. A reply of `de ad` with `9000`
appended arrives as data `()` and status `0xdead`.
`io.rs` appended to `apdu_buffer` at `tx` until 063cf2b ("IO revamp
adaptation") moved the write to `io_buffer` without moving the switch in
`apdu_send` with it. Reported in #431.
The write now follows the same test `apdu_send` makes, extracted into
`append_status_word` so it can be exercised without a transport. Both paths
are covered: a response built in `apdu_buffer` keeps `io_buffer` untouched,
and the `io_buffer` path is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AqD13QkB8DhzkDSdKbJScv1 parent 1fe624b commit 02341a8
2 files changed
Lines changed: 68 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
8 | 17 | | |
9 | 18 | | |
10 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
826 | 846 | | |
827 | 847 | | |
828 | 848 | | |
| |||
832 | 852 | | |
833 | 853 | | |
834 | 854 | | |
835 | | - | |
836 | 855 | | |
837 | | - | |
838 | | - | |
839 | | - | |
| 856 | + | |
840 | 857 | | |
841 | 858 | | |
842 | 859 | | |
| |||
1054 | 1071 | | |
1055 | 1072 | | |
1056 | 1073 | | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
1057 | 1112 | | |
0 commit comments