+2000-10-17 Ezra Peisach <epeisach@mit.edu>
+
+ * asn1buf.h: Lengths are now unsigned int for
+ asn1buf_ensure_space(), asn1buf_expand(), asn1buf_imbed(),
+ asn1buf_sync(), asn1buf_insert_octetstring(),
+ asn1buf_insert_charstring(), asn1_remove_octetstring(),
+ asn1buf_remove_charstring(),
+
+ * krb5_decode.c, krb5_encode.c: Length fields are unsigned ints.
+
+ * asn1_make.c, asn1_make.h: Prototypes changed to use an unsigned
+ int * in_len and retlen for: asn1_make_etag(), asn1_make_tag(),
+ asn1_make_sequence(), asn1_make_set(), asn1_make_string(),
+ asn1_make_length(), asn1_make_id().
+
+ * asn1_k_encode.h, asn1_k_encode.c: Change length fields to
+ unsigned ints for all functions.
+ (asn1_encode_etype_info_entry): Test for KRB5_ETYPE_NO_SALT
+ instead of -1.
+
+ * asn1_k_decode.c (asn1_decode_etype_info_entry): Use a length of
+ KRB5_ETYPE_NO_SALT to indicate the optional salt not being
+ present. (instead of -1).
+ (setup): Length is now unsigned int.
+
+ * asn1_get.c, asn1_get.h: Change retlent to unsigned int * for
+ asn1_get_tag(), asn1_get_tag_indef(), asn1_get_sequence,
+ asn1_get_length().
+
+ * asn1_encode.c, asn1_encode.h: Change retlen to unsigned int *
+ for asn1_encode_integer(), asn1_encode_unsigned_integer(),
+ asn1_encode_octetstring(), asn1_encode_charstring(),
+ asn1_encode_printable_string(), asn1_encode_ia5string(),
+ asn1_encode_generaltime(), asn1_encode_generalstring()
+
+ * asn1_decode.c, asn1_decode.h: Change retlen to unsigned int *
+ for asn1_decode_octetstring(), asn1_decode_generalstring(),
+ asn1_decode_charstring(),
+
2000-09-26 Tom Yu <tlyu@mit.edu>
* asn1_get.c (asn1_get_tag_indef): Fix to not deref random garbage
asn1_class class;\
asn1_construction construction;\
asn1_tagnum tagnum;\
-int length
+unsigned int length
#define tag(type)\
retval = asn1_get_tag(buf,&class,&construction,&tagnum,&length);\
asn1_error_code asn1_decode_octetstring(buf, retlen, val)
asn1buf * buf;
- int * retlen;
+ unsigned int * retlen;
asn1_octet ** val;
{
setup();
asn1_error_code asn1_decode_charstring(buf, retlen, val)
asn1buf * buf;
- int * retlen;
+ unsigned int * retlen;
char ** val;
{
setup();
asn1_error_code asn1_decode_generalstring(buf, retlen, val)
asn1buf * buf;
- int * retlen;
+ unsigned int * retlen;
char ** val;
{
setup();
PROTOTYPE((asn1buf *buf));
asn1_error_code asn1_decode_octetstring
- PROTOTYPE((asn1buf *buf, int *retlen, asn1_octet **val));
+ PROTOTYPE((asn1buf *buf, unsigned int *retlen, asn1_octet **val));
asn1_error_code asn1_decode_generalstring
- PROTOTYPE((asn1buf *buf, int *retlen, char **val));
+ PROTOTYPE((asn1buf *buf, unsigned int *retlen, char **val));
asn1_error_code asn1_decode_charstring
- PROTOTYPE((asn1buf *buf, int *retlen, char **val));
+ PROTOTYPE((asn1buf *buf, unsigned int *retlen, char **val));
/* Note: A charstring is a special hack to account for the fact that
krb5 structures store some OCTET STRING values in krb5_octet
arrays and others in krb5_data structures
asn1_error_code asn1_encode_integer(buf, val, retlen)
asn1buf * buf;
const long val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_error_code retval;
- int length = 0, partlen;
+ unsigned int length = 0;
+ unsigned int partlen;
long valcopy;
int digit;
asn1_error_code asn1_encode_unsigned_integer(buf, val, retlen)
asn1buf * buf;
const unsigned long val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_error_code retval;
- int length = 0, partlen;
+ unsigned int length = 0;
+ unsigned int partlen;
unsigned long valcopy;
int digit;
asn1_error_code asn1_encode_octetstring(buf, len, val, retlen)
asn1buf * buf;
- const int len;
+ const unsigned int len;
const asn1_octet * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_error_code retval;
- int length;
+ unsigned int length;
retval = asn1buf_insert_octetstring(buf,len,val);
if(retval) return retval;
asn1_error_code asn1_encode_charstring(buf, len, val, retlen)
asn1buf * buf;
- const int len;
+ const unsigned int len;
const char * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_error_code retval;
- int length;
+ unsigned int length;
retval = asn1buf_insert_charstring(buf,len,val);
if(retval) return retval;
asn1_error_code asn1_encode_printablestring(buf, len, val, retlen)
asn1buf * buf;
- const int len;
+ const unsigned int len;
const char * val;
int * retlen;
{
asn1_error_code retval;
- int length;
+ unsigned int length;
retval = asn1buf_insert_charstring(buf,len,val);
if(retval) return retval;
asn1_error_code asn1_encode_ia5string(buf, len, val, retlen)
asn1buf * buf;
- const int len;
+ const unsigned int len;
const char * val;
int * retlen;
{
asn1_error_code retval;
- int length;
+ unsigned int length;
retval = asn1buf_insert_charstring(buf,len,val);
if(retval) return retval;
asn1_error_code asn1_encode_generaltime(buf, val, retlen)
asn1buf * buf;
const time_t val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_error_code retval;
struct tm *gtime;
char s[16];
- int length, sum=0;
+ unsigned int length, sum=0;
time_t gmt_time;
gmt_time = val + EPOCH;
asn1_error_code asn1_encode_generalstring(buf, len, val, retlen)
asn1buf * buf;
- const int len;
+ const unsigned int len;
const char * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_error_code retval;
- int length;
+ unsigned int length;
retval = asn1buf_insert_charstring(buf,len,val);
if(retval) return retval;
*/
asn1_error_code asn1_encode_integer
- PROTOTYPE((asn1buf *buf, const long val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const long val, unsigned int *retlen));
/* requires *buf is allocated
modifies *buf, *retlen
effects Inserts the encoding of val into *buf and returns
to expand the buffer. */
asn1_error_code asn1_encode_unsigned_integer
- PROTOTYPE((asn1buf *buf, const unsigned long val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const unsigned long val,
+ unsigned int *retlen));
/* requires *buf is allocated
modifies *buf, *retlen
effects Inserts the encoding of val into *buf and returns
asn1_error_code asn1_encode_octetstring
PROTOTYPE((asn1buf *buf,
- const int len, const asn1_octet *val,
- int *retlen));
+ 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
asn1_error_code asn1_encode_charstring
PROTOTYPE((asn1buf *buf,
- const int len, const char *val,
- int *retlen));
+ const unsigned int len, const char *val,
+ unsigned int *retlen));
/* requires *buf is allocated
modifies *buf, *retlen
effects Inserts the encoding of val into *buf and returns
asn1_error_code asn1_encode_printablestring
PROTOTYPE((asn1buf *buf,
- const int len, const char *val,
+ const unsigned int len, const char *val,
int *retlen));
/* requires *buf is allocated
modifies *buf, *retlen
asn1_error_code asn1_encode_ia5string
PROTOTYPE((asn1buf *buf,
- const int len, const char *val,
+ const unsigned int len, const char *val,
int *retlen));
/* requires *buf is allocated
modifies *buf, *retlen
to expand the buffer. */
asn1_error_code asn1_encode_generaltime
- PROTOTYPE((asn1buf *buf, const time_t val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const time_t val, unsigned int *retlen));
/* requires *buf is allocated
modifies *buf, *retlen
effects Inserts the encoding of val into *buf and returns
asn1_error_code asn1_encode_generalstring
PROTOTYPE((asn1buf *buf,
- const int len, const char *val,
- int *retlen));
+ const unsigned int len, const char *val,
+ unsigned int *retlen));
/* requires *buf is allocated, val has a length of len characters
modifies *buf, *retlen
effects Inserts the encoding of val into *buf and returns
asn1_class * class;
asn1_construction * construction;
asn1_tagnum * tagnum;
- int * retlen;
+ unsigned int * retlen;
int * indef;
{
asn1_error_code retval;
asn1_class *class;
asn1_construction *construction;
asn1_tagnum *tagnum;
- int *retlen;
+ unsigned int *retlen;
{
int indef;
asn1_error_code asn1_get_sequence(buf, retlen, indef)
asn1buf * buf;
- int * retlen;
+ unsigned int * retlen;
int * indef;
{
asn1_error_code retval;
asn1_error_code asn1_get_length(buf, retlen, indef)
asn1buf * buf;
- int * retlen;
+ unsigned int * retlen;
int * indef;
{
asn1_error_code retval;
asn1_class *class,
asn1_construction *construction,
asn1_tagnum *tagnum,
- int *retlen, int *indef));
+ unsigned int *retlen, int *indef));
asn1_error_code asn1_get_tag
PROTOTYPE((asn1buf *buf,
asn1_class *class,
asn1_construction *construction,
asn1_tagnum *tagnum,
- int *retlen));
+ unsigned int *retlen));
/* requires *buf is allocated
effects Decodes the tag in *buf. If class != NULL, returns
the class in *class. Similarly, the construction,
Returns ASN1_OVERRUN if *buf is exhausted during the parse. */
asn1_error_code asn1_get_sequence
- PROTOTYPE((asn1buf *buf, int *retlen, int *indef));
+ PROTOTYPE((asn1buf *buf, unsigned int *retlen, int *indef));
/* requires *buf is allocated
effects Decodes a tag from *buf and returns ASN1_BAD_ID if it
doesn't have a sequence ID. If retlen != NULL, the
Returns ASN1_OVERRUN if *buf is exhausted. */
asn1_error_code asn1_get_length
- PROTOTYPE((asn1buf *buf, int *retlen, int *indef));
+ PROTOTYPE((asn1buf *buf, unsigned int *retlen, int *indef));
/* requires *buf is allocated
effects Decodes the group of length octets at *buf's
current position. If retlen != NULL, the
asn1_class class;\
asn1_construction construction;\
asn1_tagnum tagnum;\
-int length,taglen
+unsigned int length,taglen
#define unused_var(x) if(0) x=0
#define sequence_of(buf)\
int size=0;\
asn1buf seqbuf;\
-int length;\
+unsigned int length;\
int indef;\
retval = asn1_get_sequence(buf,&length,&indef);\
if(retval) return retval;\
krb5_ticket * val;
{
setup();
- int applen;
+ unsigned int applen;
apptag(1);
{ begin_structure();
{ krb5_kvno vno;
#ifdef KRB5_GENEROUS_LR_TYPE
/* If we are only a single byte wide and negative - fill in the
other bits */
- if((val->lr_type & 0xffffff80) == 0x80) val->lr_type |= 0xffffff00;
+ if((val->lr_type & 0xffffff80U) == 0x80) val->lr_type |= 0xffffff00U;
#endif
}
cleanup();
if (tagnum == 1) {
get_lenfield(val->length,val->salt,1,asn1_decode_octetstring);
} else {
- val->length = -1;
+ val->length = KRB5_ETYPE_NO_SALT;
val->salt = 0;
}
end_structure();
sum: cumulative length of the entire encoding */
#define asn1_setup()\
asn1_error_code retval;\
- int length, sum=0
+ unsigned int length, sum=0
/* asn1_addfield -- add a field, or component, to the encoding */
#define asn1_addfield(value,tag,encoder)\
asn1_error_code asn1_encode_ui_4(buf, val, retlen)
asn1buf * buf;
const krb5_ui_4 val;
- int *retlen;
+ unsigned int * retlen;
{
return asn1_encode_unsigned_integer(buf,val,retlen);
}
asn1_error_code asn1_encode_realm(buf, val, retlen)
asn1buf * buf;
const krb5_principal val;
- int * retlen;
+ unsigned int * retlen;
{
if (val == NULL ||
(val->realm.length && val->realm.data == NULL))
asn1_error_code asn1_encode_principal_name(buf, val, retlen)
asn1buf * buf;
const krb5_principal val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int n;
asn1_error_code asn1_encode_kerberos_time(buf, val, retlen)
asn1buf * buf;
const krb5_timestamp val;
- int * retlen;
+ unsigned int * retlen;
{
return asn1_encode_generaltime(buf,val,retlen);
asn1_error_code asn1_encode_host_address(buf, val, retlen)
asn1buf * buf;
const krb5_address * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_host_addresses(buf, val, retlen)
asn1buf * buf;
const krb5_address ** val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
asn1_error_code asn1_encode_encrypted_data(buf, val, retlen)
asn1buf * buf;
const krb5_enc_data * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
return ASN1_MISSING_FIELD;
asn1_addlenfield(val->ciphertext.length,val->ciphertext.data,2,asn1_encode_charstring);
+ /* krb5_kvno should be int */
if(val->kvno)
- asn1_addfield(val->kvno,1,asn1_encode_integer);
+ asn1_addfield((int) val->kvno,1,asn1_encode_integer);
asn1_addfield(val->enctype,0,asn1_encode_integer);
asn1_makeseq();
asn1_error_code asn1_encode_krb5_flags(buf, val, retlen)
asn1buf * buf;
const krb5_flags val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
krb5_flags valcopy = val;
asn1_error_code asn1_encode_ap_options(buf, val, retlen)
asn1buf * buf;
const krb5_flags val;
- int * retlen;
+ unsigned int * retlen;
{
return asn1_encode_krb5_flags(buf,val,retlen);
}
asn1_error_code asn1_encode_ticket_flags(buf, val, retlen)
asn1buf * buf;
const krb5_flags val;
- int * retlen;
+ unsigned int * retlen;
{
return asn1_encode_krb5_flags(buf,val,retlen);
}
asn1_error_code asn1_encode_kdc_options(buf, val, retlen)
asn1buf * buf;
const krb5_flags val;
- int * retlen;
+ unsigned int * retlen;
{
return asn1_encode_krb5_flags(buf,val,retlen);
}
asn1_error_code asn1_encode_authorization_data(buf, val, retlen)
asn1buf * buf;
const krb5_authdata ** val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
asn1_error_code asn1_encode_krb5_authdata_elt(buf, val, retlen)
asn1buf * buf;
const krb5_authdata * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int msg_type;
asn1buf * buf;
const krb5_kdc_rep * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_enc_kdc_rep_part(buf, val, retlen)
asn1buf * buf;
const krb5_enc_kdc_rep_part * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_kdc_req_body(buf, rep, retlen)
asn1buf * buf;
const krb5_kdc_req * rep;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_encryption_key(buf, val, retlen)
asn1buf * buf;
const krb5_keyblock * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_checksum(buf, val, retlen)
asn1buf * buf;
const krb5_checksum * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_transited_encoding(buf, val, retlen)
asn1buf * buf;
const krb5_transited * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_last_req(buf, val, retlen)
asn1buf * buf;
const krb5_last_req_entry ** val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
asn1_error_code asn1_encode_last_req_entry(buf, val, retlen)
asn1buf * buf;
const krb5_last_req_entry * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_sequence_of_pa_data(buf, val, retlen)
asn1buf * buf;
const krb5_pa_data ** val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
asn1_error_code asn1_encode_pa_data(buf, val, retlen)
asn1buf * buf;
const krb5_pa_data * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_sequence_of_ticket(buf, val, retlen)
asn1buf * buf;
const krb5_ticket ** val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
asn1_error_code asn1_encode_ticket(buf, val, retlen)
asn1buf * buf;
const krb5_ticket * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1buf * buf;
const int len;
const krb5_enctype * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
int msg_type;
asn1buf * buf;
const krb5_kdc_req * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_krb_safe_body(buf, val, retlen)
asn1buf * buf;
const krb5_safe * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_sequence_of_krb_cred_info(buf, val, retlen)
asn1buf * buf;
const krb5_cred_info ** val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
asn1_error_code asn1_encode_krb_cred_info(buf, val, retlen)
asn1buf * buf;
const krb5_cred_info * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_etype_info_entry(buf, val, retlen)
asn1buf * buf;
const krb5_etype_info_entry * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
- if(val == NULL || (val->length > 0 && val->salt == NULL))
+ if(val == NULL || (val->length > 0 && val->length != KRB5_ETYPE_NO_SALT &&
+ val->salt == NULL))
return ASN1_MISSING_FIELD;
- if (val->length >= 0)
- asn1_addlenfield((int) val->length,val->salt,1,
+ if (val->length >= 0 && val->length != KRB5_ETYPE_NO_SALT)
+ asn1_addlenfield(val->length,val->salt,1,
asn1_encode_octetstring);
asn1_addfield(val->etype,0,asn1_encode_integer);
asn1_makeseq();
asn1_error_code asn1_encode_etype_info(buf, val, retlen)
asn1buf * buf;
const krb5_etype_info_entry ** val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
asn1_error_code asn1_encode_sequence_of_passwdsequence(buf, val, retlen)
asn1buf * buf;
const passwd_phrase_element ** val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
int i;
asn1_error_code asn1_encode_passwdsequence(buf, val, retlen)
asn1buf * buf;
const passwd_phrase_element * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_addlenfield(val->phrase->length,val->phrase->data,1,asn1_encode_charstring);
asn1_error_code asn1_encode_sam_flags(buf, val, retlen)
asn1buf * buf;
const krb5_flags val;
- int * retlen;
+ unsigned int * retlen;
{
return asn1_encode_krb5_flags(buf,val,retlen);
}
asn1_error_code asn1_encode_sam_challenge(buf, val, retlen)
asn1buf * buf;
const krb5_sam_challenge * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
/* possibly wrong */
asn1_error_code asn1_encode_sam_key(buf, val, retlen)
asn1buf * buf;
const krb5_sam_key * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_addfield(&(val->sam_key),0,asn1_encode_encryption_key);
asn1_error_code asn1_encode_enc_sam_response_enc(buf, val, retlen)
asn1buf * buf;
const krb5_enc_sam_response_enc * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
add_optstring(val->sam_sad,3,asn1_encode_charstring);
asn1_error_code asn1_encode_sam_response(buf, val, retlen)
asn1buf * buf;
const krb5_sam_response * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_predicted_sam_response(buf, val, retlen)
asn1buf * buf;
const krb5_predicted_sam_response * val;
- int * retlen;
+ unsigned int * retlen;
{
asn1_setup();
asn1_error_code asn1_encode_ui_4 PROTOTYPE((asn1buf *buf,
const krb5_ui_4 val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_msgtype PROTOTYPE((asn1buf *buf,
const /*krb5_msgtype*/int val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_realm
- PROTOTYPE((asn1buf *buf, const krb5_principal val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_principal val, unsigned int *retlen));
asn1_error_code asn1_encode_principal_name
- PROTOTYPE((asn1buf *buf, const krb5_principal val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_principal val, unsigned int *retlen));
asn1_error_code asn1_encode_encrypted_data
- PROTOTYPE((asn1buf *buf, const krb5_enc_data *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_enc_data *val, unsigned int *retlen));
asn1_error_code asn1_encode_krb5_flags
- PROTOTYPE((asn1buf *buf, const krb5_flags val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_flags val, unsigned int *retlen));
asn1_error_code asn1_encode_ap_options
- PROTOTYPE((asn1buf *buf, const krb5_flags val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_flags val, unsigned int *retlen));
asn1_error_code asn1_encode_ticket_flags
- PROTOTYPE((asn1buf *buf, const krb5_flags val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_flags val, unsigned int *retlen));
asn1_error_code asn1_encode_kdc_options
- PROTOTYPE((asn1buf *buf, const krb5_flags val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_flags val, unsigned int *retlen));
asn1_error_code asn1_encode_authorization_data
- PROTOTYPE((asn1buf *buf, const krb5_authdata **val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_authdata **val, unsigned int *retlen));
asn1_error_code asn1_encode_krb5_authdata_elt
- PROTOTYPE((asn1buf *buf, const krb5_authdata *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_authdata *val, unsigned int *retlen));
asn1_error_code asn1_encode_kdc_rep
PROTOTYPE((int msg_type, asn1buf *buf, const krb5_kdc_rep *val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_enc_kdc_rep_part
PROTOTYPE((asn1buf *buf, const krb5_enc_kdc_rep_part *val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_ticket
- PROTOTYPE((asn1buf *buf, const krb5_ticket *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_ticket *val, unsigned int *retlen));
asn1_error_code asn1_encode_encryption_key
- PROTOTYPE((asn1buf *buf, const krb5_keyblock *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_keyblock *val, unsigned int *retlen));
asn1_error_code asn1_encode_kerberos_time
- PROTOTYPE((asn1buf *buf, const krb5_timestamp val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_timestamp val, unsigned int *retlen));
asn1_error_code asn1_encode_checksum
- PROTOTYPE((asn1buf *buf, const krb5_checksum *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_checksum *val, unsigned int *retlen));
asn1_error_code asn1_encode_host_address
- PROTOTYPE((asn1buf *buf, const krb5_address *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_address *val, unsigned int *retlen));
asn1_error_code asn1_encode_host_addresses
- PROTOTYPE((asn1buf *buf, const krb5_address **val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_address **val, unsigned int *retlen));
asn1_error_code asn1_encode_transited_encoding
- PROTOTYPE((asn1buf *buf, const krb5_transited *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_transited *val, unsigned int *retlen));
asn1_error_code asn1_encode_last_req
PROTOTYPE((asn1buf *buf, const krb5_last_req_entry **val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_sequence_of_pa_data
- PROTOTYPE((asn1buf *buf, const krb5_pa_data **val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_pa_data **val, unsigned int *retlen));
asn1_error_code asn1_encode_sequence_of_ticket
- PROTOTYPE((asn1buf *buf, const krb5_ticket **val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_ticket **val, unsigned int *retlen));
asn1_error_code asn1_encode_sequence_of_enctype
PROTOTYPE((asn1buf *buf,
const int len, const krb5_enctype *val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_kdc_req
PROTOTYPE((int msg_type,
asn1buf *buf,
const krb5_kdc_req *val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_kdc_req_body
- PROTOTYPE((asn1buf *buf, const krb5_kdc_req *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_kdc_req *val, unsigned int *retlen));
asn1_error_code asn1_encode_krb_safe_body
- PROTOTYPE((asn1buf *buf, const krb5_safe *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_safe *val, unsigned int *retlen));
asn1_error_code asn1_encode_sequence_of_krb_cred_info
- PROTOTYPE((asn1buf *buf, const krb5_cred_info **val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_cred_info **val, unsigned int *retlen));
asn1_error_code asn1_encode_krb_cred_info
- PROTOTYPE((asn1buf *buf, const krb5_cred_info *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_cred_info *val, unsigned int *retlen));
asn1_error_code asn1_encode_last_req_entry
PROTOTYPE((asn1buf *buf, const krb5_last_req_entry *val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_pa_data
- PROTOTYPE((asn1buf *buf, const krb5_pa_data *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_pa_data *val, unsigned int *retlen));
asn1_error_code asn1_encode_alt_method
PROTOTYPE((asn1buf *buf, const krb5_alt_method *val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_etype_info_entry
PROTOTYPE((asn1buf *buf, const krb5_etype_info_entry *val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_etype_info
PROTOTYPE((asn1buf *buf, const krb5_etype_info_entry **val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_passwdsequence
- PROTOTYPE((asn1buf *buf, const passwd_phrase_element *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const passwd_phrase_element *val, unsigned int *retlen));
asn1_error_code asn1_encode_sequence_of_passwdsequence
PROTOTYPE((asn1buf *buf, const passwd_phrase_element **val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_sam_flags
- PROTOTYPE((asn1buf * buf, const krb5_flags val, int *retlen));
+ PROTOTYPE((asn1buf * buf, const krb5_flags val, unsigned int *retlen));
asn1_error_code asn1_encode_sam_challenge
- PROTOTYPE((asn1buf *buf, const krb5_sam_challenge * val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_sam_challenge * val, unsigned int *retlen));
asn1_error_code asn1_encode_sam_key
- PROTOTYPE((asn1buf *buf, const krb5_sam_key *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_sam_key *val, unsigned int *retlen));
asn1_error_code asn1_encode_enc_sam_response_enc
PROTOTYPE((asn1buf *buf, const krb5_enc_sam_response_enc *val,
- int *retlen));
+ unsigned int *retlen));
asn1_error_code asn1_encode_sam_response
- PROTOTYPE((asn1buf *buf, const krb5_sam_response *val, int *retlen));
+ PROTOTYPE((asn1buf *buf, const krb5_sam_response *val, unsigned int *retlen));
asn1_error_code asn1_encode_predicted_sam_response
PROTOTYPE((asn1buf *buf, const krb5_predicted_sam_response *val,
- int *retlen));
+ unsigned int *retlen));
#endif
asn1buf * buf;
const asn1_class class;
const asn1_tagnum tagnum;
- const int in_len;
- int * retlen;
+ const unsigned int in_len;
+ unsigned int * retlen;
{
return asn1_make_tag(buf,class,CONSTRUCTED,tagnum,in_len,retlen);
}
+
asn1_error_code asn1_make_tag(buf, class, construction, tagnum, in_len, retlen)
asn1buf * buf;
const asn1_class class;
const asn1_construction construction;
const asn1_tagnum tagnum;
- const int in_len;
- int * retlen;
+ const unsigned int in_len;
+ unsigned int * retlen;
{
asn1_error_code retval;
- int sumlen=0, length;
+ unsigned int sumlen=0, length;
if(tagnum > ASN1_TAGNUM_MAX) return ASN1_OVERFLOW;
asn1_error_code asn1_make_length(buf, in_len, retlen)
asn1buf * buf;
- const int in_len;
- int * retlen;
+ const unsigned int in_len;
+ unsigned int * retlen;
{
asn1_error_code retval;
const asn1_class class;
const asn1_construction construction;
const asn1_tagnum tagnum;
- int * retlen;
+ unsigned int * retlen;
{
asn1_error_code retval;
asn1_error_code asn1_make_sequence(buf, seq_len, retlen)
asn1buf * buf;
- const int seq_len;
- int * retlen;
+ const unsigned int seq_len;
+ unsigned int * retlen;
{
asn1_error_code retval;
- int len, sum=0;
+ unsigned int len, sum=0;
retval = asn1_make_length(buf,seq_len,&len);
if(retval) return retval;
asn1_error_code asn1_make_set(buf, set_len, retlen)
asn1buf * buf;
- const int set_len;
- int * retlen;
+ const unsigned int set_len;
+ unsigned int * retlen;
{
asn1_error_code retval;
- int len, sum=0;
+ unsigned int len, sum=0;
retval = asn1_make_length(buf,set_len,&len);
if(retval) return retval;
asn1_error_code asn1_make_string(buf, length, string, retlen)
asn1buf * buf;
- const int length;
+ const unsigned int length;
const char * string;
int * retlen;
{
PROTOTYPE((asn1buf *buf,
const asn1_class class,
const asn1_tagnum tagnum,
- const int in_len,
- int *retlen));
+ const unsigned int in_len,
+ unsigned int *retlen));
/* requires *buf is allocated, in_len is the length of an ASN.1 encoding
which has just been inserted in *buf
modifies *buf, *retlen
PROTOTYPE((asn1buf *buf, const asn1_class class,
const asn1_construction construction,
const asn1_tagnum tagnum,
- const int in_len,
- int *retlen));
+ const unsigned int in_len,
+ unsigned int *retlen));
/* requires *buf is allocated, in_len is the length of an ASN.1 encoding
which has just been inserted in *buf
modifies *buf, *retlen
the implementation. */
asn1_error_code asn1_make_sequence
- PROTOTYPE((asn1buf *buf, const int seq_len, int *len));
+ PROTOTYPE((asn1buf *buf, const unsigned int seq_len, unsigned int *len));
/* requires *buf is allocated, seq_len is the length of a series of
sequence components which have just been inserted in *buf
modifies *buf, *retlen
Returns ENOMEM if memory runs out. */
asn1_error_code asn1_make_set
- PROTOTYPE((asn1buf *buf, const int set_len, int *retlen));
+ PROTOTYPE((asn1buf *buf, const unsigned int set_len,
+ unsigned int *retlen));
/* requires *buf is allocated, seq_len is the length of a series of
sequence components which have just been inserted in *buf
modifies *buf, *retlen
asn1_error_code asn1_make_string
PROTOTYPE((asn1buf *buf,
- const int len, const char *string,
+ const unsigned int len, const char *string,
int *retlen));
/* requires *buf is allocated, len is the length of *string
effects Inserts the encoding of *string
/* "helper" procedure for asn1_make_tag */
asn1_error_code asn1_make_length
- PROTOTYPE((asn1buf *buf, const int in_len, int *retlen));
+ PROTOTYPE((asn1buf *buf, const unsigned int in_len,
+ unsigned int *retlen));
/* requires *buf is allocated, in_len is the length of an ASN.1 encoding
which has just been inserted in *buf
modifies *buf, *retlen
const asn1_class class,
const asn1_construction construction,
const asn1_tagnum tagnum,
- int *retlen));
+ unsigned int *retlen));
/* requires *buf is allocated, class and tagnum are appropriate for
the ASN.1 encoding which has just been inserted in *buf
modifies *buf, *retlen
asn1_error_code asn1buf_imbed(subbuf, buf, length, indef)
asn1buf * subbuf;
const asn1buf * buf;
- const int length;
+ const unsigned int length;
const int indef;
{
subbuf->base = subbuf->next = buf->next;
asn1buf * buf;
asn1buf * subbuf;
const asn1_tagnum lasttag;
- const int length;
+ const unsigned int length;
{
asn1_error_code retval;
asn1_class class;
asn1_construction construction;
asn1_tagnum tagnum;
- int taglen;
+ unsigned int taglen;
int nestlevel;
nestlevel = 1;
while (nestlevel > 0) {
retval = asn1_get_tag(buf, &class, &construction, &tagnum, &taglen);
if (retval) return retval;
+ buf->next += taglen;
if (construction == CONSTRUCTED && taglen == 0)
nestlevel++;
if (tagnum == ASN1_TAGNUM_CEILING)
{
asn1_error_code retval;
- retval = asn1buf_ensure_space(buf,1);
+ retval = asn1buf_ensure_space(buf,1U);
if(retval) return retval;
*(buf->next) = (char)o;
(buf->next)++;
asn1_error_code asn1buf_insert_octetstring(buf, len, s)
asn1buf * buf;
- const int len;
+ const unsigned int len;
const krb5_octet * s;
{
asn1_error_code retval;
asn1_error_code asn1buf_insert_charstring(buf, len, s)
asn1buf * buf;
- const int len;
+ const unsigned int len;
const char * s;
{
asn1_error_code retval;
asn1_error_code asn1buf_remove_octetstring(buf, len, s)
asn1buf * buf;
- const int len;
+ const unsigned int len;
asn1_octet ** s;
{
int i;
asn1_error_code asn1buf_remove_charstring(buf, len, s)
asn1buf * buf;
- const int len;
+ const unsigned int len;
char ** s;
{
int i;
if(*s == NULL) return ENOMEM;
strcpy(*s,"<EMPTY>");
}else{
- int length = asn1buf_len(buf);
+ unsigned int length = asn1buf_len(buf);
int i;
*s = calloc(length+1, sizeof(char));
if(*s == NULL) return ENOMEM;
strcpy(*s,"<EMPTY>");
}else{
- int length = asn1buf_len(buf);
+ unsigned int length = asn1buf_len(buf);
int i;
*s = malloc(3*length);
#undef asn1buf_ensure_space
asn1_error_code asn1buf_ensure_space(buf, amount)
asn1buf * buf;
- const int amount;
+ const unsigned int amount;
{
- int free = asn1buf_free(buf);
- if(free < amount){
- asn1_error_code retval = asn1buf_expand(buf, amount-free);
+ int avail = asn1buf_free(buf);
+ if(avail < amount){
+ asn1_error_code retval = asn1buf_expand(buf, amount-avail);
if(retval) return retval;
}
return 0;
asn1_error_code asn1buf_expand(buf, inc)
asn1buf * buf;
- int inc;
+ unsigned int inc;
{
#define STANDARD_INCREMENT 200
int next_offset = buf->next - buf->base;
asn1_error_code asn1buf_ensure_space
- PROTOTYPE((asn1buf *buf, const int amount));
+ PROTOTYPE((asn1buf *buf, const unsigned int amount));
/* requires *buf is allocated
modifies *buf
effects If buf has less than amount octets of free space, then it is
asn1_error_code asn1buf_expand
- PROTOTYPE((asn1buf *buf, int inc));
+ PROTOTYPE((asn1buf *buf, unsigned int inc));
/* requires *buf is allocated
modifies *buf
effects Expands *buf by allocating space for inc more octets.
Returns ASN1_MISSING_FIELD if code is empty. */
asn1_error_code asn1buf_imbed
- PROTOTYPE((asn1buf *subbuf, const asn1buf *buf, const int length,
+ PROTOTYPE((asn1buf *subbuf, const asn1buf *buf,
+ const unsigned int length,
const int indef));
/* requires *subbuf and *buf are allocated
effects *subbuf becomes a sub-buffer of *buf. *subbuf begins
asn1_error_code asn1buf_sync
PROTOTYPE((asn1buf *buf, asn1buf *subbuf, const asn1_tagnum lasttag,
- const int length));
+ const unsigned int length));
/* requires *subbuf is a sub-buffer of *buf, as created by asn1buf_imbed.
lasttag is a pointer to the last tagnumber read.
effects Synchronizes *buf's current position to match that of *subbuf. */
{
asn1_error_code retval;
- retval = asn1buf_ensure_space(buf,1);
+ retval = asn1buf_ensure_space(buf,1U);
if(retval) return retval;
*(buf->next) = (char)o;
(buf->next)++;
#endif
asn1_error_code asn1buf_insert_octetstring
- PROTOTYPE((asn1buf *buf, const int len, const asn1_octet *s));
+ PROTOTYPE((asn1buf *buf, const unsigned int len, const asn1_octet *s));
/* requires *buf is allocated
modifies *buf
effects Inserts the contents of s (an octet array of length len)
Returns ENOMEM if memory is exhausted. */
asn1_error_code asn1buf_insert_charstring
- PROTOTYPE((asn1buf *buf, const int len, const char *s));
+ PROTOTYPE((asn1buf *buf, const unsigned int len, const char *s));
/* requires *buf is allocated
modifies *buf
effects Inserts the contents of s (a character array of length len)
: ((*(o) = (asn1_octet)(*(((buf)->next)++))),0))
asn1_error_code asn1buf_remove_octetstring
- PROTOTYPE((asn1buf *buf, const int len, asn1_octet **s));
+ PROTOTYPE((asn1buf *buf, const unsigned int len, asn1_octet **s));
/* requires *buf is allocated
effects Removes the next len octets of *buf and returns them in **s.
Returns ASN1_OVERRUN if there are fewer than len unread octets
Returns ENOMEM if *s could not be allocated. */
asn1_error_code asn1buf_remove_charstring
- PROTOTYPE((asn1buf *buf, const int len,
+ PROTOTYPE((asn1buf *buf, const unsigned int len,
char **s));
/* requires *buf is allocated
effects Removes the next len octets of *buf and returns them in **s.
setup_no_tagnum()
#define setup()\
-int length;\
+unsigned int length;\
setup_no_length()
/* helper macros for cleanup */
#define krb5_setup()\
asn1_error_code retval;\
asn1buf *buf=NULL;\
- int length, sum=0;\
+ unsigned int length, sum=0;\
\
if(rep == NULL) return ASN1_MISSING_FIELD;\
\
{
asn1_error_code retval;
asn1buf *buf=NULL;
- int length, sum=0;
+ unsigned int length, sum=0;
if(rep == NULL) return ASN1_MISSING_FIELD;
{
asn1_error_code retval;
asn1buf *buf=NULL;
- int length;
+ unsigned int length;
if(rep == NULL) return ASN1_MISSING_FIELD;
/* method-data[1] OctetString OPTIONAL */
if(rep->data != NULL && rep->length > 0)
- krb5_addlenfield((int) rep->length,rep->data,1,asn1_encode_octetstring);
+ krb5_addlenfield(rep->length,rep->data,1,asn1_encode_octetstring);
/* method-type[0] Integer */
krb5_addfield(rep->method,0,asn1_encode_integer);