Skip to content
Snippets Groups Projects
Commit 3e926637 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

[dnssec] review, macros instead of magic constants in keytag computation

parent c2db670d
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@
#include "binary.h"
#include "error.h"
#include "key/dnskey.h"
#include "shared.h"
/*!
......@@ -72,11 +73,11 @@ int dnssec_keytag(const dnssec_binary_t *rdata, uint16_t *keytag)
return DNSSEC_EINVAL;
}
if (!rdata->data || rdata->size < 4) {
if (!rdata->data || rdata->size < DNSKEY_RDATA_OFFSET_PUBKEY) {
return DNSSEC_MALFORMED_DATA;
}
uint8_t algorithm = rdata->data[3];
uint8_t algorithm = rdata->data[DNSKEY_RDATA_OFFSET_ALGORITHM];
if (algorithm == 1) {
*keytag = keytag_compat(rdata);
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment