diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2016-09-21 02:17:24 +0300 |
---|---|---|
committer | Tyler Hicks <tyhicks@canonical.com> | 2017-11-05 01:16:41 +0300 |
commit | abbae6d560c1d562c5c0d10785469734784ef961 (patch) | |
tree | abf569213a03de67189195351d2edbf89f90c0e4 /fs/ecryptfs/crypto.c | |
parent | 0996b67df6c1354f2df09c33ac652c37e2e2471f (diff) | |
download | linux-abbae6d560c1d562c5c0d10785469734784ef961.tar.xz |
ecryptfs: remove private bin2hex implementation
Calling sprintf in a loop is not very efficient, and in any case, we
already have an implementation of bin-to-hex conversion in lib/ which
we might as well use.
Note that ecryptfs_to_hex used to nul-terminate the destination (and
the kernel doc was wrong about the required output size), while
bin2hex doesn't. [All but one user of ecryptfs_to_hex explicitly
nul-terminates the result anyway.]
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
[tyhicks: Include <linux/kernel.h> in ecryptfs_kernel.h]
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r-- | fs/ecryptfs/crypto.c | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index e5e29f8c920b..7acd57da4f14 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -42,21 +42,6 @@ #define ENCRYPT 1 /** - * ecryptfs_to_hex - * @dst: Buffer to take hex character representation of contents of - * src; must be at least of size (src_size * 2) - * @src: Buffer to be converted to a hex string representation - * @src_size: number of bytes to convert - */ -void ecryptfs_to_hex(char *dst, char *src, size_t src_size) -{ - int x; - - for (x = 0; x < src_size; x++) - sprintf(&dst[x * 2], "%.2x", (unsigned char)src[x]); -} - -/** * ecryptfs_from_hex * @dst: Buffer to take the bytes from src hex; must be at least of * size (src_size / 2) |