Skip to content

Instantly share code, notes, and snippets.

View Gobol's full-sized avatar

Gobol Gobol

View GitHub Profile
@Gobol
Gobol / gist:4127cf9e405a44488155d52951031223
Created September 26, 2019 18:53
Func to search BER-TLV (paycard) records for given tag, returning data ptr & length
bool searchTLV(uint8_t* inbuf, uint16_t tag_to_find, uint8_t** foundbuf, uint8_t* foundlen)
{
// Tag, Length, Value buffer parser/lookup
// TAG & 0x20 = 0 - primitive (pure data in V)
// TAG & 0x20 = 1 - constructer (another TLVs in V)
// template code is first byte in buf
bool constructed;
bool multibytetag;
uint16_t tag = *inbuf;