functions for decoding some new data structures.
krb5_encode.c (encode_krb5_alt_method, encode_krb5_etype_info):
New functions for encoding some new data structures.
asn1_k_decode.c (asn1_decode_etype_info_entry,
asn1_decode_etype_info): Added new functions to decode some
new data structures.
asn1_k_encode.c (asn1_encode_etype_info_entry,
asn1_encode_etype_info): Added new functions to encode some
new data structures.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6606
dc483132-0cff-0310-8789-
dd5450dbe970
+Mon Aug 28 12:54:05 1995 <tytso@rsts-11.mit.edu>
+
+ * krb5_decode.c (decode_krb5_alt_method,
+ decode_krb5_etype_info): New functions for
+ decoding some new data structures.
+
+ * krb5_encode.c (encode_krb5_alt_method, encode_krb5_etype_info):
+ New functions for encoding some new data structures.
+
+ * asn1_k_decode.c (asn1_decode_etype_info_entry,
+ asn1_decode_etype_info): Added new functions to decode
+ some new data structures.
+
+ * asn1_k_encode.c (asn1_encode_etype_info_entry,
+ asn1_encode_etype_info): Added new functions to encode
+ some new data structures.
+
Fri Aug 25 21:43:42 1995 Theodore Y. Ts'o <tytso@dcl>
* krb5_encode.c (encode_krb5_padata_sequence): New function which
method-data[1] OCTET STRING OPTIONAL
}
+ETYPE-INFO-ENTRY ::= SEQUENCE {
+ etype[0] INTEGER,
+ salt[1] OCTET STRING OPTIONAL
+}
+
+ETYPE-INFO ::= SEQUENCE OF ETYPE-INFO-ENTRY
+
-- These ASN.1 definitions are NOT part of the official Kerberos protocol...
-- New ASN.1 definitions for the kadmin protocol.
cleanup();
}
+asn1_error_code asn1_decode_etype_info_entry(buf, val)
+ asn1buf * buf;
+ krb5_etype_info_entry * val;
+{
+ setup();
+ { begin_structure();
+ get_field(val->etype,0,asn1_decode_ui_4);
+ if (tagnum == 1) {
+ get_lenfield(val->length,val->salt,1,asn1_decode_octetstring);
+ } else {
+ val->length = 0;
+ val->salt = 0;
+ }
+ end_structure();
+ val->magic = KV5M_ETYPE_INFO_ENTRY;
+ }
+ cleanup();
+}
+
+asn1_error_code asn1_decode_etype_info(buf, val)
+ asn1buf * buf;
+ krb5_etype_info_entry *** val;
+{
+ decode_array_body(krb5_etype_info_entry,asn1_decode_etype_info_entry);
+}
+
asn1_error_code asn1_decode_passwdsequence(buf, val)
asn1buf * buf;
passwd_phrase_element * val;
asn1_error_code asn1_decode_passwdsequence
PROTOTYPE((asn1buf *buf, passwd_phrase_element *val));
+asn1_error_code asn1_decode_etype_info_entry
+ PROTOTYPE((asn1buf *buf, krb5_etype_info_entry *val));
+
/* arrays */
asn1_error_code asn1_decode_authorization_data
PROTOTYPE((asn1buf *buf, krb5_authdata ***val));
asn1_error_code asn1_decode_sequence_of_passwdsequence
PROTOTYPE((asn1buf *buf, passwd_phrase_element ***val));
+asn1_error_code asn1_decode_etype_info
+ PROTOTYPE((asn1buf *buf, krb5_etype_info_entry ***val));
+
#endif
asn1_cleanup();
}
+asn1_error_code asn1_encode_etype_info_entry(buf, val, retlen)
+ asn1buf * buf;
+ const krb5_etype_info_entry * val;
+ int * retlen;
+{
+ asn1_setup();
+
+ if(val == NULL || (val->length != 0 && val->salt == NULL))
+ return ASN1_MISSING_FIELD;
+
+ if (val->length)
+ asn1_addlenfield(val->length,val->salt,1,
+ asn1_encode_octetstring);
+ asn1_addfield(val->etype,0,asn1_encode_integer);
+ asn1_makeseq();
+
+ asn1_cleanup();
+}
+
+asn1_error_code asn1_encode_etype_info(buf, val, retlen)
+ asn1buf * buf;
+ const krb5_etype_info_entry ** val;
+ int * retlen;
+{
+ asn1_setup();
+ int i;
+
+ if (val == NULL) return ASN1_MISSING_FIELD;
+
+ for(i=0; val[i] != NULL; i++); /* get to the end of the array */
+ for(i--; i>=0; i--){
+ retval = asn1_encode_etype_info_entry(buf,val[i],&length);
+ if(retval) return retval;
+ sum += length;
+ }
+ asn1_makeseq();
+ asn1_cleanup();
+}
+
asn1_error_code asn1_encode_sequence_of_passwdsequence(buf, val, retlen)
asn1buf * buf;
const passwd_phrase_element ** val;
asn1_makeseq();
asn1_cleanup();
}
+
asn1_error_code asn1_encode_pa_data
PROTOTYPE((asn1buf *buf, const krb5_pa_data *val, int *retlen));
+asn1_error_code asn1_encode_alt_method
+ PROTOTYPE((asn1buf *buf, const krb5_alt_method *val,
+ int *retlen));
+
+asn1_error_code asn1_encode_etype_info_entry
+ PROTOTYPE((asn1buf *buf, const krb5_etype_info_entry *val,
+ int *retlen));
+
+asn1_error_code asn1_encode_etype_info
+ PROTOTYPE((asn1buf *buf, const krb5_etype_info_entry **val,
+ int *retlen));
+
asn1_error_code asn1_encode_passwdsequence
PROTOTYPE((asn1buf *buf, const passwd_phrase_element *val, int *retlen));
cleanup();
}
+krb5_error_code decode_krb5_alt_method(code, rep)
+ const krb5_data * code;
+ krb5_alt_method ** rep;
+{
+ setup();
+ alloc_field(*rep,krb5_alt_method);
+ { begin_structure();
+ get_field((*rep)->method,0,asn1_decode_int);
+ if (tagnum == 1) {
+ get_lenfield((*rep)->length,(*rep)->data,1,asn1_decode_octetstring);
+ } else {
+ (*rep)->length = 0;
+ (*rep)->data = 0;
+ }
+ (*rep)->magic = KV5M_ALT_METHOD;
+ end_structure();
+ }
+ cleanup();
+}
+
+krb5_error_code decode_krb5_etype_info(code, rep)
+ const krb5_data * code;
+ krb5_etype_info_entry ***rep;
+{
+ setup_buf_only();
+ *rep = 0;
+ retval = asn1_decode_etype_info(&buf,rep);
+ if(retval) return (krb5_error_code)retval;
+ cleanup();
+}
+
+
+
+
krb5_cleanup();
}
+krb5_error_code encode_krb5_alt_method(rep, code)
+ const krb5_alt_method * rep;
+ krb5_data ** code;
+{
+ krb5_setup();
+
+ /* method-data[1] OctetString OPTIONAL */
+ if(rep->data != NULL && rep->length > 0)
+ krb5_addlenfield(rep->length,rep->data,1,asn1_encode_octetstring);
+
+ /* method-type[0] Integer */
+ krb5_addfield(rep->method,0,asn1_encode_integer);
+
+ krb5_makeseq();
+
+ krb5_cleanup();
+}
+
+krb5_error_code encode_krb5_etype_info( rep, code)
+ const krb5_etype_info_entry ** rep;
+ krb5_data ** code;
+{
+ krb5_setup();
+ retval = asn1_encode_etype_info(buf,rep,&length);
+ if(retval) return retval;
+ sum += length;
+ krb5_cleanup();
+}
+
/* Sandia Additions */
krb5_error_code encode_krb5_pwd_sequence( rep, code)
const passwd_phrase_element * rep;