asn1helpers: Add helper to convert u8/u16 to OCTET_STRING
diff --git a/src/asn1helpers.c b/src/asn1helpers.c
index 38907e1..f6378e6 100644
--- a/src/asn1helpers.c
+++ b/src/asn1helpers.c
@@ -41,6 +41,19 @@
bitstr->bits_unused = 0;
}
+void asn1_u16_to_str(OCTET_STRING_t *str, uint16_t *buf, uint16_t in)
+{
+ *buf = htons(in);
+ str->buf = (uint8_t *) buf;
+ str->size = sizeof(uint16_t);
+}
+
+void asn1_u8_to_str(OCTET_STRING_t *str, uint8_t *buf, uint8_t in)
+{
+ *buf = in;
+ str->buf = buf;
+ str->size = sizeof(uint8_t);
+}
int asn1_strncpy(char *out, const OCTET_STRING_t *in, size_t n)
{