asn1helpers.c: Fix asn1bitstr_to_u32 function

The value in buf is kept in host byte order so no need to swap it
around.
This commit is contained in:
Daniel Willmann 2015-11-23 14:03:04 +01:00
parent 54a9a143f0
commit 6e59d413a2
1 changed files with 5 additions and 7 deletions

View File

@ -67,13 +67,11 @@ uint8_t asn1str_to_u8(const OCTET_STRING_t *in)
uint32_t asn1bitstr_to_u32(const BIT_STRING_t *in)
{
uint32_t ret = 0;
int i;
for (i = 0; i < 4; i++) {
if (in->size < i)
break;
ret <<= 8;
ret |= in->buf[i];
}
if (in->size < 4)
return 0;
ret = *(uint32_t *)in->buf;
return ret;
}