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.
This commit is contained in:
parent
4dd16b9643
commit
0bb1261239
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue