added tesla info command, with some of the data that is available. Needed to fix the apdu chaining and a sneaky bug in get_sw since the apdu response was larger then 256

This commit is contained in:
iceman1001 2023-01-21 20:04:27 +01:00
commit f9a65505de
9 changed files with 281 additions and 16 deletions

View file

@ -262,10 +262,10 @@ uint32_t rotr(uint32_t a, uint8_t n) {
return (a >> n) | (a << (32 - n));
}
uint16_t get_sw(const uint8_t *d, uint8_t n) {
uint16_t get_sw(const uint8_t *d, uint16_t n) {
if (n < 2)
return 0;
n -= 2;
return d[n] * 0x0100 + d[n + 1];
return (d[n] << 8 | d[n + 1]);
}

View file

@ -85,5 +85,5 @@ void htole24(uint32_t val, uint8_t data[3]);
uint32_t rotl(uint32_t a, uint8_t n);
uint32_t rotr(uint32_t a, uint8_t n);
uint16_t get_sw(const uint8_t *d, uint8_t n);
uint16_t get_sw(const uint8_t *d, uint16_t n);
#endif