parent
c342cb5a21
commit
ee4c00b753
@ -519,7 +519,7 @@ int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...)
|
|||||||
|
|
||||||
/* FLEXI DECODER handle unknown list decoder */
|
/* FLEXI DECODER handle unknown list decoder */
|
||||||
int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out);
|
int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out);
|
||||||
void der_free_sequence_flexi(ltc_asn1_list *list);
|
#define der_free_sequence_flexi der_sequence_free
|
||||||
void der_sequence_free(ltc_asn1_list *in);
|
void der_sequence_free(ltc_asn1_list *in);
|
||||||
|
|
||||||
/* BOOLEAN */
|
/* BOOLEAN */
|
||||||
|
@ -18,16 +18,17 @@
|
|||||||
#ifdef LTC_DER
|
#ifdef LTC_DER
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the length of a DER sequence
|
Get the length of a DER sequence
|
||||||
@param list The sequences of items in the SEQUENCE
|
@param list The sequences of items in the SEQUENCE
|
||||||
@param inlen The number of items
|
@param inlen The number of items
|
||||||
@param outlen [out] The length required in octets to store it
|
@param outlen [out] The length required in octets to store it
|
||||||
@return CRYPT_OK on success
|
@return CRYPT_OK on success
|
||||||
*/
|
*/
|
||||||
int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
||||||
unsigned long *outlen)
|
unsigned long *outlen)
|
||||||
{
|
{
|
||||||
int err, type;
|
int err;
|
||||||
|
ltc_asn1_type type;
|
||||||
unsigned long size, x, y, i;
|
unsigned long size, x, y, i;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
|||||||
size = list[i].size;
|
size = list[i].size;
|
||||||
data = list[i].data;
|
data = list[i].data;
|
||||||
|
|
||||||
if (type == LTC_ASN1_EOL) {
|
if (type == LTC_ASN1_EOL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
|||||||
}
|
}
|
||||||
y += x;
|
y += x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LTC_ASN1_INTEGER:
|
case LTC_ASN1_INTEGER:
|
||||||
if ((err = der_length_integer(data, &x)) != CRYPT_OK) {
|
if ((err = der_length_integer(data, &x)) != CRYPT_OK) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
@ -68,6 +69,7 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LTC_ASN1_BIT_STRING:
|
case LTC_ASN1_BIT_STRING:
|
||||||
|
case LTC_ASN1_RAW_BIT_STRING:
|
||||||
if ((err = der_length_bit_string(size, &x)) != CRYPT_OK) {
|
if ((err = der_length_bit_string(size, &x)) != CRYPT_OK) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
}
|
}
|
||||||
@ -99,6 +101,13 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
|||||||
y += x;
|
y += x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LTC_ASN1_TELETEX_STRING:
|
||||||
|
if ((err = der_length_teletex_string(data, size, &x)) != CRYPT_OK) {
|
||||||
|
goto LBL_ERR;
|
||||||
|
}
|
||||||
|
y += x;
|
||||||
|
break;
|
||||||
|
|
||||||
case LTC_ASN1_PRINTABLE_STRING:
|
case LTC_ASN1_PRINTABLE_STRING:
|
||||||
if ((err = der_length_printable_string(data, size, &x)) != CRYPT_OK) {
|
if ((err = der_length_printable_string(data, size, &x)) != CRYPT_OK) {
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
@ -129,8 +138,10 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
|||||||
y += x;
|
y += x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
case LTC_ASN1_CHOICE:
|
||||||
|
case LTC_ASN1_CONSTRUCTED:
|
||||||
|
case LTC_ASN1_EOL:
|
||||||
err = CRYPT_INVALID_ARG;
|
err = CRYPT_INVALID_ARG;
|
||||||
goto LBL_ERR;
|
goto LBL_ERR;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user