2 * Copyright 2016 Google Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful,
9 * but without any warranty; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
17 size_t hexstrtobin(const char *str
, uint8_t *buf
, size_t len
)
19 size_t count
, ptr
= 0;
22 for (byte
= count
= 0; str
&& *str
; str
++) {
30 c
= tolower(c
) - 'a' + 10;