Commit 7cc56db5 authored by Marek Vavrusa's avatar Marek Vavrusa

Compilation fixes for TSIG.

refs #1362
parent 3da652bd
......@@ -1997,7 +1997,7 @@ static int ns_xfr_send_and_clear(knot_ns_xfr_t *xfr, int add_tsig)
assert(0);
res = knot_tsig_sign(xfr->wire, &real_size,
xfr->wire_size, xfr->prev_digest,
xfr->prev_digest_size, xfr->tsig,
xfr->prev_digest_size,
xfr->tsig_key);
} else {
/* Add key, digest and digest length. */
......@@ -2006,7 +2006,6 @@ static int ns_xfr_send_and_clear(knot_ns_xfr_t *xfr, int add_tsig)
xfr->wire_size,
xfr->prev_digest,
xfr->prev_digest_size,
xfr->tsig,
xfr->tsig_key);
}
......@@ -2027,9 +2026,10 @@ static int ns_xfr_send_and_clear(knot_ns_xfr_t *xfr, int add_tsig)
if (add_tsig && xfr->tsig_key &&
(xfr->type == XFR_TYPE_AOUT || xfr->type == XFR_TYPE_IOUT)) {
res = knot_tsig_sign(xfr->wire, &real_size,
xfr->wire_size, xfr->prev_digest,
xfr->prev_digest_size, xfr->tsig,
xfr->tsig_key);
xfr->wire_size,
(const uint8_t *)tsig_rdata_mac(xfr->tsig),
tsig_alg_digest_length(tsig_rdata_alg(xfr->tsig)),
xfr->tsig_key);
}
// Send the response
......
......@@ -205,11 +205,12 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len,
size_t request_mac_len,
const knot_key_t *key)
{
if (!msg || !msg_len || !tsig_rr || !key) {
if (!msg || !msg_len || !key) {
return KNOT_EBADARG;
}
/* Create tmp TSIG. */
int ret = KNOT_EOK;
knot_rrset_t *tmp_tsig =
knot_rrset_new(key->name, KNOT_RRTYPE_TSIG, KNOT_CLASS_ANY, 0);
if (!tmp_tsig) {
......@@ -248,7 +249,7 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len,
size_t digest_len = 0;
/* Compute digest. */
ret = knot_tsig_compute_digest(tsig_rr, wire, wire_len,
ret = knot_tsig_compute_digest(tmp_tsig, wire, wire_len,
&digest, &digest_len, key);
if (ret != KNOT_EOK) {
return ret;
......@@ -277,9 +278,9 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len,
int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
const uint8_t *prev_digest, size_t prev_digest_len,
const knot_key_t *key)
const knot_key_t *key)
{
if (!msg || !msg_len || !tsig_rr || !key || !key) {
if (!msg || !msg_len || !key || !key) {
return KNOT_EBADARG;
}
......@@ -311,6 +312,7 @@ int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
uint8_t *digest = NULL;
size_t digest_len = 0;
int ret = 0;
ret = knot_tsig_compute_digest(tmp_tsig, wire, wire_len,
&digest, &digest_len, key);
if (ret != KNOT_EOK) {
......
......@@ -82,7 +82,7 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
*/
int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
const uint8_t *prev_digest, size_t prev_digest_len,
const knot_key_t *key);
const knot_key_t *key);
/*!
* \brief Checks incoming request.
......
Markdown is supported
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