add asn1_u24_to_bitstring()
Sometimes we have a native uint32_t, but we don't want to encode
it to a 4-byte long ASN1 BITSTRING, but rather to one that is only
24 bits.
diff --git a/src/asn1helpers.c b/src/asn1helpers.c
index 3082ddc..3225223 100644
--- a/src/asn1helpers.c
+++ b/src/asn1helpers.c
@@ -31,6 +31,13 @@
bitstr->bits_unused = 0;
}
+void asn1_u24_to_bitstring(BIT_STRING_t *bitstr, uint32_t *in)
+{
+ bitstr->buf = (uint8_t *) in;
+ bitstr->size = 24/8;
+ bitstr->bits_unused = 0;
+}
+
int asn1_strncpy(char *out, const OCTET_STRING_t *in, size_t n)
{