summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/lib/asn1/der.h
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/lib/asn1/der.h')
-rw-r--r--crypto/heimdal/lib/asn1/der.h153
1 files changed, 52 insertions, 101 deletions
diff --git a/crypto/heimdal/lib/asn1/der.h b/crypto/heimdal/lib/asn1/der.h
index 738c8d7..13e3932 100644
--- a/crypto/heimdal/lib/asn1/der.h
+++ b/crypto/heimdal/lib/asn1/der.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2006 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -31,122 +31,73 @@
* SUCH DAMAGE.
*/
-/* $Id: der.h,v 1.22 2001/09/27 16:20:35 assar Exp $ */
+/* $Id: der.h 18437 2006-10-14 05:16:08Z lha $ */
#ifndef __DER_H__
#define __DER_H__
-#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;
+#define MAKE_TAG(CLASS, TYPE, TAG) (((CLASS) << 6) | ((TYPE) << 5) | (TAG))
+
/* Universal tags */
enum {
- UT_Boolean = 1,
- UT_Integer = 2,
- UT_BitString = 3,
- UT_OctetString = 4,
- UT_Null = 5,
- UT_OID = 6,
- UT_Enumerated = 10,
- UT_Sequence = 16,
- UT_Set = 17,
- UT_PrintableString = 19,
- UT_IA5String = 22,
- UT_UTCTime = 23,
- UT_GeneralizedTime = 24,
- UT_VisibleString = 26,
- UT_GeneralString = 27
+ UT_EndOfContent = 0,
+ UT_Boolean = 1,
+ UT_Integer = 2,
+ UT_BitString = 3,
+ UT_OctetString = 4,
+ UT_Null = 5,
+ UT_OID = 6,
+ UT_Enumerated = 10,
+ UT_UTF8String = 12,
+ UT_Sequence = 16,
+ UT_Set = 17,
+ UT_PrintableString = 19,
+ UT_IA5String = 22,
+ UT_UTCTime = 23,
+ UT_GeneralizedTime = 24,
+ UT_UniversalString = 25,
+ UT_VisibleString = 26,
+ UT_GeneralString = 27,
+ UT_BMPString = 30,
+ /* unsupported types */
+ UT_ObjectDescriptor = 7,
+ UT_External = 8,
+ UT_Real = 9,
+ UT_EmbeddedPDV = 11,
+ UT_RelativeOID = 13,
+ UT_NumericString = 18,
+ UT_TeletexString = 20,
+ UT_VideotexString = 21,
+ UT_GraphicString = 25
};
#define ASN1_INDEFINITE 0xdce0deed
-#ifndef HAVE_TIMEGM
-time_t timegm (struct tm *);
-#endif
-
-int time2generalizedtime (time_t t, octet_string *s);
-
-int der_get_int (const unsigned char *p, size_t len, int *ret, size_t *size);
-int der_get_length (const unsigned char *p, size_t len,
- size_t *val, size_t *size);
-int der_get_general_string (const unsigned char *p, size_t len,
- general_string *str, size_t *size);
-int der_get_octet_string (const unsigned char *p, size_t len,
- octet_string *data, size_t *size);
-int der_get_oid (const unsigned char *p, size_t len,
- oid *data, size_t *size);
-int der_get_tag (const unsigned char *p, size_t len,
- Der_class *class, Der_type *type,
- int *tag, size_t *size);
-
-int der_match_tag (const unsigned char *p, size_t len,
- Der_class class, Der_type type,
- int tag, size_t *size);
-int der_match_tag_and_length (const unsigned char *p, size_t len,
- Der_class class, Der_type type, int tag,
- size_t *length_ret, size_t *size);
-
-int decode_integer (const unsigned char*, size_t, int*, size_t*);
-int decode_unsigned (const unsigned char*, size_t, unsigned*, size_t*);
-int decode_enumerated (const unsigned char*, size_t, unsigned*, size_t*);
-int decode_general_string (const unsigned char*, size_t,
- general_string*, size_t*);
-int decode_oid (const unsigned char *p, size_t len,
- oid *k, size_t *size);
-int decode_octet_string (const unsigned char*, size_t, octet_string*, size_t*);
-int decode_generalized_time (const unsigned char*, size_t, time_t*, size_t*);
-
-int der_put_int (unsigned char *p, size_t len, int val, size_t*);
-int der_put_length (unsigned char *p, size_t len, size_t val, size_t*);
-int der_put_general_string (unsigned char *p, size_t len,
- const general_string *str, size_t*);
-int der_put_octet_string (unsigned char *p, size_t len,
- const octet_string *data, size_t*);
-int der_put_oid (unsigned char *p, size_t len,
- const oid *data, size_t *size);
-int der_put_tag (unsigned char *p, size_t len, Der_class class, Der_type type,
- int tag, size_t*);
-int der_put_length_and_tag (unsigned char*, size_t, size_t,
- Der_class, Der_type, int, size_t*);
-
-int encode_integer (unsigned char *p, size_t len,
- const int *data, size_t*);
-int encode_unsigned (unsigned char *p, size_t len,
- const unsigned *data, size_t*);
-int encode_enumerated (unsigned char *p, size_t len,
- const unsigned *data, size_t*);
-int encode_general_string (unsigned char *p, size_t len,
- const general_string *data, size_t*);
-int encode_octet_string (unsigned char *p, size_t len,
- const octet_string *k, size_t*);
-int encode_oid (unsigned char *p, size_t len,
- const oid *k, size_t*);
-int encode_generalized_time (unsigned char *p, size_t len,
- const time_t *t, size_t*);
-
-void free_integer (int *num);
-void free_general_string (general_string *str);
-void free_octet_string (octet_string *k);
-void free_oid (oid *k);
-void free_generalized_time (time_t *t);
+typedef struct heim_der_time_t {
+ time_t dt_sec;
+ unsigned long dt_nsec;
+} heim_der_time_t;
-size_t length_len (size_t len);
-size_t length_integer (const int *data);
-size_t length_unsigned (const unsigned *data);
-size_t length_enumerated (const unsigned *data);
-size_t length_general_string (const general_string *data);
-size_t length_octet_string (const octet_string *k);
-size_t length_oid (const oid *k);
-size_t length_generalized_time (const time_t *t);
+typedef struct heim_ber_time_t {
+ time_t bt_sec;
+ unsigned bt_nsec;
+ int bt_zone;
+} heim_ber_time_t;
-int copy_general_string (const general_string *from, general_string *to);
-int copy_octet_string (const octet_string *from, octet_string *to);
-int copy_oid (const oid *from, oid *to);
+#include <der-protos.h>
-int fix_dce(size_t reallen, size_t *len);
+int _heim_fix_dce(size_t reallen, size_t *len);
+int _heim_der_set_sort(const void *, const void *);
+int _heim_time2generalizedtime (time_t, heim_octet_string *, int);
#endif /* __DER_H__ */
OpenPOWER on IntegriCloud