diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/krb5/asn.1/ChangeLog | 17 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/KRB5-asn.py | 7 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_decode.c | 26 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_decode.h | 6 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_encode.c | 40 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/asn1_k_encode.h | 12 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/krb5_decode.c | 34 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/krb5_encode.c | 29 |
8 files changed, 171 insertions, 0 deletions
diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index a558cf4..d48e9fe 100644 --- a/src/lib/krb5/asn.1/ChangeLog +++ b/src/lib/krb5/asn.1/ChangeLog @@ -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 diff --git a/src/lib/krb5/asn.1/KRB5-asn.py b/src/lib/krb5/asn.1/KRB5-asn.py index 07e967a..a8a73e4 100644 --- a/src/lib/krb5/asn.1/KRB5-asn.py +++ b/src/lib/krb5/asn.1/KRB5-asn.py @@ -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. diff --git a/src/lib/krb5/asn.1/asn1_k_decode.c b/src/lib/krb5/asn.1/asn1_k_decode.c index da748c4..187f191 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.c +++ b/src/lib/krb5/asn.1/asn1_k_decode.c @@ -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; diff --git a/src/lib/krb5/asn.1/asn1_k_decode.h b/src/lib/krb5/asn.1/asn1_k_decode.h index f58f184..a411d1b 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.h +++ b/src/lib/krb5/asn.1/asn1_k_decode.h @@ -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 diff --git a/src/lib/krb5/asn.1/asn1_k_encode.c b/src/lib/krb5/asn.1/asn1_k_encode.c index 98c4fc4..2bdcf7c 100644 --- a/src/lib/krb5/asn.1/asn1_k_encode.c +++ b/src/lib/krb5/asn.1/asn1_k_encode.c @@ -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(); } + diff --git a/src/lib/krb5/asn.1/asn1_k_encode.h b/src/lib/krb5/asn.1/asn1_k_encode.h index a4adb5f..6add4da 100644 --- a/src/lib/krb5/asn.1/asn1_k_encode.h +++ b/src/lib/krb5/asn.1/asn1_k_encode.h @@ -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)); diff --git a/src/lib/krb5/asn.1/krb5_decode.c b/src/lib/krb5/asn.1/krb5_decode.c index 7fdd8d7..1a5a988 100644 --- a/src/lib/krb5/asn.1/krb5_decode.c +++ b/src/lib/krb5/asn.1/krb5_decode.c @@ -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(); +} + + + + diff --git a/src/lib/krb5/asn.1/krb5_encode.c b/src/lib/krb5/asn.1/krb5_encode.c index 8928f56..885eb03 100644 --- a/src/lib/krb5/asn.1/krb5_encode.c +++ b/src/lib/krb5/asn.1/krb5_encode.c @@ -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; |