Skip to content
Snippets Groups Projects
Commit b3225cf7 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

wip

parent 7fb699e1
Branches htest
No related merge requests found
......@@ -148,18 +148,18 @@ int knot_create_nsec3_owner(uint8_t *out, size_t out_size,
.size = knot_dname_size(owner)
};
dnssec_binary_t hash = { 0 };
uint8_t hash_data[64];
dnssec_binary_t hash = {
.data = hash_data,
.size = sizeof(hash_data)
};
int ret = dnssec_nsec3_hash(&data, params, &hash);
if (ret != DNSSEC_EOK) {
return knot_error_from_libdnssec(ret);
}
ret = knot_nsec3_hash_to_dname(out, out_size, hash.data, hash.size, zone_apex);
dnssec_binary_free(&hash);
return ret;
return knot_nsec3_hash_to_dname(out, out_size, hash.data, hash.size, zone_apex);
}
static bool nsec3param_valid(const knot_rdataset_t *rrs,
......
......@@ -43,13 +43,19 @@ static int nsec3_hash(gnutls_digest_algorithm_t algorithm, int iterations,
return DNSSEC_NSEC3_HASHING_ERROR;
}
int result = dnssec_binary_resize(hash, hash_size);
if (result != DNSSEC_EOK) {
return result;
if (!hash->data) {
int result = dnssec_binary_resize(hash, hash_size);
if (result != DNSSEC_EOK) {
return result;
}
} else if (hash->size < hash_size) {
return DNSSEC_EINVAL;
} else {
hash->size = hash_size;
}
_cleanup_hash_ gnutls_hash_hd_t digest = NULL;
result = gnutls_hash_init(&digest, algorithm);
int result = gnutls_hash_init(&digest, algorithm);
if (result < 0) {
return DNSSEC_NSEC3_HASHING_ERROR;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment