| 408 | /* ── The answer ──────────────────────────────────────────────────── */ |
| 409 | |
| 410 | static bool te_hex_bytes(const char *hex, unsigned char *out, size_t count) { |
| 411 | if (!hex || strlen(hex) != count * 2) { |
| 412 | return false; |
| 413 | } |
| 414 | for (size_t i = 0; i < count; i++) { |
| 415 | unsigned v = 0; |
| 416 | for (int k = 0; k < 2; k++) { |
| 417 | char ch = hex[i * 2 + (size_t)k]; |
| 418 | unsigned d = ch >= '0' && ch <= '9' ? (unsigned)(ch - '0') |
| 419 | : ch >= 'a' && ch <= 'f' ? (unsigned)(ch - 'a' + 10) |
| 420 | : ch >= 'A' && ch <= 'F' ? (unsigned)(ch - 'A' + 10) |
| 421 | : 16U; |
| 422 | if (d > 15) { |
| 423 | return false; |
| 424 | } |
| 425 | v = v * 16 + d; |
| 426 | } |
| 427 | out[i] = (unsigned char)v; |
| 428 | } |
| 429 | return true; |
| 430 | } |
| 431 | |
| 432 | static cbm_test_result_oid_t te_oid(const te_ctx_t *c, const char *hex) { |
| 433 | cbm_test_result_oid_t oid = {0}; |
no outgoing calls
no test coverage detected