*/
/*
- * $Id: dnssec.c,v 1.56.2.6 2001/06/08 19:38:57 bwelling Exp $
+ * $Id: dnssec.c,v 1.56.2.7 2001/06/14 13:56:40 gson Exp $
*/
dns_rdata_t tmpsigrdata;
dns_rdata_t *rdatas;
int nrdatas, i;
- isc_buffer_t b, sigbuf, envbuf;
+ isc_buffer_t sigbuf, envbuf;
isc_region_t r;
dst_context_t *ctx = NULL;
isc_result_t ret;
- unsigned char data[300];
+ isc_buffer_t *databuf = NULL;
+ char data[256 + 8];
isc_uint32_t flags;
unsigned int sigsize;
dns_fixedname_t fnewname;
if (ret != ISC_R_SUCCESS)
return (ret);
sig.siglen = sigsize;
+ /*
+ * The actual contents of sig.signature are not important yet, since
+ * they're not used in digest_sig().
+ */
sig.signature = isc_mem_get(mctx, sig.siglen);
if (sig.signature == NULL)
return (ISC_R_NOMEMORY);
- isc_buffer_init(&b, data, sizeof(data));
+ ret = isc_buffer_allocate(mctx, &databuf, sigsize + 256 + 18);
+ if (ret != ISC_R_SUCCESS)
+ goto cleanup_signature;
+
dns_rdata_init(&tmpsigrdata);
ret = dns_rdata_fromstruct(&tmpsigrdata, sig.common.rdclass,
- sig.common.rdtype, &sig, &b);
+ sig.common.rdtype, &sig, databuf);
if (ret != ISC_R_SUCCESS)
- goto cleanup_signature;
+ goto cleanup_databuf;
ret = dst_context_create(key, mctx, &ctx);
if (ret != ISC_R_SUCCESS)
- goto cleanup_signature;
+ goto cleanup_databuf;
/*
* Digest the SIG rdata.
isc_mem_put(mctx, rdatas, nrdatas * sizeof(dns_rdata_t));
cleanup_context:
dst_context_destroy(&ctx);
+cleanup_databuf:
+ if (databuf != NULL)
+ isc_buffer_free(&databuf);
cleanup_signature:
isc_mem_put(mctx, sig.signature, sig.siglen);