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.
This commit is contained in:
Dmitry Podgorny
2014-08-31 01:47:03 +03:00
parent b08625ef4a
commit a981c0a733
2 changed files with 7 additions and 2 deletions

View File

@@ -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 {

View File

@@ -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]);