summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-04-06 14:36:21 +1000
committerAndrew Tridgell <tridge@samba.org>2011-04-06 08:12:19 +0200
commit49ab2df28a9399fef8d37677404304ac88115b45 (patch)
tree29ba5f83e3088272f7c9a8be910adcbacb7246c7 /lib
parent5adf85e6afa949f8e636327bb3446aa4f41948a7 (diff)
downloadsamba-49ab2df28a9399fef8d37677404304ac88115b45.tar.gz
samba-49ab2df28a9399fef8d37677404304ac88115b45.tar.bz2
samba-49ab2df28a9399fef8d37677404304ac88115b45.zip
lib/crypto: rename the SHA256_ functions to samba_SHA256_
this prevents a symbol duplication with the openssl library, which may be linked in via a secondary library dependency Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto/hmacsha256.c22
-rw-r--r--lib/crypto/sha256.c8
-rw-r--r--lib/crypto/sha256.h6
3 files changed, 18 insertions, 18 deletions
diff --git a/lib/crypto/hmacsha256.c b/lib/crypto/hmacsha256.c
index 1a31441297..36e321a094 100644
--- a/lib/crypto/hmacsha256.c
+++ b/lib/crypto/hmacsha256.c
@@ -42,9 +42,9 @@ _PUBLIC_ void hmac_sha256_init(const uint8_t *key, size_t key_len, struct HMACSH
{
SHA256_CTX tctx;
- SHA256_Init(&tctx);
- SHA256_Update(&tctx, key, key_len);
- SHA256_Final(tk, &tctx);
+ samba_SHA256_Init(&tctx);
+ samba_SHA256_Update(&tctx, key, key_len);
+ samba_SHA256_Final(tk, &tctx);
key = tk;
key_len = SHA256_DIGEST_LENGTH;
@@ -63,8 +63,8 @@ _PUBLIC_ void hmac_sha256_init(const uint8_t *key, size_t key_len, struct HMACSH
ctx->k_opad[i] ^= 0x5c;
}
- SHA256_Init(&ctx->ctx);
- SHA256_Update(&ctx->ctx, ctx->k_ipad, 64);
+ samba_SHA256_Init(&ctx->ctx);
+ samba_SHA256_Update(&ctx->ctx, ctx->k_ipad, 64);
}
/***********************************************************************
@@ -72,7 +72,7 @@ _PUBLIC_ void hmac_sha256_init(const uint8_t *key, size_t key_len, struct HMACSH
***********************************************************************/
_PUBLIC_ void hmac_sha256_update(const uint8_t *data, size_t data_len, struct HMACSHA256Context *ctx)
{
- SHA256_Update(&ctx->ctx, data, data_len); /* then text of datagram */
+ samba_SHA256_Update(&ctx->ctx, data, data_len); /* then text of datagram */
}
/***********************************************************************
@@ -82,10 +82,10 @@ _PUBLIC_ void hmac_sha256_final(uint8_t digest[SHA256_DIGEST_LENGTH], struct HMA
{
SHA256_CTX ctx_o;
- SHA256_Final(digest, &ctx->ctx);
+ samba_SHA256_Final(digest, &ctx->ctx);
- SHA256_Init(&ctx_o);
- SHA256_Update(&ctx_o, ctx->k_opad, 64);
- SHA256_Update(&ctx_o, digest, SHA256_DIGEST_LENGTH);
- SHA256_Final(digest, &ctx_o);
+ samba_SHA256_Init(&ctx_o);
+ samba_SHA256_Update(&ctx_o, ctx->k_opad, 64);
+ samba_SHA256_Update(&ctx_o, digest, SHA256_DIGEST_LENGTH);
+ samba_SHA256_Final(digest, &ctx_o);
}
diff --git a/lib/crypto/sha256.c b/lib/crypto/sha256.c
index 42ab2363aa..02e2259f1b 100644
--- a/lib/crypto/sha256.c
+++ b/lib/crypto/sha256.c
@@ -80,7 +80,7 @@ static const uint32_t constant_256[64] = {
};
void
-SHA256_Init (SHA256_CTX *m)
+samba_SHA256_Init (SHA256_CTX *m)
{
m->sz[0] = 0;
m->sz[1] = 0;
@@ -187,7 +187,7 @@ struct x32{
};
void
-SHA256_Update (SHA256_CTX *m, const void *v, size_t len)
+samba_SHA256_Update (SHA256_CTX *m, const void *v, size_t len)
{
const unsigned char *p = (const unsigned char *)v;
size_t old_sz = m->sz[0];
@@ -222,7 +222,7 @@ SHA256_Update (SHA256_CTX *m, const void *v, size_t len)
}
void
-SHA256_Final (void *res, SHA256_CTX *m)
+samba_SHA256_Final (void *res, SHA256_CTX *m)
{
unsigned char zeros[72];
unsigned offset = (m->sz[0] / 8) % 64;
@@ -238,7 +238,7 @@ SHA256_Final (void *res, SHA256_CTX *m)
zeros[dstart+2] = (m->sz[1] >> 8) & 0xff;
zeros[dstart+1] = (m->sz[1] >> 16) & 0xff;
zeros[dstart+0] = (m->sz[1] >> 24) & 0xff;
- SHA256_Update (m, zeros, dstart + 8);
+ samba_SHA256_Update (m, zeros, dstart + 8);
{
int i;
unsigned char *r = (unsigned char*)res;
diff --git a/lib/crypto/sha256.h b/lib/crypto/sha256.h
index 4a5f2cbe94..7ee8fac73c 100644
--- a/lib/crypto/sha256.h
+++ b/lib/crypto/sha256.h
@@ -84,8 +84,8 @@ struct hc_sha256state {
typedef struct hc_sha256state SHA256_CTX;
-void SHA256_Init (SHA256_CTX *);
-void SHA256_Update (SHA256_CTX *, const void *, size_t);
-void SHA256_Final (void *, SHA256_CTX *);
+void samba_SHA256_Init (SHA256_CTX *);
+void samba_SHA256_Update (SHA256_CTX *, const void *, size_t);
+void samba_SHA256_Final (void *, SHA256_CTX *);
#endif /* HEIM_SHA_H */