Dear libtasn1 maintainers,

I needed to delete some SET OF elements in my application and libtasn1
couldn't make it. Since the standards defines SET OF elements pretty
much like SEQUENCE OF elements (except the data order), I think we could
add it in libtasn1 ?

The first patch fixes some compilation errors introduced recently
(commit 2725175)

Regards,
-- 
Jean-Louis Thekekara - OpenWide Ingénierie
http://ingenierie.openwide.fr
http://www.linuxembedded.fr
>From 308bca835e2ebe8fb90dd5af70bc633970196eed Mon Sep 17 00:00:00 2001
From: Jean-Louis Thekekara <[email protected]>
Date: Tue, 25 Mar 2014 14:16:39 +0100
Subject: [PATCH 1/2] extract_tag_der_recursive: fix compilation errors

Fix the following errors introduced by extract_tag_der_recursive usage:

decoding.c: In function 'extract_tag_der_recursive':
decoding.c:560:5: error: 'ris' may be used uninitialized in this function [-Werror=maybe-uninitialized]

decoding.c: In function 'asn1_der_decoding_startEnd':
decoding.c:2192:40: error: unused variable 'p3' [-Werror=unused-variable]
---
 lib/decoding.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/decoding.c b/lib/decoding.c
index dee7a9f..e9af339 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -557,7 +557,7 @@ extract_tag_der_recursive(asn1_node node, const unsigned char *der, int der_len,
 		       int *ret_len)
 {
 asn1_node p;
-int ris;
+int ris = ASN1_DER_ERROR;
 
   if (type_field (node->type) == ASN1_ETYPE_CHOICE)
     {
@@ -2189,7 +2189,7 @@ int
 asn1_der_decoding_startEnd (asn1_node element, const void *ider, int len,
 			    const char *name_element, int *start, int *end)
 {
-  asn1_node node, node_to_find, p, p2, p3;
+  asn1_node node, node_to_find, p, p2;
   int counter, len2, len3, len4, move, ris;
   unsigned char class;
   unsigned long tag;
-- 
1.7.2.5

>From 1c5349aa51f2bac4fe5cc6b130c7b6fa3df31b98 Mon Sep 17 00:00:00 2001
From: Jean-Louis Thekekara <[email protected]>
Date: Tue, 25 Mar 2014 13:41:37 +0100
Subject: [PATCH 2/2] asn1_write_value: allow SET_OF elements deletion

SET_OF elements could just be deleted as SEQUENCE_OF ones.
---
 lib/element.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/element.c b/lib/element.c
index 8604c24..3e26d84 100644
--- a/lib/element.c
+++ b/lib/element.c
@@ -290,7 +290,7 @@ asn1_write_value (asn1_node node_root, const char *name,
 
   type = type_field (node->type);
 
-  if ((type == ASN1_ETYPE_SEQUENCE_OF) && (value == NULL) && (len == 0))
+  if ((type == ASN1_ETYPE_SEQUENCE_OF || type == ASN1_ETYPE_SET_OF) && (value == NULL) && (len == 0))
     {
       p = node->down;
       while ((type_field (p->type) == ASN1_ETYPE_TAG)
-- 
1.7.2.5

Reply via email to