diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-05-30 13:38:36 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-05-30 15:21:21 +0200 |
commit | dfc8f76ef9a9f9da0fead5777605af4003eb8018 (patch) | |
tree | 6d82a8263af067cc168e458a530824ec9b4b0c68 /lib | |
parent | b2bb0ef876b9ebb1c6af876fac2c1a8aee616dcb (diff) | |
download | libtasn1-dfc8f76ef9a9f9da0fead5777605af4003eb8018.tar.gz libtasn1-dfc8f76ef9a9f9da0fead5777605af4003eb8018.tar.bz2 libtasn1-dfc8f76ef9a9f9da0fead5777605af4003eb8018.zip |
Simplify temporary value storage during coding.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/coding.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/coding.c b/lib/coding.c index d6b7cf4..003d089 100644 --- a/lib/coding.c +++ b/lib/coding.c @@ -493,6 +493,7 @@ _asn1_complete_explicit_tag (asn1_node node, unsigned char *der, { len2 = strtol (p->name, NULL, 10); _asn1_set_name (p, NULL); + asn1_length_der (*counter - len2, temp, &len3); if (len3 <= (*max_len)) { @@ -1187,10 +1188,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len, case ASN1_ETYPE_SET: if (move != UP) { - _asn1_ltostr (counter, (char *) temp); - tlen = _asn1_strlen (temp); - if (tlen > 0) - _asn1_set_value (p, temp, tlen + 1); + p->tmp_ival = counter; if (p->down == NULL) { move = UP; @@ -1213,8 +1211,8 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len, } else { /* move==UP */ - len2 = _asn1_strtol (p->value, NULL, 10); - _asn1_set_value (p, NULL, 0); + len2 = p->tmp_ival; + p->tmp_ival = 0; if ((type_field (p->type) == ASN1_ETYPE_SET) && (max_len >= 0)) { err = _asn1_ordering_set (der + len2, counter - len2, p); @@ -1236,11 +1234,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len, case ASN1_ETYPE_SET_OF: if (move != UP) { - _asn1_ltostr (counter, (char *) temp); - tlen = _asn1_strlen (temp); - - if (tlen > 0) - _asn1_set_value (p, temp, tlen + 1); + p->tmp_ival = counter; p = p->down; while ((type_field (p->type) == ASN1_ETYPE_TAG) || (type_field (p->type) == ASN1_ETYPE_SIZE)) @@ -1257,8 +1251,8 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len, } if (move == UP) { - len2 = _asn1_strtol (p->value, NULL, 10); - _asn1_set_value (p, NULL, 0); + len2 = p->tmp_ival; + p->tmp_ival = 0; if ((type_field (p->type) == ASN1_ETYPE_SET_OF) && (counter - len2 > 0) && (max_len >= 0)) { |