Skip to content

Commit 984a92d

Browse files
authored
Merge pull request #3043 from aaronjamt/patch-1
[hf seos] Carry when incrementing
2 parents 7fa548f + 8a92901 commit 984a92d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

client/src/cmdhfseos.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ 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+
uint8_t* offset = &input[input_len - sizeof(uint32_t)];
168+
uint32_t value = MemBeToUint4byte(offset);
169+
value++;
170+
Uint4byteToMemBe(offset, value);
167171
}
168172

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

0 commit comments

Comments
 (0)