diff --git a/src/asn1helpers.c b/src/asn1helpers.c index 3082ddc5..3225223d 100644 --- a/src/asn1helpers.c +++ b/src/asn1helpers.c @@ -31,6 +31,13 @@ void asn1_u32_to_bitstring(BIT_STRING_t *bitstr, uint32_t *in) 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) { diff --git a/src/asn1helpers.h b/src/asn1helpers.h index 75b00e2d..17d0d893 100644 --- a/src/asn1helpers.h +++ b/src/asn1helpers.h @@ -6,6 +6,7 @@ #include "OCTET_STRING.h" void asn1_u32_to_bitstring(BIT_STRING_t *bitstr, uint32_t *in); +void asn1_u24_to_bitstring(BIT_STRING_t *bitstr, uint32_t *in); int asn1_strncpy(char *out, const OCTET_STRING_t *in, size_t n); uint16_t asn1str_to_u16(const OCTET_STRING_t *in); uint8_t asn1str_to_u8(const OCTET_STRING_t *in);