krb5_decode.c (decode_krb5_alt_method, decode_krb5_etype_info): New
authorTheodore Tso <tytso@mit.edu>
Mon, 28 Aug 1995 20:24:30 +0000 (20:24 +0000)
committerTheodore Tso <tytso@mit.edu>
Mon, 28 Aug 1995 20:24:30 +0000 (20:24 +0000)
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

src/lib/krb5/asn.1/ChangeLog
src/lib/krb5/asn.1/KRB5-asn.py
src/lib/krb5/asn.1/asn1_k_decode.c
src/lib/krb5/asn.1/asn1_k_decode.h
src/lib/krb5/asn.1/asn1_k_encode.c
src/lib/krb5/asn.1/asn1_k_encode.h
src/lib/krb5/asn.1/krb5_decode.c
src/lib/krb5/asn.1/krb5_encode.c

index a558cf428f30c360b08420f78bddb34d55c49161..d48e9fe746d53931f7dab0077a60659c515b47b5 100644 (file)
@@ -1,3 +1,20 @@
+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
index 07e967a22434c824467bbc0edbdd4514ccc682b2..a8a73e45af0e46c88526d7519cbc2bc175c38048 100644 (file)
@@ -324,6 +324,13 @@ METHOD-DATA ::= SEQUENCE {
        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.
index da748c4e816dfdb87b2bbee2f1c1be5d4984fdd6..187f1917b75019062a052a62e83cc4f7fd13e841 100644 (file)
@@ -657,6 +657,32 @@ asn1_error_code asn1_decode_sequence_of_enctype(buf, num, val)
   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;
index f58f1845fcb35224e1d889c0d3ccce556c9e6f4c..a411d1b2e607bbcf999fe67e0dc845564611e6bc 100644 (file)
@@ -138,6 +138,9 @@ asn1_error_code asn1_decode_pa_data
 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));
@@ -158,5 +161,8 @@ asn1_error_code asn1_decode_sequence_of_enctype
 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
index 98c4fc4c9a1ec9fd0c9198862a3d5dfeb5ff36a4..2bdcf7c7ec7e754d5e21197d36ff51e656906d65 100644 (file)
@@ -767,6 +767,45 @@ asn1_error_code asn1_encode_krb_cred_info(buf, val, retlen)
   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;
@@ -798,3 +837,4 @@ asn1_error_code asn1_encode_passwdsequence(buf, val, retlen)
   asn1_makeseq();
   asn1_cleanup();
 }
+
index a4adb5fc4b43f49c605d277097c43d8bd04d58a4..6add4dad4bcce20524fdb058d9c8ec889b8768d5 100644 (file)
@@ -206,6 +206,18 @@ asn1_error_code asn1_encode_last_req_entry
 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));
 
index 7fdd8d7774a2073d11c4cb3c01c5e0b3586edb4b..1a5a988bb0079fe0fe1edb499404e143eda9887f 100644 (file)
@@ -615,3 +615,37 @@ krb5_error_code decode_krb5_padata_sequence(code, rep)
   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();
+}
+
+  
+    
+       
index 8928f56b84f65c2f48cfa29ce744f428d976f0a1..885eb03d06a9a5105542ce64a3a3b41a678f594c 100644 (file)
@@ -697,6 +697,35 @@ krb5_error_code encode_krb5_authdata(rep, code)
   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;