summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/krb5')
-rw-r--r--src/lib/krb5/asn.1/ChangeLog8
-rw-r--r--src/lib/krb5/asn.1/asn1_decode.c10
-rw-r--r--src/lib/krb5/asn.1/asn1_decode.h2
-rw-r--r--src/lib/krb5/asn.1/asn1_encode.c17
-rw-r--r--src/lib/krb5/asn.1/asn1_encode.h11
5 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog
index f5734ff7ca..51273b4045 100644
--- a/src/lib/krb5/asn.1/ChangeLog
+++ b/src/lib/krb5/asn.1/ChangeLog
@@ -1,3 +1,11 @@
+2002-11-05 Tom Yu <tlyu@mit.edu>
+
+ * asn1_encode.h (asn1_encode_oid):
+ * asn1_encode.c (asn1_encode_oid): New function.
+
+ * asn1_decode.h (asn1_decode_oid):
+ * asn1_decode.c (asn1_decode_oid): New function.
+
2002-10-30 Ken Hornstein <kenh@cmf.nrl.navy.mil>
* KRB5-asn.py: Fix definition for sam-pk-for-sad element.
diff --git a/src/lib/krb5/asn.1/asn1_decode.c b/src/lib/krb5/asn.1/asn1_decode.c
index 03a28407ec..f8170830b6 100644
--- a/src/lib/krb5/asn.1/asn1_decode.c
+++ b/src/lib/krb5/asn.1/asn1_decode.c
@@ -104,6 +104,16 @@ asn1_error_code asn1_decode_unsigned_integer(asn1buf *buf, long unsigned int *va
cleanup();
}
+asn1_error_code asn1_decode_oid(asn1buf *buf, unsigned int *retlen, asn1_octet **val)
+{
+ setup();
+ tag(ASN1_OBJECTIDENTIFIER);
+ retval = asn1buf_remove_octetstring(buf, length, val);
+ if (retval) return retval;
+ *retlen = length;
+ cleanup();
+}
+
asn1_error_code asn1_decode_octetstring(asn1buf *buf, unsigned int *retlen, asn1_octet **val)
{
setup();
diff --git a/src/lib/krb5/asn.1/asn1_decode.h b/src/lib/krb5/asn.1/asn1_decode.h
index bddad88521..449a589003 100644
--- a/src/lib/krb5/asn.1/asn1_decode.h
+++ b/src/lib/krb5/asn.1/asn1_decode.h
@@ -65,6 +65,8 @@ asn1_error_code asn1_decode_unsigned_integer
asn1_error_code asn1_decode_null
(asn1buf *buf);
+asn1_error_code asn1_decode_oid
+ (asn1buf *buf, unsigned int *retlen, asn1_octet **val);
asn1_error_code asn1_decode_octetstring
(asn1buf *buf, unsigned int *retlen, asn1_octet **val);
asn1_error_code asn1_decode_generalstring
diff --git a/src/lib/krb5/asn.1/asn1_encode.c b/src/lib/krb5/asn.1/asn1_encode.c
index 4c03455367..6bd40dfe7b 100644
--- a/src/lib/krb5/asn.1/asn1_encode.c
+++ b/src/lib/krb5/asn.1/asn1_encode.c
@@ -130,6 +130,23 @@ asn1_error_code asn1_encode_unsigned_integer(asn1buf *buf, unsigned long val,
return 0;
}
+asn1_error_code asn1_encode_oid(asn1buf *buf, unsigned int len,
+ const asn1_octet *val,
+ unsigned int *retlen)
+{
+ asn1_error_code retval;
+ unsigned int length;
+
+ retval = asn1buf_insert_octetstring(buf, len, val);
+ if (retval) return retval;
+ retval = asn1_make_tag(buf, UNIVERSAL, PRIMITIVE, ASN1_OBJECTIDENTIFIER,
+ len, &length);
+ if (retval) return retval;
+
+ *retlen = len + length;
+ return 0;
+}
+
asn1_error_code asn1_encode_octetstring(asn1buf *buf, unsigned int len,
const asn1_octet *val,
unsigned int *retlen)
diff --git a/src/lib/krb5/asn.1/asn1_encode.h b/src/lib/krb5/asn.1/asn1_encode.h
index 5c14800a4a..2acabc2940 100644
--- a/src/lib/krb5/asn.1/asn1_encode.h
+++ b/src/lib/krb5/asn.1/asn1_encode.h
@@ -82,6 +82,17 @@ asn1_error_code asn1_encode_octetstring
Returns ENOMEM to signal an unsuccesful attempt
to expand the buffer. */
+asn1_error_code asn1_encode_oid
+ (asn1buf *buf,
+ const unsigned int len, const asn1_octet *val,
+ unsigned int *retlen);
+/* requires *buf is allocated
+ modifies *buf, *retlen
+ effects Inserts the encoding of val into *buf and returns
+ the length of the encoding in *retlen.
+ Returns ENOMEM to signal an unsuccesful attempt
+ to expand the buffer. */
+
asn1_error_code asn1_encode_charstring
(asn1buf *buf,
const unsigned int len, const char *val,