From a981c0a733887171f5523f97c612bba5d1d79da7 Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Sun, 31 Aug 2014 01:47:03 +0300 Subject: [PATCH] sha1: workaround for name collision with libcrypto src/sha1.c is used only for internal purposes. So, just add prefix xmpp_ to the SHA1 symbols. --- src/sha1.c | 4 ++-- src/sha1.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sha1.c b/src/sha1.c index ec4cb6c..9c0ea9c 100644 --- a/src/sha1.c +++ b/src/sha1.c @@ -102,7 +102,7 @@ A million repetitions of "a" #include "sha1.h" -void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]); +static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]); #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) @@ -140,7 +140,7 @@ void SHAPrintContext(SHA1_CTX *context, char *msg){ #endif /* VERBOSE */ /* Hash a single 512-bit block. This is the core of the algorithm. */ -void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]) +static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]) { uint32_t a, b, c, d, e; typedef union { diff --git a/src/sha1.h b/src/sha1.h index b637f66..349e851 100644 --- a/src/sha1.h +++ b/src/sha1.h @@ -20,6 +20,11 @@ typedef struct { #define SHA1_DIGEST_SIZE 20 +/* prevent name collisions with libcrypto */ +#define SHA1_Init xmpp_SHA1_Init +#define SHA1_Update xmpp_SHA1_Update +#define SHA1_Final xmpp_SHA1_Final + void SHA1_Init(SHA1_CTX* context); void SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len); void SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]);