summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5
Commit message (Collapse)AuthorAgeFilesLines
...
* Redesign ASN.1 encoder engine, removing field_infoGreg Hudson2012-01-244-1718/+1373
| | | | | | | | | | | | | | | | | | | | | Replace the "field" half of the ASN.1 encoder machinery with several new struct atype_info types (offset, counted, and int_immediate) and a new counted_type machinery used exclusively for object/integer pairs. This change eliminates the two-way entanglement between atypes and fields, and makes the encoder more independent of RFC 4120 ASN.1 conventions. Defining sequences with the preprocessor macros is now slightly more cumbersome; we need to define a type for each field and then string them together with an array of struct atype_info *. But it's not so bad, and hopefully we can auto-generate some of this soon. *_optional functions now return a bitmask of sequence field offsets not present in the C type. This will need some more attention before we add decoding support to the engine, since it means sequence fields no longer know whether they are optional or not. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25657 dc483132-0cff-0310-8789-dd5450dbe970
* Simplify integer loading in ASN.1 encodingGreg Hudson2012-01-132-41/+34
| | | | | | | Instead of defining an auxiliary load function for each integer type, just use its size and signedness to decide how to load it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25651 dc483132-0cff-0310-8789-dd5450dbe970
* Add PKINIT decoder testsGreg Hudson2012-01-131-0/+9
| | | | | | | | | | | Add tests to krb5_decode_test.c for PKINIT types. Where the decoders do not match the encoders, include comments and hand-generated encodings which work with the decoder. Add a comment to asn1_k_encode.c documenting inconsistencies between the draft 9 PA-PK-AS-REQ spec and our encoder results. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25650 dc483132-0cff-0310-8789-dd5450dbe970
* Fix spurious clock skew caused by gak_fct delayGreg Hudson2012-01-111-5/+4
| | | | | | | | | | | | | | | | | | | In get_in_tkt.c, a time offset is computed between the KDC's auth_time and the current system time after the reply is decrypted. Time may have elapsed between these events because of a gak_fct invocation which blocks on user input. The resulting spurious time offset can cause subsequent TGS-REQs to fail and can also cause the end time of the next AS request to be in the past (issue #889) in cases where the old ccache is opened to find the default principal. Use the system time, without offset, for the request time of an AS request, for more predictable kinit behavior. Use this request time, rather than the current time, when computing the clock skew after the reply is decrypted. ticket: 7063 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25644 dc483132-0cff-0310-8789-dd5450dbe970
* Use DEFTAGGEDTYPE for FAST choice typesGreg Hudson2012-01-101-5/+10
| | | | | | | | | | | | | pa_fx_fast_request and pa_fx_fast_reply are defined in RFC 6113 as extensible choice types with only one choice, which means they encode as another type with a [0] tag wrapper. Use DEFTAGGEDTYPE to add this wrapper instead of DEFFIELDTYPE/FIELDOF_ENCODEAS, and add a comment describing why. After this change, all uses of DEFFIELDYPE are for dataptr/lenptr types or just simple offset transformations on the base pointer. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25635 dc483132-0cff-0310-8789-dd5450dbe970
* Simplify asn1_decode_kdc_dh_key_infoGreg Hudson2012-01-101-6/+2
| | | | | | | | | Due to some lingering confusion, the last commit changing asn1_decode_kdc_dh_key_info was correct but overly complicated (and contained an incorrect comment). Change it to just use get_lenfield for subjectPublicKey. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25634 dc483132-0cff-0310-8789-dd5450dbe970
* Make dh_key_info encoder and decoder symmetricGreg Hudson2012-01-093-5/+35
| | | | | | | | | | | | 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
* Remove unneeded kdcRealm field in PKINIT structureGreg Hudson2012-01-082-2/+1
| | | | | | | | krb5_pk_authenticator_draft9 had a kdcRealm field which was set by the client code but never encoded or decoded. Remove it. Eliminating this field exposed a bug in auth_pack_draft9_optional; fix that. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25624 dc483132-0cff-0310-8789-dd5450dbe970
* Fix PKINIT serverDHNonce encodingGreg Hudson2012-01-081-7/+1
| | | | | | | | | | | Use an explicit tag for serverDHNonce, as specified in RFC 4556, rather than the implicit tag we historically used. This bug had no practical effect (and creates no interoperability issues) because we never generate a serverDHNonce. ticket: 7061 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25623 dc483132-0cff-0310-8789-dd5450dbe970
* Clean up the asn1 encoder designGreg Hudson2012-01-083-226/+227
| | | | | | | | | | | | | | | | | Now that the PKINIT types have been converted and atype_fn has only one use, we can more easily modify the encoder so that any object can be encoded without its tag, which makes for a cleaner design. The basic building block is now krb5int_asn1_encode_type, which encodes the contents of a function and returns its tag information to the caller. atype_fn now has its own structure, and the encoder function it references follows the semantics of krb5int_asn1_encode_type. atype_opaque is now atype_der and goes with a new corresponding field type (field_der); stored DER encodings are parsed to separate the tag from the content. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25622 dc483132-0cff-0310-8789-dd5450dbe970
* Remove some unneeded accessor fieldsGreg Hudson2012-01-072-8/+0
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25620 dc483132-0cff-0310-8789-dd5450dbe970
* Remove some unused structures and encodersGreg Hudson2012-01-076-248/+0
| | | | | | | | | | | krb5_alt_method was added in r6604 but never supported. krb5_pwd_data became unused when the Sandia kadmin system was replaced. krb5_pa_server_referral_data and krb5_pa_svr_referral_data were added in r21690 with internally-visible encoders which nothing uses. Leave behind structure declarations in krb5.hin for API compatibility. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25619 dc483132-0cff-0310-8789-dd5450dbe970
* Remove SAM encoders and structuresGreg Hudson2012-01-076-424/+0
| | | | | | | | r24403 removed the old SAM support, but left behind the structures, free functions, and ASN.1 encoders/decoders. Remove those now. (SAM-2 support is still present.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25618 dc483132-0cff-0310-8789-dd5450dbe970
* Convert all remaining macro-coded ASN.1 encodersGreg Hudson2012-01-066-1017/+302
| | | | | | | | | | | Use data-driven encoders for all of the remaining types which still used macros (primarily PKINIT types), and get rid of the macros. Do not change any encoding behavior, but add some comments where behavior differs from the spec. DEFFNTYPE is now unused except for the kdc_req_body hack. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25617 dc483132-0cff-0310-8789-dd5450dbe970
* Add support for CHOICE in ASN.1 encoderGreg Hudson2012-01-062-0/+50
| | | | | | | | Add a new field type where the length offset indicates a distinguisher and the data offset indicates a union address. The field's type is an atype_choice containing a seq_info indexed by the distinguisher. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25616 dc483132-0cff-0310-8789-dd5450dbe970
* Factor out length retrieval in ASN.1 encoderGreg Hudson2012-01-061-71/+54
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25615 dc483132-0cff-0310-8789-dd5450dbe970
* Support implicit context tags in ASN.1 fieldsGreg Hudson2012-01-064-356/+418
| | | | | | | | | | | | | | | | | | | | | Add a field_info bit (the 32nd bit of the bitfields) indicating whether the context tag is implicit, and support it in encode_a_field. Adjust all field-generating macros and invocations to include the new bit (always 0 for the moment). For atype_tagged_thing, narrow the construction field to six bits and add an implicit bit. We could remove the construction field if it weren't for DEFOCTETWRAPPEDTYPE abusing atype_tagged_thing a little bit, since (normal) explicit tags are always constructed and implicit tag construction is computed from the base type. Given how rarely implicit tagging is used, it might be nice to have separate _IMPLICIT macros rather than an extra argument to every field. But we already have separate _OPT macros for optional fields and FIELDOF_STRING vs. FIELDOF_STRINGL, so we start to get a combinatoric explosion in the number of macros. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25614 dc483132-0cff-0310-8789-dd5450dbe970
* Support ASN.1 encoding without the outer tagGreg Hudson2012-01-061-113/+135
| | | | | | | | | | | | | | | | In order to support implicit tagging, make it possible to ASN.1-encode a value without its outer tag, instead remembering the construction bit of the omitted tag. A cleaner design would be to have separate functions for encoding a value's contents and its tag. However, we can't do that for atype_fn or atype_opaque, and the possible indirections between types and fields mean we want to stay at the "encode everything" level for as long as possible to allow implicit tagging of the largest possible subset of types. If we can get rid of atype_fn, we may be able to switch to the cleaner design with some adjustments to atype_opaque. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25613 dc483132-0cff-0310-8789-dd5450dbe970
* Use content-only ASN.1 primitivesGreg Hudson2012-01-063-339/+245
| | | | | | | | | | | | | | | As part of implicit tag support, rework ASN.1 encoding primitives so that they encode only content, not tags. Combine primitives which become identical with this change. The new atype_primitive type invokes a primitive encoder and adds a tag. atype_fn_len is split into atype_string and atype_opaque, both of which are hardcoded to use asn1_encode_bytestring. For the encoders still using macros, create asn1_addprimitive, asn1_addinteger, and asn1_addstring macros which call the primitive encoder function and add a tag. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25612 dc483132-0cff-0310-8789-dd5450dbe970
* Make ASN.1 struct atype_info more extensibleGreg Hudson2012-01-062-115/+161
| | | | | | | | | | Instead of including all of the possible type fields in struct atype_info, use a pointer to a type-specific structure. This might save a little space, but more importantly, if we get to the point of exposing this stuff across plugin APIs, it allows ASN.1 type information to be extensible via defining new atype_type values. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25611 dc483132-0cff-0310-8789-dd5450dbe970
* Add missing test cases for ASN.1 typesGreg Hudson2012-01-061-0/+5
| | | | | | Add test cases for ASN.1 types which didn't previously have them. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25610 dc483132-0cff-0310-8789-dd5450dbe970
* Fix asn1_encode_subject_pk_info without paramsGreg Hudson2012-01-061-2/+4
| | | | | | | | r20923 inadvertently broke asn1_encode_subject_pk_info in the case where algorithm.parameters.length == 0. Fortunately this case never happens, but fix it anyway. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25607 dc483132-0cff-0310-8789-dd5450dbe970
* Remove unused functions (older API residue) krb5_realm_iterator* and ↵Zhanna Tsitkov2012-01-045-132/+1
| | | | | | krb5_free_realm_string git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25606 dc483132-0cff-0310-8789-dd5450dbe970
* Stop using krb5_typed_data structure typeGreg Hudson2011-12-2110-52/+26
| | | | | | | | | | | | Use the krb5_pa_data structure type when encoding or decoding TYPED-DATA. Leave the krb5_typed_data structure definition in krb5.h with a comment saying not to use it. Remove krb5_free_typed_data (which was never declared in krb5.h). Remove some vestigial accessor stuff related to PKINIT encoding and decoding TYPED-DATA, which was unneeded since r25483. Bump the accessor structure version to 19 accordingly. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25601 dc483132-0cff-0310-8789-dd5450dbe970
* Stop using krb5_octet_dataGreg Hudson2011-12-217-49/+57
| | | | | | | | 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
* krb5_server_decrypt_ticket_keytab wrongly succeedsGreg Hudson2011-12-131-2/+1
| | | | | | | | | | | | If krb5_server_decrypt_ticket_keytab doesn't find a key of the appropriate enctype in an iterable keytab, it returns 0 (without decrypting the ticket) due to a misplaced initialization of retval. This bug causes kinit -k to claim "keytab entry valid" when it shouldn't. Reported by mark@mproehl.net. ticket: 7051 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25584 dc483132-0cff-0310-8789-dd5450dbe970
* kfw: use _WIN64 names where appropriateTom Yu2011-12-121-0/+4
| | | | | | | | Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com> ticket: 7050 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25571 dc483132-0cff-0310-8789-dd5450dbe970
* Fix subkey memory leak in krb5_get_credentialsGreg Hudson2011-12-091-0/+2
| | | | | | | | | | | If a get_credentials operation requires multiple TGS requests, we need to free the subkey from previous requests before saving a new one. ticket: 7049 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25536 dc483132-0cff-0310-8789-dd5450dbe970
* Fix memory leaks in FAST TGS supportGreg Hudson2011-12-092-4/+12
| | | | | | | | | | krb5int_fast_prep_req remove tgs from request->padata and needs to free it. get_creds.c needs to use a fresh FAST state for each TGS request to avoid leaking armor keys. ticket: 7026 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25535 dc483132-0cff-0310-8789-dd5450dbe970
* Actually allow null server key in krb5_pac_verifyGreg Hudson2011-12-081-3/+0
| | | | | | ticket: 7048 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25534 dc483132-0cff-0310-8789-dd5450dbe970
* Allow null server key to krb5_pac_verifyGreg Hudson2011-12-071-3/+5
| | | | | | | | | | When the KDC verifies a PAC, it doesn't really need to check the server signature, since it can't trust that anyway. Allow the caller to pass only a TGT key. ticket: 7048 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25532 dc483132-0cff-0310-8789-dd5450dbe970
* make dependKen Raeburn2011-12-051-4/+8
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25505 dc483132-0cff-0310-8789-dd5450dbe970
* Set a default enctype for optimistic preauthGreg Hudson2011-12-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | When the client application requests optimistic preauth for a preauth type which uses the password, we don't have an etype-info2 to interpret since we haven't talked to the KDC. So we need to guess an enctype, salt, and s2k parameters. In 1.9 and prior, encrypted timestamp contained code to use the first requested enctype in this case, but encrypted challenge did not. In 1.10 prior to this change, neither mechanism uses a reasonable default. Set a default enctype in krb5_init_creds_init so that all password-based preauth mechanisms will use a reasonable default in the optimistic preauth case. The default salt and s2k parameters for this case will be the principal-based default salt and the enctype-based default parameters. ticket: 7033 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25504 dc483132-0cff-0310-8789-dd5450dbe970
* Added support for loading of Krb5.ini from Windows APPDATASam Hartman2011-12-021-8/+77
| | | | | | | | | | Signed-off-by: Alexey Melnikov <aamelnikov@gmail.com> ticket: 7038 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25500 dc483132-0cff-0310-8789-dd5450dbe970
* Use LsaDeregisterLogonProcess(), not CloseHandle()Sam Hartman2011-12-021-9/+9
| | | | | | | | | | Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com> ticket: 7037 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25499 dc483132-0cff-0310-8789-dd5450dbe970
* Fix free ofuninitialized memory in sname_to_princSam Hartman2011-12-021-2/+3
| | | | | | | | | | | Fix free of uninitialized memory in error case introduced in 1.10 development cycle. ticket: 7036 tags: pullup Target_Version: 1.10 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25498 dc483132-0cff-0310-8789-dd5450dbe970
* krb5_lcc_store() now ignores config credentialsSam Hartman2011-12-021-0/+9
| | | | | | | | | | Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com> ticket: 7035 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25497 dc483132-0cff-0310-8789-dd5450dbe970
* mk_cred: memory managementSam Hartman2011-12-021-1/+1
| | | | | | | | | | | | | | Fix for mk_cred.c: calloc() not malloc() Avoid calling free() in cleanup on uninitialized sub-ptrs if error occurs. Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com> ticket: 7034 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25496 dc483132-0cff-0310-8789-dd5450dbe970
* Adjust krb5int_decode_tgs_rep, closing a leakGreg Hudson2011-11-231-19/+20
| | | | | | | | Use current practices for parameter naming and resource cleanup. Avoid a leak of local_dec_rep (now named dec_rep) if we take a "goto cleanup" path. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25490 dc483132-0cff-0310-8789-dd5450dbe970
* Whitespace, style changes to past two commitsGreg Hudson2011-11-235-76/+84
| | | | git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25489 dc483132-0cff-0310-8789-dd5450dbe970
* FAST TGSSam Hartman2011-11-237-18/+129
| | | | | | | | | | Implement RFC 6113 FAST TGS support. Includes library support for a varient of explicit TGS armor that has not yet been proposed within the IETF. ticket: 7026 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25488 dc483132-0cff-0310-8789-dd5450dbe970
* FAST: error handling and const keyblockSam Hartman2011-11-232-23/+34
| | | | | | | | | | | | krb5int_fast_process_error: Allow out_padata and retry to be null for TGS case. Refactor function to do more frees in the exit handling and to declare variables at the top. krb5int_fast_reply_key: input keyblock arguments should be const ticket: 7025 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25487 dc483132-0cff-0310-8789-dd5450dbe970
* ticket: newSam Hartman2011-11-233-21/+45
| | | | | | | | | | | | | | | | | subject: FAST PKINIT target_version: 1.10 tags: pullup Per RFC 6113 fast should use the inner request body for the pkinit checksum. We did that on the KDC; now do so on the client. Remove code that explicitly blocked pkinit under FAST. Also, use the reply key *before* the strengthen key is applied when verifying the PADATA_PKINIT_KX. Add FAST pkinit test. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25486 dc483132-0cff-0310-8789-dd5450dbe970
* Use POSIX constants instead of S_IREAD/S_IWRITEGreg Hudson2011-11-221-2/+2
| | | | | | | | S_IREAD and S_IWRITE are ancient names for S_IRUSR and S_IWUSR, and are not defined on some modern platforms (such as Android). Use the POSIX names instead. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25485 dc483132-0cff-0310-8789-dd5450dbe970
* Fix compile error in previous changeGreg Hudson2011-11-221-1/+0
| | | | | | | | | A last-minute code editing mistake crept into the previous commit; fix it. ticket: 7023 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25484 dc483132-0cff-0310-8789-dd5450dbe970
* Clean up client-side preauth error data handlingGreg Hudson2011-11-214-48/+32
| | | | | | | | | | | | | | | | | | | | | | | | Change the clpreauth tryagain method to accept a list of pa-data, taken either from the FAST response or from decoding the e_data as either pa-data or typed-data. Also change the in_padata argument to contain just the type of the request padata rather than the whole element, since modules generally shouldn't care about the contents of their request padata (or they can remember it). In krb5int_fast_process_error, no longer re-encode FAST pa-data as typed-data for the inner error e_data, but decode traditional error e_data for all error types, and try both pa-data and typed-data encoding. In PKINIT, try all elements of the new pa-data list, since it may contain FAST elements as well as the actual PKINIT array. (Fixes an outstanding bug in FAST PKINIT.) ticket: 7023 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25483 dc483132-0cff-0310-8789-dd5450dbe970
* Handle TGS referrals to the same realmGreg Hudson2011-11-141-1/+8
| | | | | | | | | | | | | | | krb5 1.6 through 1.8 contained a workaround for the Active Directory behavior of returning a TGS referral to the same realm as the request. 1.9 responds to this behavior by caching the returned TGT, trying again, and detecting a referral loop. This is a partial regression of ticket #4955. Detect this case and fall back to a non-referreal request. ticket: 7016 target_version: 1.9.3 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25472 dc483132-0cff-0310-8789-dd5450dbe970
* Add consistency check for plugin interface namesGreg Hudson2011-11-131-1/+5
| | | | | | | Add an assertion to ensure that the interface_names table in plugin.c is updated when a new pluggable interface is added. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25471 dc483132-0cff-0310-8789-dd5450dbe970
* Add plugin interface_names entry for ccselectGreg Hudson2011-11-121-1/+2
| | | | | | | | | | | | When the ccselect pluggable interface was added, the interface_names table wasn't updated, so configuring modules for it wouldn't work. Add it now. ticket: 7015 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25470 dc483132-0cff-0310-8789-dd5450dbe970
* Avoid looping when preauth can't be generatedGreg Hudson2011-11-113-4/+15
| | | | | | | | | | | | | | | | | If we receive a PREAUTH_REQUIRED error and fail to generate any real preauthentication, error out immediately instead of continuing to generate non-preauthenticated requests until we hit the loop count. There is a lot of room to generate a more meaningful error about why we failed to generate preauth (although in many cases the answer may be too complicated to explain in an error message), but that requires more radical restructuring of the preauth framework. ticket: 6430 target_version: 1.10 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25469 dc483132-0cff-0310-8789-dd5450dbe970