mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s4:utils: Use gnutls SHA256 in oLschema2ldif
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
9bbb9f7bdf
commit
6fb7837385
@ -34,9 +34,11 @@
|
||||
#include "includes.h"
|
||||
#include "./lib.h"
|
||||
#include "ldb.h"
|
||||
#include "../lib/crypto/sha256.h"
|
||||
#include "../librpc/gen_ndr/ndr_misc.h"
|
||||
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/crypto.h>
|
||||
|
||||
#define SCHEMA_UNKNOWN 0
|
||||
#define SCHEMA_NAME 1
|
||||
#define SCHEMA_SUP 2
|
||||
@ -351,8 +353,8 @@ static struct ldb_message *process_entry(TALLOC_CTX *mem_ctx, struct conv_option
|
||||
char *c, *s;
|
||||
int n;
|
||||
|
||||
SHA256_CTX sha256_context;
|
||||
uint8_t digest[SHA256_DIGEST_LENGTH];
|
||||
uint8_t digest[gnutls_hash_get_len(GNUTLS_MAC_SHA256)];
|
||||
int rc;
|
||||
|
||||
struct GUID guid;
|
||||
|
||||
@ -410,9 +412,13 @@ static struct ldb_message *process_entry(TALLOC_CTX *mem_ctx, struct conv_option
|
||||
MSG_ADD_STRING("governsID", s);
|
||||
}
|
||||
|
||||
samba_SHA256_Init(&sha256_context);
|
||||
samba_SHA256_Update(&sha256_context, (uint8_t*)s, strlen(s));
|
||||
samba_SHA256_Final(digest, &sha256_context);
|
||||
rc = gnutls_hash_fast(GNUTLS_DIG_SHA256,
|
||||
s,
|
||||
strlen(s),
|
||||
digest);
|
||||
if (rc < 0) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
memcpy(&guid, digest, sizeof(struct GUID));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user