commit 6049be901270ac051dca2d917b1a82ce23e6a596
parent de4bc1f18e79382c464edb5de1b4d6d893a07c74
Author: lash <dev@holbrook.no>
Date: Sun, 2 Mar 2025 18:42:36 +0000
Set parent as hash in serialize
Diffstat:
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/lq/cert.c b/src/lq/cert.c
@@ -221,10 +221,22 @@ int lq_certificate_serialize(LQCert *cert, char *out, size_t *out_len) {
return ERR_WRITE;
}
- c = 0;
- r = asn1_write_value(node, "Qaeda.Cert.parent", &c, 1);
- if (r != ASN1_SUCCESS) {
- return ERR_WRITE;
+ if (cert->parent == NULL) {
+ c = 0;
+ r = asn1_write_value(node, "Qaeda.Cert.parent", &c, 1);
+ if (r != ASN1_SUCCESS) {
+ return ERR_WRITE;
+ }
+ } else {
+ r = state_digest(cert, buf, 1);
+ if (r != ERR_OK) {
+ return r;
+ }
+ c = LQ_DIGEST_LEN;
+ r = asn1_write_value(node, "Qaeda.Cert.parent", buf, c);
+ if (r != ASN1_SUCCESS) {
+ return ERR_WRITE;
+ }
}
*out_len = mx;