Harald Welte | 2d4f2bd | 2016-01-03 17:14:54 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <unistd.h> |
| 4 | |
| 5 | #include "asn_system.h" |
| 6 | #include "BIT_STRING.h" |
| 7 | #include "OCTET_STRING.h" |
| 8 | |
| 9 | void asn1_u32_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in); |
| 10 | void asn1_u28_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in); |
| 11 | void asn1_u24_to_bitstring(BIT_STRING_t *bitstr, uint32_t *buf, uint32_t in); |
| 12 | int BIT_STRING_fromBuf(BIT_STRING_t *st, const uint8_t *str, unsigned int bit_len); |
Daniel Willmann | 95a112f | 2016-02-02 16:38:40 +0100 | [diff] [blame] | 13 | void asn1_u32_to_str(OCTET_STRING_t *str, uint32_t *buf, uint32_t in); |
Harald Welte | 2d4f2bd | 2016-01-03 17:14:54 +0100 | [diff] [blame] | 14 | void asn1_u16_to_str(OCTET_STRING_t *str, uint16_t *buf, uint16_t in); |
| 15 | void asn1_u8_to_str(OCTET_STRING_t *str, uint8_t *buf, uint8_t in); |
| 16 | int asn1_strncpy(char *out, const OCTET_STRING_t *in, size_t n); |
Daniel Willmann | 95a112f | 2016-02-02 16:38:40 +0100 | [diff] [blame] | 17 | uint32_t asn1str_to_u32(const OCTET_STRING_t *in); |
Harald Welte | 2d4f2bd | 2016-01-03 17:14:54 +0100 | [diff] [blame] | 18 | uint16_t asn1str_to_u16(const OCTET_STRING_t *in); |
| 19 | uint8_t asn1str_to_u8(const OCTET_STRING_t *in); |
| 20 | uint32_t asn1bitstr_to_u32(const BIT_STRING_t *in); |
| 21 | uint32_t asn1bitstr_to_u28(const BIT_STRING_t *in); |
| 22 | uint32_t asn1bitstr_to_u24(const BIT_STRING_t *in); |
| 23 | |
| 24 | static inline void OCTET_STRING_noalloc(OCTET_STRING_t *s, const uint8_t *str, int size) |
| 25 | { |
Harald Welte | b7c145d | 2017-10-27 22:05:13 +0200 | [diff] [blame^] | 26 | s->buf = (uint8_t *) str; |
Harald Welte | 2d4f2bd | 2016-01-03 17:14:54 +0100 | [diff] [blame] | 27 | s->size = size; |
| 28 | } |