Lines Matching +full:1 +full:- +full:9 +full:a +full:- +full:e
1 // SPDX-License-Identifier: GPL-2.0-only
20 * hex_to_bin - convert a hex digit to its real value
23 * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad
26 * This function is used to load cryptographic keys, so it is coded in such a
30 * (ch - '9' - 1) is negative if ch <= '9'
31 * ('0' - 1 - ch) is negative if ch >= '0'
33 * '0' ... '9'
34 * we are only interested in the sign, so we do a shift ">> 8"; note that right
35 * shift of a negative value is implementation-defined, so we cast the
36 * value to (unsigned) before the shift --- we have 0xffffff if ch is in
37 * the range '0' ... '9', 0 otherwise
38 * we "and" this value with (ch - '0' + 1) --- we have a value 1 ... 10 if ch is
39 * in the range '0' ... '9', 0 otherwise
40 * we add this value to -1 --- we have a value 0 ... 9 if ch is in the range '0'
41 * ... '9', -1 otherwise
49 return -1 + in hex_to_bin()
50 ((ch - '0' + 1) & (unsigned)((ch - '9' - 1) & ('0' - 1 - ch)) >> 8) + in hex_to_bin()
51 ((cu - 'A' + 11) & (unsigned)((cu - 'F' - 1) & ('A' - 1 - cu)) >> 8); in hex_to_bin()
56 * hex2bin - convert an ascii hexadecimal string to its binary representation
61 * Return 0 on success, -EINVAL in case of bad input.
65 while (count--) { in hex2bin()
70 return -EINVAL; in hex2bin()
73 return -EINVAL; in hex2bin()
82 * bin2hex - convert binary data to an ascii hexadecimal string
91 while (count--) in bin2hex()
98 * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory
102 * @groupsize: number of bytes to print at a time (1, 2, 4, 8; default = 1)
107 * hex_dump_to_buffer() works on one "line" of output at a time, i.e.,
110 * Given a buffer of u8 data, hex_dump_to_buffer() converts the input data
111 * to a hex + ASCII dump at the supplied memory location.
112 * The converted output is always NUL-terminated.
114 * E.g.:
115 * hex_dump_to_buffer(frame->data, frame->len, 16, 1,
119 * 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO
140 if (len > rowsize) /* limit to one line at a time */ in hex_dump_to_buffer()
143 groupsize = 1; in hex_dump_to_buffer()
145 groupsize = 1; in hex_dump_to_buffer()
148 ascii_column = rowsize * 2 + rowsize / groupsize + 1; in hex_dump_to_buffer()
160 ret = snprintf(linebuf + lx, linebuflen - lx, in hex_dump_to_buffer()
163 if (ret >= linebuflen - lx) in hex_dump_to_buffer()
171 ret = snprintf(linebuf + lx, linebuflen - lx, in hex_dump_to_buffer()
174 if (ret >= linebuflen - lx) in hex_dump_to_buffer()
182 ret = snprintf(linebuf + lx, linebuflen - lx, in hex_dump_to_buffer()
185 if (ret >= linebuflen - lx) in hex_dump_to_buffer()
203 lx--; in hex_dump_to_buffer()
225 return ascii ? ascii_column + len : (groupsize * 2 + 1) * ngroups - 1; in hex_dump_to_buffer()
231 * print_hex_dump - print a text hex dump to syslog for a binary blob of data
232 * @level: kernel log level (e.g. KERN_DEBUG)
238 * @groupsize: number of bytes to print at a time (1, 2, 4, 8; default = 1)
243 * Given a buffer of u8 data, print_hex_dump() prints a hex + ASCII dump
247 * print_hex_dump() works on one "line" of output at a time, i.e.,
252 * E.g.:
254 * 16, 1, frame->data, frame->len, true);
256 * Example output using %DUMP_PREFIX_OFFSET and 1-byte mode:
257 * 0009ab42: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO
258 * Example output using %DUMP_PREFIX_ADDRESS and 4-byte mode:
267 unsigned char linebuf[32 * 3 + 2 + 32 + 1]; in print_hex_dump()
274 remaining -= rowsize; in print_hex_dump()