test-dnssec.c revision 105e151299dc1208855380be2b22d0db2d66ebc6
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen This file is part of systemd.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Copyright 2015 Lennart Poettering
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen systemd is free software; you can redistribute it and/or modify it
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen under the terms of the GNU Lesser General Public License as published by
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen (at your option) any later version.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen systemd is distributed in the hope that it will be useful, but
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Lesser General Public License for more details.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen You should have received a copy of the GNU Lesser General Public License
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersenstatic void test_dnssec_verify_rrset2(void) {
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x48, 0x45, 0xc8, 0x8b, 0xc0, 0x14, 0x92, 0xf5, 0x15, 0xc6, 0x84, 0x9d, 0x2f, 0xe3, 0x32, 0x11,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x7d, 0xf1, 0xe6, 0x87, 0xb9, 0x42, 0xd3, 0x8b, 0x9e, 0xaf, 0x92, 0x31, 0x0a, 0x53, 0xad, 0x8b,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0xa7, 0x5c, 0x83, 0x39, 0x8c, 0x28, 0xac, 0xce, 0x6e, 0x9c, 0x18, 0xe3, 0x31, 0x16, 0x6e, 0xca,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x38, 0x31, 0xaf, 0xd9, 0x94, 0xf1, 0x84, 0xb1, 0xdf, 0x5a, 0xc2, 0x73, 0x22, 0xf6, 0xcb, 0xa2,
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen 0xe7, 0x8c, 0x77, 0x0c, 0x74, 0x2f, 0xc2, 0x13, 0xb0, 0x93, 0x51, 0xa9, 0x4f, 0xae, 0x0a, 0xda,
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen 0x45, 0xcc, 0xfd, 0x43, 0x99, 0x36, 0x9a, 0x0d, 0x21, 0xe0, 0xeb, 0x30, 0x65, 0xd4, 0xa0, 0x27,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x37, 0x3b, 0xe4, 0xc1, 0xc5, 0xa1, 0x2a, 0xd1, 0x76, 0xc4, 0x7e, 0x64, 0x0e, 0x5a, 0xa6, 0x50,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x24, 0xd5, 0x2c, 0xcc, 0x6d, 0xe5, 0x37, 0xea, 0xbd, 0x09, 0x34, 0xed, 0x24, 0x06, 0xa1, 0x22,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x03, 0x01, 0x00, 0x01, 0xc3, 0x7f, 0x1d, 0xd1, 0x1c, 0x97, 0xb1, 0x13, 0x34, 0x3a, 0x9a, 0xea,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0xee, 0xd9, 0x5a, 0x11, 0x1b, 0x17, 0xc7, 0xe3, 0xd4, 0xda, 0x20, 0xbc, 0x5d, 0xba, 0x74, 0xe3,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x37, 0x99, 0xec, 0x25, 0xce, 0x93, 0x7f, 0xbd, 0x22, 0x73, 0x7e, 0x14, 0x71, 0xe0, 0x60, 0x07,
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen 0xd4, 0x39, 0x8b, 0x5e, 0xe9, 0xba, 0x25, 0xe8, 0x49, 0xe9, 0x34, 0xef, 0xfe, 0x04, 0x5c, 0xa5,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x27, 0xcd, 0xa9, 0xda, 0x70, 0x05, 0x21, 0xab, 0x15, 0x82, 0x24, 0xc3, 0x94, 0xf5, 0xd7, 0xb7,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0xc4, 0x66, 0xcb, 0x32, 0x6e, 0x60, 0x2b, 0x55, 0x59, 0x28, 0x89, 0x8a, 0x72, 0xde, 0x88, 0x56,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen 0x27, 0x95, 0xd9, 0xac, 0x88, 0x4f, 0x65, 0x2b, 0x68, 0xfc, 0xe6, 0x41, 0xc1, 0x1b, 0xef, 0x4e,
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen 0xd6, 0xc2, 0x0f, 0x64, 0x88, 0x95, 0x5e, 0xdd, 0x3a, 0x02, 0x07, 0x50, 0xa9, 0xda, 0xa4, 0x49,
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen _cleanup_(dns_resource_record_unrefp) DnsResourceRecord *nsec = NULL, *rrsig = NULL, *dnskey = NULL;
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen _cleanup_(dns_answer_unrefp) DnsAnswer *answer = NULL;
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen _cleanup_free_ char *x = NULL, *y = NULL, *z = NULL;
f882c247ad59776c3a7753bb963c1f8e2386cb79Tom Gundersen nsec = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_NSEC, "nasa.gov");
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen nsec->nsec.next_domain_name = strdup("3D-Printing.nasa.gov");
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen assert_se(bitmap_set(nsec->nsec.types, DNS_TYPE_A) >= 0);
4b6141c42497dc199618f95fa3f359615eecfaa0Tom Gundersen assert_se(bitmap_set(nsec->nsec.types, DNS_TYPE_NS) >= 0);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen assert_se(bitmap_set(nsec->nsec.types, DNS_TYPE_SOA) >= 0);
assert_se(dnssec_verify_rrset(answer, nsec->key, rrsig, dnskey, 1449849318*USEC_PER_SEC, &result) >= 0);
static void test_dnssec_verify_rrset(void) {
assert_se(a);
assert_se(dnssec_verify_rrset(answer, a->key, rrsig, dnskey, 1449092754*USEC_PER_SEC, &result) >= 0);
static void test_dnssec_verify_dns_key(void) {
static void test_dnssec_canonicalize(void) {
static void test_dnssec_nsec3_hash(void) {
static const uint8_t next_hashed_name[] = { 0x84, 0x10, 0x26, 0x53, 0xc9, 0xfa, 0x4d, 0x85, 0x6c, 0x97, 0x82, 0xe2, 0x8f, 0xdf, 0x2d, 0x5e, 0x87, 0x69, 0xc4, 0x52 };
rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_NSEC3, "PJ8S08RR45VIQDAQGE7EN3VHKNROTBMM.eurid.eu.");
assert_se(k >= 0);
b = base32hexmem(h, k, false);
assert_se(b);