Skip to content

Commit b602436

Browse files
committed
[hf seos] Carry when incrementing
1 parent 7fa548f commit b602436

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

client/src/cmdhfseos.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ static int decrypt_cryptogram(uint8_t *key, uint8_t *input, uint8_t *out, int in
163163
}
164164

165165
static void increment_command_wrapper(uint8_t *input, int input_len) {
166-
input[input_len - 1]++; // Increment the last element of the header by 1
166+
// Increment the end of the header by 1
167+
uint32_t value = MemBeToUint4byte(&input[input_len - sizeof(uint32_t)]);
168+
value++;
169+
Uint4byteToMemBe(&input[input_len - sizeof(uint32_t)], value);
167170
}
168171

169172
static void padToBlockSize(const uint8_t *input, int *inputSize, int blockSize, uint8_t *output) {

0 commit comments

Comments
 (0)