* asn1_encode.h (asn1_encode_oid):
authorTom Yu <tlyu@mit.edu>
Tue, 5 Nov 2002 21:54:47 +0000 (21:54 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 5 Nov 2002 21:54:47 +0000 (21:54 +0000)
* asn1_encode.c (asn1_encode_oid): New function.

* asn1_decode.h (asn1_decode_oid):
* asn1_decode.c (asn1_decode_oid): New function.

ticket: 1223
target_version: 1.3
component: krb5-libs

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14971 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/asn.1/ChangeLog
src/lib/krb5/asn.1/asn1_decode.c
src/lib/krb5/asn.1/asn1_decode.h
src/lib/krb5/asn.1/asn1_encode.c
src/lib/krb5/asn.1/asn1_encode.h

index f5734ff7cac51549134d6755415eca11ad91270a..51273b40453068ca4e162db882d251dac6213e9a 100644 (file)
@@ -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.
index 03a28407ecfd663a8952932078b07d512a89c5bf..f8170830b6715a10fe4aeab5534c3ce64481cb7d 100644 (file)
@@ -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();
index bddad8852185d87b9d768c6a6f801d8778b78920..449a589003b72e97236a8dbdfa99629b10d3210d 100644 (file)
@@ -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
index 4c034553672dd530225ea3498d41c1da4603a4d4..6bd40dfe7beadcd4de7dbc52a48c20479d6394fc 100644 (file)
@@ -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)
index 5c14800a4a7d89a46dbf9b28364f5f4622107565..2acabc29404af4e00beac17266fd9e73843f9b28 100644 (file)
@@ -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,