|
|
@ -203,10 +203,9 @@ BerInteger_createFromInt64(int64_t value)
|
|
|
|
return asn1Value;
|
|
|
|
return asn1Value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int /* 1 - if conversion is possible, 0 - out of range */
|
|
|
|
void
|
|
|
|
BerInteger_toInt32(Asn1PrimitiveValue* self, int32_t* nativeValue)
|
|
|
|
BerInteger_toInt32(Asn1PrimitiveValue* self, int32_t* nativeValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->size < 5) {
|
|
|
|
|
|
|
|
uint8_t* buf = self->octets;
|
|
|
|
uint8_t* buf = self->octets;
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
@ -217,17 +216,11 @@ BerInteger_toInt32(Asn1PrimitiveValue* self, int32_t* nativeValue)
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < self->size; i++)
|
|
|
|
for (i = 0; i < self->size; i++)
|
|
|
|
*nativeValue = (*nativeValue << 8) | buf[i];
|
|
|
|
*nativeValue = (*nativeValue << 8) | buf[i];
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int /* 1 - if conversion is possible, 0 - out of range */
|
|
|
|
void
|
|
|
|
BerInteger_toUint32(Asn1PrimitiveValue* self, uint32_t* nativeValue)
|
|
|
|
BerInteger_toUint32(Asn1PrimitiveValue* self, uint32_t* nativeValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->size < 6) {
|
|
|
|
|
|
|
|
uint8_t* buf = self->octets;
|
|
|
|
uint8_t* buf = self->octets;
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
@ -235,17 +228,11 @@ BerInteger_toUint32(Asn1PrimitiveValue* self, uint32_t* nativeValue)
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < self->size; i++)
|
|
|
|
for (i = 0; i < self->size; i++)
|
|
|
|
*nativeValue = (*nativeValue << 8) | buf[i];
|
|
|
|
*nativeValue = (*nativeValue << 8) | buf[i];
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int /* 1 - if conversion is possible, 0 - out of range */
|
|
|
|
void
|
|
|
|
BerInteger_toInt64(Asn1PrimitiveValue* self, int64_t* nativeValue)
|
|
|
|
BerInteger_toInt64(Asn1PrimitiveValue* self, int64_t* nativeValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (self->size < 9) {
|
|
|
|
|
|
|
|
uint8_t* buf = self->octets;
|
|
|
|
uint8_t* buf = self->octets;
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
@ -256,10 +243,5 @@ BerInteger_toInt64(Asn1PrimitiveValue* self, int64_t* nativeValue)
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < self->size; i++)
|
|
|
|
for (i = 0; i < self->size; i++)
|
|
|
|
*nativeValue = (*nativeValue << 8) | buf[i];
|
|
|
|
*nativeValue = (*nativeValue << 8) | buf[i];
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|