asn1: use LTC_SET_ASN1 macro to access ltc_asn1_list elements

This commit is contained in:
Steffen Jaeckel 2014-08-22 13:12:38 +02:00
parent 4071475558
commit 171eae5378
3 changed files with 4 additions and 13 deletions

View File

@ -112,9 +112,7 @@ int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...)
case LTC_ASN1_SET:
case LTC_ASN1_SETOF:
case LTC_ASN1_CHOICE:
list[x].type = type;
list[x].size = size;
list[x++].data = data;
LTC_SET_ASN1(list, x++, type, data, size);
break;
default:

View File

@ -113,9 +113,7 @@ int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...)
case LTC_ASN1_SET:
case LTC_ASN1_SETOF:
case LTC_ASN1_RAW_BIT_STRING:
list[x].type = type;
list[x].size = size;
list[x++].data = data;
LTC_SET_ASN1(list, x++, type, data, size);
break;
default:

View File

@ -49,13 +49,8 @@ int der_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen
return err;
}
alg_id[0].data = oid.OID;
alg_id[0].size = oid.OIDlen;
alg_id[0].type = LTC_ASN1_OBJECT_IDENTIFIER;
alg_id[1].data = parameters;
alg_id[1].size = parameters_len;
alg_id[1].type = parameters_type;
LTC_SET_ASN1(alg_id, 0, LTC_ASN1_OBJECT_IDENTIFIER, oid.OID, oid.OIDlen);
LTC_SET_ASN1(alg_id, 1, parameters_type, parameters, parameters_len);
return der_encode_sequence_multi(out, outlen,
LTC_ASN1_SEQUENCE, (unsigned long)sizeof(alg_id)/sizeof(alg_id[0]), alg_id,