version 1.1, 2003/05/11 21:36:33 |
version 1.2, 2005/10/16 18:56:35 |
|
|
#include "gen_locl.h" |
#include "gen_locl.h" |
|
|
/* |
/* |
RCSID("$KTH: gen_encode.c,v 1.12 2001/09/25 13:39:26 assar Exp $"); |
RCSID("$KTH: gen_encode.c,v 1.15 2005/05/29 14:23:01 lha Exp $"); |
*/ |
*/ |
|
|
static void |
static void |
|
|
"len -= 2;\n" |
"len -= 2;\n" |
"ret += 2;\n" |
"ret += 2;\n" |
"}\n\n" |
"}\n\n" |
"e = der_put_length_and_tag (p, len, ret, UNIV, PRIM," |
"e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, PRIM," |
"UT_BitString, &l);\n" |
"UT_BitString, &l);\n" |
"BACK;\n", |
"BACK;\n", |
rest); |
rest); |
|
|
#endif |
#endif |
encode_type (s, m->type); |
encode_type (s, m->type); |
fprintf (codefile, |
fprintf (codefile, |
"e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, " |
"e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, " |
"%d, &l);\n" |
"%d, &l);\n" |
"BACK;\n", |
"BACK;\n", |
m->val); |
m->val); |
|
|
free (s); |
free (s); |
} |
} |
fprintf (codefile, |
fprintf (codefile, |
"e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);\n" |
"e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, &l);\n" |
"BACK;\n"); |
"BACK;\n"); |
break; |
break; |
} |
} |
|
|
"ret += oldret;\n" |
"ret += oldret;\n" |
#endif |
#endif |
"}\n" |
"}\n" |
"e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);\n" |
"e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, &l);\n" |
"BACK;\n"); |
"BACK;\n"); |
free (n); |
free (n); |
break; |
break; |
|
|
case TGeneralString: |
case TGeneralString: |
encode_primitive ("general_string", name); |
encode_primitive ("general_string", name); |
break; |
break; |
|
case TUTF8String: |
|
encode_primitive ("utf8string", name); |
|
break; |
|
case TNull: |
|
fprintf (codefile, |
|
"e = encode_nulltype(p, len, &l);\n" |
|
"BACK;\n"); |
|
break; |
case TApplication: |
case TApplication: |
encode_type (name, t->subtype); |
encode_type (name, t->subtype); |
fprintf (codefile, |
fprintf (codefile, |
"e = der_put_length_and_tag (p, len, ret, APPL, CONS, %d, &l);\n" |
"e = der_put_length_and_tag (p, len, ret, ASN1_C_APPL, CONS, %d, &l);\n" |
"BACK;\n", |
"BACK;\n", |
t->application); |
t->application); |
break; |
break; |
|
case TBoolean: |
|
encode_primitive ("boolean", name); |
|
break; |
default: |
default: |
abort (); |
abort (); |
} |
} |
|
|
switch (s->type->type) { |
switch (s->type->type) { |
case TInteger: |
case TInteger: |
case TUInteger: |
case TUInteger: |
|
case TBoolean: |
case TOctetString: |
case TOctetString: |
case TGeneralizedTime: |
case TGeneralizedTime: |
case TGeneralString: |
case TGeneralString: |
|
case TUTF8String: |
|
case TNull: |
case TBitString: |
case TBitString: |
case TEnumerated: |
case TEnumerated: |
case TOID: |
case TOID: |