* 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
+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.
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();
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
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)
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,