summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak2017-12-12 11:29:02 +0100
committerKarel Zak2017-12-12 11:29:02 +0100
commit3bd55be742aec60a93ebcdebc325b49737cd6642 (patch)
tree4894d789632459349384f271ba6d10c5e6840e82 /lib
parentMerge branch '2017wk48' of https://github.com/kerolasa/lelux-utiliteetit (diff)
downloadkernel-qcow2-util-linux-3bd55be742aec60a93ebcdebc325b49737cd6642.tar.gz
kernel-qcow2-util-linux-3bd55be742aec60a93ebcdebc325b49737cd6642.tar.xz
kernel-qcow2-util-linux-3bd55be742aec60a93ebcdebc325b49737cd6642.zip
lib/sha1: use ul_/UL_prefix for symbols
Unfortunately, the symbols are visible in statically compiled libuuid and the names are too generic. Addresses: https://github.com/karelzak/util-linux/issues/548 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/sha1.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/sha1.c b/lib/sha1.c
index a2ac7f8ef..62c036774 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -51,7 +51,7 @@ A million repetitions of "a"
/* Hash a single 512-bit block. This is the core of the algorithm. */
-void SHA1Transform(
+void ul_SHA1Transform(
uint32_t state[5],
const unsigned char buffer[64]
)
@@ -179,8 +179,8 @@ void SHA1Transform(
/* SHA1Init - Initialize new context */
-void SHA1Init(
- SHA1_CTX * context
+void ul_SHA1Init(
+ UL_SHA1_CTX * context
)
{
/* SHA1 initialization constants */
@@ -195,8 +195,8 @@ void SHA1Init(
/* Run your data through this. */
-void SHA1Update(
- SHA1_CTX * context,
+void ul_SHA1Update(
+ UL_SHA1_CTX * context,
const unsigned char *data,
uint32_t len
)
@@ -213,10 +213,10 @@ void SHA1Update(
if ((j + len) > 63)
{
memcpy(&context->buffer[j], data, (i = 64 - j));
- SHA1Transform(context->state, context->buffer);
+ ul_SHA1Transform(context->state, context->buffer);
for (; i + 63 < len; i += 64)
{
- SHA1Transform(context->state, &data[i]);
+ ul_SHA1Transform(context->state, &data[i]);
}
j = 0;
}
@@ -228,9 +228,9 @@ void SHA1Update(
/* Add padding and return the message digest. */
-void SHA1Final(
+void ul_SHA1Final(
unsigned char digest[20],
- SHA1_CTX * context
+ UL_SHA1_CTX * context
)
{
unsigned i;
@@ -262,13 +262,13 @@ void SHA1Final(
}
#endif
c = 0200;
- SHA1Update(context, &c, 1);
+ ul_SHA1Update(context, &c, 1);
while ((context->count[0] & 504) != 448)
{
c = 0000;
- SHA1Update(context, &c, 1);
+ ul_SHA1Update(context, &c, 1);
}
- SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
+ ul_SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
for (i = 0; i < 20; i++)
{
digest[i] = (unsigned char)
@@ -279,18 +279,18 @@ void SHA1Final(
memset(&finalcount, '\0', sizeof(finalcount));
}
-void SHA1(
+void ul_SHA1(
char *hash_out,
const char *str,
unsigned len)
{
- SHA1_CTX ctx;
+ UL_SHA1_CTX ctx;
unsigned int ii;
- SHA1Init(&ctx);
+ ul_SHA1Init(&ctx);
for (ii=0; ii<len; ii+=1)
- SHA1Update(&ctx, (const unsigned char*)str + ii, 1);
- SHA1Final((unsigned char *)hash_out, &ctx);
+ ul_SHA1Update(&ctx, (const unsigned char*)str + ii, 1);
+ ul_SHA1Final((unsigned char *)hash_out, &ctx);
hash_out[20] = '\0';
}