1 /* $NetBSD: ds.h,v 1.1 2024/02/18 20:57:36 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * SPDX-License-Identifier: MPL-2.0 7 * 8 * This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11 * 12 * See the COPYRIGHT file distributed with this work for additional 13 * information regarding copyright ownership. 14 */ 15 16 #ifndef DNS_DS_H 17 #define DNS_DS_H 1 18 19 #include <isc/lang.h> 20 21 #include <dns/rdatastruct.h> 22 #include <dns/types.h> 23 24 #define DNS_DSDIGEST_SHA1 (1) 25 #define DNS_DSDIGEST_SHA256 (2) 26 #define DNS_DSDIGEST_GOST (3) 27 #define DNS_DSDIGEST_SHA384 (4) 28 29 /* 30 * Assuming SHA-384 digest type. 31 */ 32 #define DNS_DS_BUFFERSIZE (52) 33 34 ISC_LANG_BEGINDECLS 35 36 isc_result_t 37 dns_ds_fromkeyrdata(const dns_name_t *owner, dns_rdata_t *key, 38 dns_dsdigest_t digest_type, unsigned char *digest, 39 dns_rdata_ds_t *dsrdata); 40 /*%< 41 * Build a DS rdata structure from a key. 42 * 43 * Requires: 44 *\li key Points to a valid DNSKEY or CDNSKEY record. 45 *\li buffer Points to a buffer of at least 46 * #ISC_MAX_MD_SIZE bytes. 47 */ 48 49 isc_result_t 50 dns_ds_buildrdata(dns_name_t *owner, dns_rdata_t *key, 51 dns_dsdigest_t digest_type, unsigned char *buffer, 52 dns_rdata_t *rdata); 53 /*%< 54 * Similar to dns_ds_fromkeyrdata(), but copies the DS into a 55 * dns_rdata object. 56 * 57 * Requires: 58 *\li key Points to a valid DNSKEY or CDNSKEY record. 59 *\li buffer Points to a buffer of at least 60 * #DNS_DS_BUFFERSIZE bytes. 61 *\li rdata Points to an initialized dns_rdata_t. 62 * 63 * Ensures: 64 * \li *rdata Contains a valid DS rdata. The 'data' member refers 65 * to 'buffer'. 66 */ 67 68 ISC_LANG_ENDDECLS 69 70 #endif /* DNS_DS_H */ 71