~mcf/dnssec-rr

249562bdc9d0fa8d2235a1f26e29652e92b7b343 — Michael Forney 2 years ago 0f581a8
Add base64_length macro
2 files changed, 2 insertions(+), 1 deletions(-)

M dnssec.h
M rrsig.c
M dnssec.h => dnssec.h +1 -0
@@ 94,6 94,7 @@ unsigned dnskey_tag(const struct dnskey *);
size_t base16_decode(unsigned char *, const char *);

/* base64 */
#define base64_length(n) (((n) + 2) / 3 * 4)
void base64_encode(char *, const unsigned char *, size_t);
size_t base64_decode(unsigned char *, const char *);


M rrsig.c => rrsig.c +1 -1
@@ 158,7 158,7 @@ main(int argc, char *argv[])
		default:
			errx(1, "unsupported algorithm %d", sk->algorithm);
		}
		char sig_b64[(sizeof(sig) + 2) / 3 * 4 + 1];
		char sig_b64[base64_length(sizeof(sig)) + 1];
		base64_encode(sig_b64, sig, sig_len);
		puts(sig_b64);
	}