prefix Der_class with ASN1_C_ to avoid problems with system headerfiles that pollute the name space
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15255 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -116,10 +116,10 @@ loop (unsigned char *buf, size_t len, int indent)
|
||||
buf += sz;
|
||||
len -= sz;
|
||||
|
||||
if (class == CONTEXT) {
|
||||
if (class == ASN1_C_CONTEXT) {
|
||||
printf ("[%d]\n", tag);
|
||||
loop (buf, length, indent);
|
||||
} else if (class == UNIV) {
|
||||
} else if (class == ASN1_C_UNIV) {
|
||||
switch (tag) {
|
||||
case UT_Sequence :
|
||||
printf ("{\n");
|
||||
|
@@ -38,7 +38,12 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
typedef enum {UNIV = 0, APPL = 1, CONTEXT = 2 , PRIVATE = 3} Der_class;
|
||||
typedef enum {
|
||||
ASN1_C_UNIV = 0,
|
||||
ASN1_C_APPL = 1,
|
||||
ASN1_C_CONTEXT = 2 ,
|
||||
ASN1_C_PRIVATE = 3
|
||||
} Der_class;
|
||||
|
||||
typedef enum {PRIM = 0, CONS = 1} Der_type;
|
||||
|
||||
|
@@ -256,7 +256,7 @@ decode_boolean (const unsigned char *p, size_t len,
|
||||
size_t l, reallen;
|
||||
int e;
|
||||
|
||||
e = der_match_tag (p, len, UNIV, PRIM, UT_Boolean, &l);
|
||||
e = der_match_tag (p, len, ASN1_C_UNIV, PRIM, UT_Boolean, &l);
|
||||
if (e) return e;
|
||||
p += l;
|
||||
len -= l;
|
||||
@@ -287,7 +287,7 @@ decode_integer (const unsigned char *p, size_t len,
|
||||
size_t l, reallen;
|
||||
int e;
|
||||
|
||||
e = der_match_tag (p, len, UNIV, PRIM, UT_Integer, &l);
|
||||
e = der_match_tag (p, len, ASN1_C_UNIV, PRIM, UT_Integer, &l);
|
||||
if (e) return e;
|
||||
p += l;
|
||||
len -= l;
|
||||
@@ -318,7 +318,7 @@ decode_unsigned (const unsigned char *p, size_t len,
|
||||
size_t l, reallen;
|
||||
int e;
|
||||
|
||||
e = der_match_tag (p, len, UNIV, PRIM, UT_Integer, &l);
|
||||
e = der_match_tag (p, len, ASN1_C_UNIV, PRIM, UT_Integer, &l);
|
||||
if (e) return e;
|
||||
p += l;
|
||||
len -= l;
|
||||
@@ -349,7 +349,7 @@ decode_enumerated (const unsigned char *p, size_t len,
|
||||
size_t l, reallen;
|
||||
int e;
|
||||
|
||||
e = der_match_tag (p, len, UNIV, PRIM, UT_Enumerated, &l);
|
||||
e = der_match_tag (p, len, ASN1_C_UNIV, PRIM, UT_Enumerated, &l);
|
||||
if (e) return e;
|
||||
p += l;
|
||||
len -= l;
|
||||
@@ -380,7 +380,7 @@ decode_general_string (const unsigned char *p, size_t len,
|
||||
size_t l, reallen;
|
||||
int e;
|
||||
|
||||
e = der_match_tag (p, len, UNIV, PRIM, UT_GeneralString, &l);
|
||||
e = der_match_tag (p, len, ASN1_C_UNIV, PRIM, UT_GeneralString, &l);
|
||||
if (e) return e;
|
||||
p += l;
|
||||
len -= l;
|
||||
@@ -411,7 +411,7 @@ decode_octet_string (const unsigned char *p, size_t len,
|
||||
size_t l, reallen;
|
||||
int e;
|
||||
|
||||
e = der_match_tag (p, len, UNIV, PRIM, UT_OctetString, &l);
|
||||
e = der_match_tag (p, len, ASN1_C_UNIV, PRIM, UT_OctetString, &l);
|
||||
if (e) return e;
|
||||
p += l;
|
||||
len -= l;
|
||||
@@ -442,7 +442,7 @@ decode_oid (const unsigned char *p, size_t len,
|
||||
size_t l, reallen;
|
||||
int e;
|
||||
|
||||
e = der_match_tag (p, len, UNIV, PRIM, UT_OID, &l);
|
||||
e = der_match_tag (p, len, ASN1_C_UNIV, PRIM, UT_OID, &l);
|
||||
if (e) return e;
|
||||
p += l;
|
||||
len -= l;
|
||||
@@ -489,7 +489,7 @@ decode_generalized_time (const unsigned char *p, size_t len,
|
||||
size_t l, reallen;
|
||||
int e;
|
||||
|
||||
e = der_match_tag (p, len, UNIV, PRIM, UT_GeneralizedTime, &l);
|
||||
e = der_match_tag (p, len, ASN1_C_UNIV, PRIM, UT_GeneralizedTime, &l);
|
||||
if (e) return e;
|
||||
p += l;
|
||||
len -= l;
|
||||
|
@@ -252,7 +252,7 @@ encode_boolean (unsigned char *p, size_t len, const int *data,
|
||||
p -= l;
|
||||
len -= l;
|
||||
ret += l;
|
||||
e = der_put_length_and_tag (p, len, l, UNIV, PRIM, UT_Boolean, &l);
|
||||
e = der_put_length_and_tag (p, len, l, ASN1_C_UNIV, PRIM, UT_Boolean, &l);
|
||||
if (e)
|
||||
return e;
|
||||
p -= l;
|
||||
@@ -276,7 +276,7 @@ encode_integer (unsigned char *p, size_t len, const int *data, size_t *size)
|
||||
p -= l;
|
||||
len -= l;
|
||||
ret += l;
|
||||
e = der_put_length_and_tag (p, len, l, UNIV, PRIM, UT_Integer, &l);
|
||||
e = der_put_length_and_tag (p, len, l, ASN1_C_UNIV, PRIM, UT_Integer, &l);
|
||||
if (e)
|
||||
return e;
|
||||
p -= l;
|
||||
@@ -310,7 +310,7 @@ encode_unsigned (unsigned char *p, size_t len, const unsigned *data,
|
||||
ret++;
|
||||
l++;
|
||||
}
|
||||
e = der_put_length_and_tag (p, len, l, UNIV, PRIM, UT_Integer, &l);
|
||||
e = der_put_length_and_tag (p, len, l, ASN1_C_UNIV, PRIM, UT_Integer, &l);
|
||||
if (e)
|
||||
return e;
|
||||
p -= l;
|
||||
@@ -335,7 +335,7 @@ encode_enumerated (unsigned char *p, size_t len, const unsigned *data,
|
||||
p -= l;
|
||||
len -= l;
|
||||
ret += l;
|
||||
e = der_put_length_and_tag (p, len, l, UNIV, PRIM, UT_Enumerated, &l);
|
||||
e = der_put_length_and_tag (p, len, l, ASN1_C_UNIV, PRIM, UT_Enumerated, &l);
|
||||
if (e)
|
||||
return e;
|
||||
p -= l;
|
||||
@@ -359,7 +359,7 @@ encode_general_string (unsigned char *p, size_t len,
|
||||
p -= l;
|
||||
len -= l;
|
||||
ret += l;
|
||||
e = der_put_length_and_tag (p, len, l, UNIV, PRIM, UT_GeneralString, &l);
|
||||
e = der_put_length_and_tag (p, len, l, ASN1_C_UNIV, PRIM, UT_GeneralString, &l);
|
||||
if (e)
|
||||
return e;
|
||||
p -= l;
|
||||
@@ -383,7 +383,7 @@ encode_octet_string (unsigned char *p, size_t len,
|
||||
p -= l;
|
||||
len -= l;
|
||||
ret += l;
|
||||
e = der_put_length_and_tag (p, len, l, UNIV, PRIM, UT_OctetString, &l);
|
||||
e = der_put_length_and_tag (p, len, l, ASN1_C_UNIV, PRIM, UT_OctetString, &l);
|
||||
if (e)
|
||||
return e;
|
||||
p -= l;
|
||||
@@ -407,7 +407,7 @@ encode_oid(unsigned char *p, size_t len,
|
||||
p -= l;
|
||||
len -= l;
|
||||
ret += l;
|
||||
e = der_put_length_and_tag (p, len, l, UNIV, PRIM, UT_OID, &l);
|
||||
e = der_put_length_and_tag (p, len, l, ASN1_C_UNIV, PRIM, UT_OID, &l);
|
||||
if (e)
|
||||
return e;
|
||||
p -= l;
|
||||
@@ -455,7 +455,7 @@ encode_generalized_time (unsigned char *p, size_t len,
|
||||
p -= l;
|
||||
len -= l;
|
||||
ret += l;
|
||||
e = der_put_length_and_tag (p, len, k.length, UNIV, PRIM,
|
||||
e = der_put_length_and_tag (p, len, k.length, ASN1_C_UNIV, PRIM,
|
||||
UT_GeneralizedTime, &l);
|
||||
if (e)
|
||||
return e;
|
||||
|
@@ -88,7 +88,7 @@ decode_type (const char *name, const Type *t)
|
||||
int pos;
|
||||
|
||||
fprintf (codefile,
|
||||
"e = der_match_tag_and_length (p, len, UNIV, PRIM, UT_BitString,"
|
||||
"e = der_match_tag_and_length (p, len, ASN1_C_UNIV, PRIM, UT_BitString,"
|
||||
"&reallen, &l);\n"
|
||||
"FORW;\n"
|
||||
"if(len < reallen)\n"
|
||||
@@ -122,7 +122,7 @@ decode_type (const char *name, const Type *t)
|
||||
break;
|
||||
|
||||
fprintf (codefile,
|
||||
"e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,"
|
||||
"e = der_match_tag_and_length (p, len, ASN1_C_UNIV, CONS, UT_Sequence,"
|
||||
"&reallen, &l);\n"
|
||||
"FORW;\n"
|
||||
"{\n"
|
||||
@@ -159,7 +159,7 @@ decode_type (const char *name, const Type *t)
|
||||
}else{
|
||||
fprintf (codefile, "{\n"
|
||||
"size_t newlen, oldlen;\n\n"
|
||||
"e = der_match_tag (p, len, CONTEXT, CONS, %d, &l);\n",
|
||||
"e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, %d, &l);\n",
|
||||
m->val);
|
||||
fprintf (codefile,
|
||||
"if (e)\n");
|
||||
@@ -219,7 +219,7 @@ decode_type (const char *name, const Type *t)
|
||||
char *n;
|
||||
|
||||
fprintf (codefile,
|
||||
"e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence,"
|
||||
"e = der_match_tag_and_length (p, len, ASN1_C_UNIV, CONS, UT_Sequence,"
|
||||
"&reallen, &l);\n"
|
||||
"FORW;\n"
|
||||
"if(len < reallen)\n"
|
||||
@@ -263,7 +263,7 @@ decode_type (const char *name, const Type *t)
|
||||
break;
|
||||
case TApplication:
|
||||
fprintf (codefile,
|
||||
"e = der_match_tag_and_length (p, len, APPL, CONS, %d, "
|
||||
"e = der_match_tag_and_length (p, len, ASN1_C_APPL, CONS, %d, "
|
||||
"&reallen, &l);\n"
|
||||
"FORW;\n"
|
||||
"{\n"
|
||||
@@ -370,7 +370,7 @@ generate_seq_type_decode (const Symbol *s)
|
||||
"int dce_fix;\n");
|
||||
|
||||
fprintf (codefile,
|
||||
"e = der_match_tag(p, len, CONTEXT, CONS, tag, &l);\n"
|
||||
"e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, tag, &l);\n"
|
||||
"if (e)\n"
|
||||
"return e;\n");
|
||||
fprintf (codefile,
|
||||
|
@@ -125,7 +125,7 @@ encode_type (const char *name, const Type *t)
|
||||
"len -= 2;\n"
|
||||
"ret += 2;\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"
|
||||
"BACK;\n",
|
||||
rest);
|
||||
@@ -157,7 +157,7 @@ encode_type (const char *name, const Type *t)
|
||||
#endif
|
||||
encode_type (s, m->type);
|
||||
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"
|
||||
"BACK;\n",
|
||||
m->val);
|
||||
@@ -171,7 +171,7 @@ encode_type (const char *name, const Type *t)
|
||||
free (s);
|
||||
}
|
||||
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");
|
||||
break;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ encode_type (const char *name, const Type *t)
|
||||
"ret += oldret;\n"
|
||||
#endif
|
||||
"}\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");
|
||||
free (n);
|
||||
break;
|
||||
@@ -216,7 +216,7 @@ encode_type (const char *name, const Type *t)
|
||||
case TApplication:
|
||||
encode_type (name, t->subtype);
|
||||
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",
|
||||
t->application);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user