From 46eb664928c643a44389f1c3950f732028246718 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Fri, 6 Sep 2019 14:30:38 +0200 Subject: [PATCH] Fix finishcert function The cert start must be at offset 0 --- x509.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x509.c b/x509.c index 645e13b..6dfa5bb 100644 --- a/x509.c +++ b/x509.c @@ -285,12 +285,11 @@ x509_tbscert(struct x509 *cb, const char *cn, const char *email, time_t start, t void x509_finishcert(struct x509 *cb, byte *sig, int sigl) { - int offset = cb->len; x509_add_const(cb, sig_algo_rsa_sha256); x509_add(cb, 0, 1); x509_add(cb, sig, sigl); x509_tag(cb, cb->len - (sigl + 1), 0x03); - x509_tag(cb, offset, 0x30); + x509_tag(cb, 0, 0x30); } byte *