aboutsummaryrefslogtreecommitdiff
path: root/src/lib/krb5/asn.1/asn1_get.c
AgeCommit message (Collapse)AuthorFilesLines
2009-11-05make mark-cstyle; make reindentTom Yu1-1/+1
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23133 dc483132-0cff-0310-8789-dd5450dbe970
2009-10-31In lib/krb5/asn.1, ensure that function definition headers haveGreg Hudson1-1/+2
function names at the beginnings of lines. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23106 dc483132-0cff-0310-8789-dd5450dbe970
2008-09-09Untabify; trim trailing whitespace; add emacs local variables to avoid tabsKen Raeburn1-57/+58
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20711 dc483132-0cff-0310-8789-dd5450dbe970
2008-09-05Whitespace changes, mostly horizontal, for consistency with currentKen Raeburn1-3/+3
style: indentation levels, spacing around if/else/for/while and braces. Still plenty of inconsistency with current coding standards, especially for when line breaks are to be used. Didn't touch multi-line macro definitions, or .h function declarations. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20707 dc483132-0cff-0310-8789-dd5450dbe970
2005-10-03 * asn1_get.c (asn1_get_tag_2): Patch from Zhihong Zhang to properlyTom Yu1-1/+1
handle tag numbers >= 30. ticket: 2542 target_version: 1.4.3 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17400 dc483132-0cff-0310-8789-dd5450dbe970
2003-03-12Rewrite asn1_get_tag interface to use a structure pointer rather than severalKen Raeburn1-107/+76
pointer variables for the returned data. Use the structure in the caller when straightforward; in cases where macros use different but overlapping sets of automatic scalar variables in one file, copy the values out of the structures for now, until they can be analyzed more carefully. * asn1_get.c (asn1_get_tag): Deleted. (asn1_get_tag_2): Renamed from asn1_get_tag_indef, now uses a pointer to taginfo rather than a bunch of pointer args. (asn1_get_id, asn1_get_length): Folded into asn1_get_tag_2. (asn1_get_sequence): Call asn1_get_tag_2. * asn1_get.h (taginfo): New structure. (asn1_get_tag_indef, asn1_get_tag, asn1_get_id, asn1_get_length): Declarations deleted. (asn1_get_tag_2): Declare. * asn1_decode.c (setup): Declare only a taginfo variable. (asn1class, construction, tagnum, length): New macros. (tag): Call asn1_get_tag_2. * asn1_k_decode.c (next_tag, get_eoc, apptag, end_sequence_of, end_sequence_of_no_tagvars, asn1_decode_krb5_flags): Call asn1_get_tag_2; if no error, copy out values into scalar variables. (asn1_decode_ticket): Call asn1_get_tag_2. * asn1buf.c (asn1buf_skiptail): Call asn1_get_tag_2. * krb5_decode.c (check_apptag, next_tag, get_eoc): Call asn1_get_tag_2; if no error, copy out values into scalar variables. (decode_krb5_enc_kdc_rep_part): Call asn1_get_tag_2. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15274 dc483132-0cff-0310-8789-dd5450dbe970
2002-10-08ASN.1 code passes uninitialized values aroundTom Yu1-2/+10
* asn1_get.c (asn1_get_tag_indef): Stomp on asn1class, construction, retlen, and indef, even if we've hit the end of the buffer, to avoid passing uninitialized values around. * asn1_k_decode.c: Reformat somewhat and add comments to demystify things a little. (opt_field): Fix to explicitly check for end of subbuf before verifying the pre-fetched tag, which may have been stomped on by asn1_get_tag_indef() encountering end-of-buffer. * krb5_decode.c (opt_field, opt_lenfield): Fix to explicitly check for end of subbuf before verifying the pre-fetched tag, which may have been stomped on by asn1_get_tag_indef() encountering end-of-buffer. ticket: new target_version: 1.3 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14913 dc483132-0cff-0310-8789-dd5450dbe970
2002-09-03Use prototype style definitions for functions. Avoid variable name "class"Ken Raeburn1-33/+19
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14810 dc483132-0cff-0310-8789-dd5450dbe970
2002-06-24 * asn1_get.c (asn1_get_length): Check for negative length.Tom Yu1-0/+2
[pullup from 1-2-2-branch] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14560 dc483132-0cff-0310-8789-dd5450dbe970
2000-10-26 * asn1buf.c (asn1buf_sync): Add new arguments to include the fullTom Yu1-7/+3
complement of data about a prefetched tag, as well as to indicate whether the prefetched tag or the surrounding sequence is of an indefinite length. (asn1buf_skiptail): Add new arguments to indicate whether the prefetched tag is indefinite, as well as its length. This facilitates proper skipping of trailing garbage. (asn1buf_remains): Add new argument to indicate whether the surrounding encoding is indefinite. Don't advance buf->next if an EOC encoding is detected; the caller will do that. * asn1buf.h: Update prototypes. * asn1_get.c (asn1_get_tag_indef): Don't treat EOC encoding as special anymore, since previous behavior was overloading the tag number in a bad way. Also, report a MISMATCH_INDEF error if the tag encoding is for the forbidden primitive constructed encoding. * asn1_k_decode.c (next_tag): Call get_tag_indef() in order to get information about whether the length is indefinite. Don't check the tag class and construction explicitly. (get_eoc): New macro to get a tag and check if it is an EOC encoding. (get_field, opt_field): Move the check for the tag class and construction to here. (get_field_body, get_lenfield_body): Call get_eoc() instead of next_tag() if we are decoding a constructed indefinite encoding. (begin_structure): Use a different variable to indicate whether the sequence is indefinite as opposed to whether an individual field is indefinite. (end_structure): Update to new calling convention of asn1buf_sync(). (sequence_of): Rewrite significantly. (sequence_of_common): Move the bulk of previous sequence_of() macro to here. Does not declare some variables that sequence_of() declares. (sequence_of_no_tagvars): Similar to sequence_of() macro but declares different variables for the purpose of prefetching the final tag. (end_sequence_of_no_tagvars): Similar to end_sequence_of() macro but uses variables declared by the sequence_of_no_tagvars() macro to prefetch the final tag. (asn1_decode_principal_name): Update for new asn1buf_remains() calling convention. Call sequence_of_no_tagvars(), etc. instead of sequence_of(), etc. in order to not declare shadowing block-local variables. (decode_array_body): Update for new asn1buf_remains() calling convention. (asn1_decode_sequence_of_enctype): Update for new asn1buf_remains() calling convention. * krb5_decode.c (next_tag): Call get_tag_indef() in order to get information about whether the length is indefinite. Don't check the tag class and construction explicitly. (get_eoc): New macro to get a tag and check if it is an EOC encoding. (get_field, opt_field): Move the check for the tag class and construction to here. (get_field_body, get_lenfield_body): Call get_eoc() instead of next_tag() if we are decoding a constructed indefinite encoding. (begin_structure): Use a different variable to indicate whether the sequence is indefinite as opposed to whether an individual field is indefinite. (end_structure): Update to new calling convention of asn1buf_sync(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12816 dc483132-0cff-0310-8789-dd5450dbe970
2000-10-17 * asn1buf.h: Lengths are now unsigned int forEzra Peisach1-4/+4
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(), git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12779 dc483132-0cff-0310-8789-dd5450dbe970
2000-09-27 * asn1_get.c (asn1_get_tag_indef): Fix to not deref random garbageTom Yu1-1/+2
while checking for EOC encoding. At least the indefinite decoding breaks consistently now. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12684 dc483132-0cff-0310-8789-dd5450dbe970
2000-06-29asn1_get.c (asn1_get_tag): Remove unused variableEzra Peisach1-1/+0
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12452 dc483132-0cff-0310-8789-dd5450dbe970
1999-11-01 * krb5_decode.c (begin_structure): Update to deal with indefiniteTom Yu1-5/+27
encodings better; also call asn1_get_sequence(). * asn1_k_decode.c (sequence_of): Update to deal with indefinite encodings better. (begin_structure): Update to deal with indefinite encodings better; also call asn1_get_sequence(). * asn1_get.h: Update prototypes for asn1_get_tag_indef(), asn1_get_tag(), asn1_get_sequence(), asn1_get_length(). * asn1_get.c (asn1_get_tag_indef): New function; get tag info, lengths, etc. as well as flag indicating whether the length is indefinite. (asn1_get_tag): Modify to just call asn1_get_tag_indef(). (asn1_get_sequence): Call asn1_get_tag_indef() in order to determine whether encoding is indefinite length. (asn1_get_length): Add "indef" arg to indicate whether an encoding has an indefinite length. * asn1buf.h: Update asn1buf_imbed() prototype. * asn1buf.c (asn1buf_imbed): Add "indef" arg so that we don't treat a definite zero-length encoding as an indefinite encoding. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11890 dc483132-0cff-0310-8789-dd5450dbe970
1999-09-24copyright notice updates from 1.1 branchKen Raeburn1-1/+4
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11853 dc483132-0cff-0310-8789-dd5450dbe970
1995-06-17Added final change to allow for ASN.1 indefinite encoding; needed forTheodore Tso1-0/+6
DCE compatibility. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6088 dc483132-0cff-0310-8789-dd5450dbe970
1995-04-14Windows global stuff:Keith Vetter1-4/+4
o removed INTERFACE from non-api functions o add FAR to pointers visible to the world o made the tests for __STDC__ also check for _WINDOWS o creates GSSAPI.DLL & GSSAPI.LIB as per spec. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5354 dc483132-0cff-0310-8789-dd5450dbe970
1995-04-13asn1_k_decode.c (setup, next_tag, apptag, get_field_body,Theodore Tso1-3/+4
get_lenfield_body, asn1_decode_ticket): Use the taglength to determine whether or not the indefinite encoding was used, and if so skip over the termination flag bytes in the ASN.1 stream. asn1buf.c (asn1buf_imbed, asn1buf_remains): Make changes to allow for indefinite encodings. asn1buf_remains() is now only used for decoding structures and arrays (i.e., asn.1 constructs which terminate indefinite encodings with two zero octets. [ Note these fixes to support indefinite encoding aren't terribly clean; some invalid encodings may be accepted when they should not be. This should be looked at in more detail later.] asn1_get.c (asn1_get_tag): Inline original asn1buf_remains() code, since asn1_get_tag doesn't use asn1buf_remains in the context of a structure or an array. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5353 dc483132-0cff-0310-8789-dd5450dbe970
1995-02-22Converted krb5/des425 and krb5/asn.1 to the PCKeith Vetter1-4/+4
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4970 dc483132-0cff-0310-8789-dd5450dbe970
1995-01-13Removed all references to DECLARG and OLDDECLARGChris Provenzano1-26/+17
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4809 dc483132-0cff-0310-8789-dd5450dbe970
1994-07-14Added MIT Copyright noticesTheodore Tso1-0/+23
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3973 dc483132-0cff-0310-8789-dd5450dbe970
1994-06-29folding in Harry's changesTom Yu1-0/+111
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3924 dc483132-0cff-0310-8789-dd5450dbe970