|
@@ -33,6 +33,22 @@ int hex_to_bin(char ch)
|
|
|
}
|
|
|
EXPORT_SYMBOL(hex_to_bin);
|
|
|
|
|
|
+/**
|
|
|
+ * hex2bin - convert an ascii hexadecimal string to its binary representation
|
|
|
+ * @dst: binary result
|
|
|
+ * @src: ascii hexadecimal string
|
|
|
+ * @count: result length
|
|
|
+ */
|
|
|
+void hex2bin(u8 *dst, const char *src, size_t count)
|
|
|
+{
|
|
|
+ while (count--) {
|
|
|
+ *dst = hex_to_bin(*src++) << 4;
|
|
|
+ *dst += hex_to_bin(*src++);
|
|
|
+ dst++;
|
|
|
+ }
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(hex2bin);
|
|
|
+
|
|
|
/**
|
|
|
* hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory
|
|
|
* @buf: data blob to dump
|