der: add new enum element for context-specific encodings

This commit is contained in:
Steffen Jaeckel 2014-10-06 18:32:59 +02:00
parent f0a1235614
commit 2d8933e4f1
8 changed files with 11 additions and 0 deletions

View File

@ -462,6 +462,7 @@ typedef enum ltc_asn1_type_ {
LTC_ASN1_RAW_BIT_STRING, LTC_ASN1_RAW_BIT_STRING,
LTC_ASN1_TELETEX_STRING, LTC_ASN1_TELETEX_STRING,
LTC_ASN1_CONSTRUCTED, LTC_ASN1_CONSTRUCTED,
LTC_ASN1_CONTEXT_SPECIFIC,
} ltc_asn1_type; } ltc_asn1_type;
/** A LTC ASN.1 list type */ /** A LTC ASN.1 list type */

View File

@ -200,6 +200,7 @@ int der_decode_choice(const unsigned char *in, unsigned long *inlen,
case LTC_ASN1_CHOICE: case LTC_ASN1_CHOICE:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
return CRYPT_INVALID_ARG; return CRYPT_INVALID_ARG;
} }

View File

@ -284,6 +284,7 @@ int der_decode_sequence_ex(const unsigned char *in, unsigned long inlen,
break; break;
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
err = CRYPT_INVALID_ARG; err = CRYPT_INVALID_ARG;
goto LBL_ERR; goto LBL_ERR;

View File

@ -72,6 +72,7 @@ int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...)
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
va_end(args); va_end(args);
return CRYPT_INVALID_ARG; return CRYPT_INVALID_ARG;
} }
@ -122,6 +123,7 @@ int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...)
break; break;
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
break; break;
} }
} }

View File

@ -138,6 +138,7 @@ int der_encode_sequence_ex(ltc_asn1_list *list, unsigned long inlen,
case LTC_ASN1_CHOICE: case LTC_ASN1_CHOICE:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
case LTC_ASN1_TELETEX_STRING: case LTC_ASN1_TELETEX_STRING:
err = CRYPT_INVALID_ARG; err = CRYPT_INVALID_ARG;
@ -336,6 +337,7 @@ int der_encode_sequence_ex(ltc_asn1_list *list, unsigned long inlen,
case LTC_ASN1_CHOICE: case LTC_ASN1_CHOICE:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
case LTC_ASN1_TELETEX_STRING: case LTC_ASN1_TELETEX_STRING:
err = CRYPT_INVALID_ARG; err = CRYPT_INVALID_ARG;

View File

@ -71,6 +71,7 @@ int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...)
case LTC_ASN1_CHOICE: case LTC_ASN1_CHOICE:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
case LTC_ASN1_TELETEX_STRING: case LTC_ASN1_TELETEX_STRING:
va_end(args); va_end(args);
@ -122,6 +123,7 @@ int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...)
case LTC_ASN1_CHOICE: case LTC_ASN1_CHOICE:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
case LTC_ASN1_TELETEX_STRING: case LTC_ASN1_TELETEX_STRING:
va_end(args); va_end(args);

View File

@ -141,6 +141,7 @@ int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
case LTC_ASN1_CHOICE: case LTC_ASN1_CHOICE:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
case LTC_ASN1_EOL: case LTC_ASN1_EOL:
err = CRYPT_INVALID_ARG; err = CRYPT_INVALID_ARG;
goto LBL_ERR; goto LBL_ERR;

View File

@ -39,6 +39,7 @@ static int ltc_to_asn1(ltc_asn1_type v)
case LTC_ASN1_SETOF: return 0x31; case LTC_ASN1_SETOF: return 0x31;
case LTC_ASN1_CHOICE: case LTC_ASN1_CHOICE:
case LTC_ASN1_CONSTRUCTED: case LTC_ASN1_CONSTRUCTED:
case LTC_ASN1_CONTEXT_SPECIFIC:
case LTC_ASN1_EOL: return -1; case LTC_ASN1_EOL: return -1;
} }
return -1; return -1;