derutil: add headless for generic asn.1 pack

This commit is contained in:
estkme 2024-02-22 15:13:21 +08:00
parent 15f9d6013c
commit 820aca8dc3
2 changed files with 13 additions and 0 deletions

View file

@ -111,6 +111,12 @@ static void euicc_derutil_pack_sizeof_single_node(struct euicc_derutil_node *nod
{
node->self.length = 0;
if (node->pack.headless)
{
node->self.length = node->length;
return;
}
if (node->tag >> 8)
{
node->self.length += 2;
@ -188,6 +194,12 @@ static void euicc_derutil_pack_copydata_single_node(struct euicc_derutil_node *n
{
uint8_t *buffer = (uint8_t *)(node->self.ptr);
if (node->pack.headless)
{
memcpy(buffer, node->value, node->length);
return;
}
if (node->tag >> 8)
{
*buffer = node->tag >> 8;

View file

@ -12,6 +12,7 @@ struct euicc_derutil_node
} self;
struct
{
uint8_t headless;
uint32_t relative_offset;
struct euicc_derutil_node *child;
struct euicc_derutil_node *next;