diff options
author | Andreas Schneider <asn@samba.org> | 2018-10-11 18:29:11 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-04-30 23:18:27 +0000 |
commit | 6fb7837385ea8bcf9c96f674ac8f30d7a0ccff98 (patch) | |
tree | 24f640ac070e1818cba0bc521115456ec9fc0778 /source4/utils | |
parent | 9bbb9f7bdf05e92498e01fb1ffacc770432d6709 (diff) | |
download | samba-6fb7837385ea8bcf9c96f674ac8f30d7a0ccff98.tar.gz |
s4:utils: Use gnutls SHA256 in oLschema2ldif
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/utils')
-rw-r--r-- | source4/utils/oLschema2ldif/lib.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/source4/utils/oLschema2ldif/lib.c b/source4/utils/oLschema2ldif/lib.c index feda4674eb0..ad73bab5325 100644 --- a/source4/utils/oLschema2ldif/lib.c +++ b/source4/utils/oLschema2ldif/lib.c @@ -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)); |