mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
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>
This commit is contained in:
parent
5adf85e6af
commit
49ab2df28a
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -61,9 +61,9 @@ static NTSTATUS hash_sd_sha256(struct security_descriptor *psd,
|
||||
return status;
|
||||
}
|
||||
|
||||
SHA256_Init(&tctx);
|
||||
SHA256_Update(&tctx, blob.data, blob.length);
|
||||
SHA256_Final(hash, &tctx);
|
||||
samba_SHA256_Init(&tctx);
|
||||
samba_SHA256_Update(&tctx, blob.data, blob.length);
|
||||
samba_SHA256_Final(hash, &tctx);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
@ -392,9 +392,9 @@ static struct ldb_message *process_entry(TALLOC_CTX *mem_ctx, const char *entry)
|
||||
MSG_ADD_STRING("governsID", s);
|
||||
}
|
||||
|
||||
SHA256_Init(&sha256_context);
|
||||
SHA256_Update(&sha256_context, (uint8_t*)s, strlen(s));
|
||||
SHA256_Final(digest, &sha256_context);
|
||||
samba_SHA256_Init(&sha256_context);
|
||||
samba_SHA256_Update(&sha256_context, (uint8_t*)s, strlen(s));
|
||||
samba_SHA256_Final(digest, &sha256_context);
|
||||
|
||||
memcpy(&guid, digest, sizeof(struct GUID));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user