summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/asn.1/asn1_decode.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove unneeded ASN.1 codeGreg Hudson2012-02-121-314/+0
| | | | | | | | | | Get rid of a whole bunch of ASN.1 decoder infrastructure now that we're using the data-driven decoder for everything. Define taginfo in asn1_encode.h since asn1_get.h is going away. Rewrite split_der() to use get_tag() since it still had an unintended dependency on the previous generation of decoder infrastructure. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25695 dc483132-0cff-0310-8789-dd5450dbe970
* Make dh_key_info encoder and decoder symmetricGreg Hudson2012-01-091-0/+26
| | | | | | | | | | | | The dh_key_info encoder expects subjectPublicKey to contain the contents of a bit string, but the decoder outputs the DER encoding of the bit string including tag. The PKINIT client code expects this, so everything works, but the encoder and decoder should be symmetric. Change the decoder to process the bit string (adding a bit string decoding primitive) and modify the PKINIT client code to expect only the bit string contents. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25626 dc483132-0cff-0310-8789-dd5450dbe970
* Stop using krb5_octet_dataGreg Hudson2011-12-211-2/+2
| | | | | | | | For consistency with the rest of the code base, make PKINIT use krb5_data as a pointer/length container. Leave krb5_octet_data and krb5_free_octet_data behind for API compatibility. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25600 dc483132-0cff-0310-8789-dd5450dbe970
* Adjust most C source files to match the new standards for copyrightGreg Hudson2011-03-091-2/+1
| | | | | | and license comments. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24695 dc483132-0cff-0310-8789-dd5450dbe970
* make mark-cstyle; make reindentTom Yu2009-11-051-11/+11
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23133 dc483132-0cff-0310-8789-dd5450dbe970
* In lib/krb5/asn.1, ensure that function definition headers haveGreg Hudson2009-10-311-12/+24
| | | | | | function names at the beginnings of lines. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23106 dc483132-0cff-0310-8789-dd5450dbe970
* CVE-2009-0846 asn1_decode_generaltime can free uninitialized pointerTom Yu2009-04-071-0/+1
| | | | | | | | | | | The asn1_decode_generaltime() function can free an uninitialized pointer if asn1buf_remove_charstring() fails. ticket: 6445 tags: pullup target_version: 1.7 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22176 dc483132-0cff-0310-8789-dd5450dbe970
* fix trailing whitespaceTom Yu2009-01-221-3/+2
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21779 dc483132-0cff-0310-8789-dd5450dbe970
* Merge mskrb-integ onto trunkSam Hartman2009-01-031-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | The mskrb-integ branch includes support for the following projects: Projects/Aliases * Projects/PAC and principal APIs * Projects/AEAD encryption API * Projects/GSSAPI DCE * Projects/RFC 3244 In addition, it includes support for enctype negotiation, and a variety of GSS-API extensions. In the KDC it includes support for protocol transition, constrained delegation and a new authorization data interface. The old authorization data interface is also supported. This commit merges the mskrb-integ branch on to the trunk. Additional review and testing is required. Merge commit 'mskrb-integ' into trunk ticket: new status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21690 dc483132-0cff-0310-8789-dd5450dbe970
* Untabify; trim trailing whitespace; add emacs local variables to avoid tabsKen Raeburn2008-09-091-49/+50
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20711 dc483132-0cff-0310-8789-dd5450dbe970
* Whitespace changes, mostly horizontal, for consistency with currentKen Raeburn2008-09-051-135/+135
| | | | | | | | | 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
* Based on patch from lxs, with some changes:Ken Raeburn2008-08-271-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add several new gcc warning flags, used in the KfM build process. Put declarations before code. Fix a bunch of signed/unsigned type mixes, mostly by changing variable types to unsigned int. Fix constness in handling name of default ccache name. Make sure functions get declared with prototypes: krb5int_pthread_loaded krb5int_gmt_mktime krb5int_aes_encrypt krb5int_aes_decrypt gssint_mecherrmap_init gssint_mecherramp_get. Don't shadow global names: stat accept index open encrypt. Fix variable shadowing in LDAP ASN.1 support. Don't define unused krb5int_local_addresses. Don't export internal krb5_change_set_password. Fix error return indications from gssint_oid_to_mech. Create and use k5-gmt_mktime.h to provide one global declaration of krb5int_gmt_mktime, needed before we've generated krb5.h on some platforms. Not incorporated from initial patch: const changes in function signatures. ticket: 6096 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20697 dc483132-0cff-0310-8789-dd5450dbe970
* Move gmt_mktime.c from lib/krb5/os to util/support, and rename the function.Ken Raeburn2006-04-141-2/+2
| | | | | | | Stop exporting gmt_mktime from libkrb5, and export krb5int_gmt_mktime from libkrb5support. Updated the one caller, asn1_decode.c. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17921 dc483132-0cff-0310-8789-dd5450dbe970
* Memory leak in asn1_decode_generaltimeEzra Peisach2004-12-281-0/+1
| | | | | | | | | | | | | When decoding a kerberos time, if the asn1 time is 19700101000000Z (i.e. time_t of 0) - 15 bytes of memory are lost. * asn1_decode.c (asn1_decode_generaltime): Fix memory leak when time sent is "19700101000000Z". ticket: new tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16983 dc483132-0cff-0310-8789-dd5450dbe970
* Handle the somewhat common fixed case of time value 0 more efficientlyKen Raeburn2004-04-241-0/+5
| | | | | | | | | * asn1_decode.c (asn1_decode_generaltime): If the input string is the magic UNIX time zero, bypass all the arithmetic and return 0. * asn1_encode.c (asn1_encode_generaltime): If the input time value is the UNIX epoch, use a hardcoded string instead of doing the math. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16272 dc483132-0cff-0310-8789-dd5450dbe970
* Sequence numbers are now unsigned. Implement lenient parser forTom Yu2003-05-181-1/+45
| | | | | | | | | | | sequence numbers which folds received negative sequence numbers into positive unsigned numbers. Constrain the space of initial sequence numbers to facilitate backwards compatibility. ticket: 1262 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15457 dc483132-0cff-0310-8789-dd5450dbe970
* Rewrite asn1_get_tag interface to use a structure pointer rather than severalKen Raeburn2003-03-121-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * asn1_encode.h (asn1_encode_oid):Tom Yu2002-11-051-0/+10
| | | | | | | | | | | | | * asn1_encode.c (asn1_encode_oid): New function. * asn1_decode.h (asn1_decode_oid): * asn1_decode.c (asn1_decode_oid): New function. ticket: 1223 target_version: 1.3 component: krb5-libs git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14971 dc483132-0cff-0310-8789-dd5450dbe970
* Use prototype style definitions for functions. Avoid variable name "class"Ken Raeburn2002-09-031-34/+12
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14810 dc483132-0cff-0310-8789-dd5450dbe970
* Don't conditionalize prototypes; delete macros supporting it. (Maybe overdone;Ken Raeburn2001-10-101-1/+1
| | | | | | don't worry about restoring them when importing new versions of code.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13792 dc483132-0cff-0310-8789-dd5450dbe970
* * asn1buf.h: Lengths are now unsigned int forEzra Peisach2000-10-171-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
* * asn1_decode.c (asn1_decode_integer): Initialize "n", to keep gcc happyKen Raeburn1999-10-221-1/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11875 dc483132-0cff-0310-8789-dd5450dbe970
* copyright notice updates from 1.1 branchKen Raeburn1999-09-241-1/+4
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11853 dc483132-0cff-0310-8789-dd5450dbe970
* * asn1_decode.c (asn1_decode_integer): Fix to deal with overflowsTom Yu1999-07-111-8/+23
| | | | | | | | and negative integers. (asn1_decode_unsigned_integer): Fix to deal with overflows and to return errors on encountering negative integers. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11558 dc483132-0cff-0310-8789-dd5450dbe970
* Rearrange #include files so that krb5.h gets included first, so thatTheodore Tso1995-05-231-1/+1
| | | | | | | the debugging information can be more efficiently collapsed since the type numbers will be the same. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5853 dc483132-0cff-0310-8789-dd5450dbe970
* Windows global stuff:Keith Vetter1995-04-141-9/+9
| | | | | | | | | 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
* * asn1_decode.c: move declaration of gmt_mktime() outside ofTom Yu1995-03-251-1/+2
| | | | | | | asn1_decode_generaltime() so that compilers like Ultrix cc that don't support prototypes within function bodies don't break git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5246 dc483132-0cff-0310-8789-dd5450dbe970
* Several small 16 vs 32 bit castsKeith Vetter1995-03-021-0/+1
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5056 dc483132-0cff-0310-8789-dd5450dbe970
* Converted krb5/des425 and krb5/asn.1 to the PCKeith Vetter1995-02-221-9/+9
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4970 dc483132-0cff-0310-8789-dd5450dbe970
* Removed all references to DECLARG and OLDDECLARGChris Provenzano1995-01-131-44/+31
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4809 dc483132-0cff-0310-8789-dd5450dbe970
* Fix memory leak in decode timestamp returnTheodore Tso1994-09-211-1/+5
| | | | | | Initialize return variable in decode_krb5_authdata() git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4327 dc483132-0cff-0310-8789-dd5450dbe970
* fix time includesMark Eichin1994-08-171-2/+6
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4166 dc483132-0cff-0310-8789-dd5450dbe970
* Added MIT Copyright noticesTheodore Tso1994-07-141-0/+23
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3973 dc483132-0cff-0310-8789-dd5450dbe970
* Get rid of strftime (since it breaks when used this way, at least underMark Eichin1994-07-061-25/+2
| | | | | | | | | | Solaris, and many systems don't even have it) in generaltime encoder. Use gmt_mktime in generaltime decoder. With these changes, kinit works again under Solaris 2. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3953 dc483132-0cff-0310-8789-dd5450dbe970
* revert portability change temporarilyMark Eichin1994-07-021-0/+7
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3943 dc483132-0cff-0310-8789-dd5450dbe970
* make gmt_offset portable, make decls and defns consistent..Mark Eichin1994-07-011-3/+21
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3940 dc483132-0cff-0310-8789-dd5450dbe970
* folding in Harry's changesTom Yu1994-06-291-0/+181
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3924 dc483132-0cff-0310-8789-dd5450dbe970