| 634 | } |
| 635 | |
| 636 | int fromhex(uint8_t *out, const uint8_t *in, size_t len) |
| 637 | { |
| 638 | const uint8_t *end = in + len; |
| 639 | while (in != end) { |
| 640 | uint8_t i0 = tolower(*(in++)); |
| 641 | uint8_t i1 = tolower(*(in++)); |
| 642 | if (i0 > 'f' || i1 > 'f') |
| 643 | return 1; |
| 644 | i0 -= isdigit(i0) ? '0' : ('a' - 0xa); |
| 645 | i1 -= isdigit(i1) ? '0' : ('a' - 0xa); |
| 646 | *(out++) = (i0 << 4) | i1; |
| 647 | } |
| 648 | return 0; |
| 649 | } |
| 650 | |
| 651 | const char *cdb2_tp_str[] = {"???", |
| 652 | "CDB2_INTEGER", |