summaryrefslogtreecommitdiffstats
path: root/src/include/k5-platform.h
Commit message (Collapse)AuthorAgeFilesLines
* * k5-platform.h: Include endian.h if it's available, or machine/endian.h ifKen Raeburn2005-06-151-75/+120
| | | | | | | | | | | it's available. Include byteswap.h if available. (K5_LE, K5_BE): Define based on endianness macros from header files, if available. Only do the architecture tests if this fails. (SWAP16, SWAP32, SWAP64): Define if byteswap.h and bswap_16 are available. ({load,store}_{16,32,64}_le): Disable building of little-endian versions, which aren't currently used. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17239 dc483132-0cff-0310-8789-dd5450dbe970
* Use GCC's packed-structure support to try to optimize unaligned loads andKen Raeburn2005-06-091-7/+122
| | | | | | | | | | | | | | | | | | | stores of values. (E.g., on x86, gcc will emit a word load or store regardless of alignment; on sparc or alpha, it will do aligned word accesses. The old C code does byte operations and arithmetic, always.) Tested in crypto code on x86, sparc, and amd64. * k5-platform.h (load_*): Change argument type to point to const. (K5_BE, K5_LE): New macros, defined based on architecture macros for certain big-endian and little-endian platforms, respectively. (PUT, GET) [__GNUC__]: New macros. Use GCC's packed-structure support to do unaligned loads and stores. (PUTSWAPPED, GETSWAPPED) [__GNUC__]: Similar, but invoke a SWAP<size> macro (not defined yet) to swap the bytes of the value. (store_*, load_*): Use these macros when using GCC, depending on endianness and availability of the SWAP<size> macros. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17232 dc483132-0cff-0310-8789-dd5450dbe970
* don't always require support library when building with sun ccKen Raeburn2005-06-071-22/+25
| | | | | | | | | | | | | | | | | | | By default, a non-GCC configuration will not optimize during the build. The Solaris C compiler will always output functions defined as "inline", at least when not optimizing, even if they're never used. With recent changes on the trunk, k5_call_init_function will cause the support library to be required on Solaris by every program that includes k5-platform.h. This patch should fix that. * k5-platform.h (MAYBE_DEFINE_CALLINIT_FUNCTION) [DELAY_INITIALIZER]: New macro. If not __GNUC__, define k5_call_init_function in the expansion; otherwise, do nothing. (MAKE_INIT_FUNCTION) [DELAY_INITIALIZER]: Use it. (k5_call_init_function): Don't define function form at top level. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17230 dc483132-0cff-0310-8789-dd5450dbe970
* This patch tightens up our determination of whether we can useKen Raeburn2005-03-261-0/+57
| | | | | | | | | | | | | | | | getpw{nam,uid}_r, and using the set flags, creates macros providing a consistent API, and if possible thread safety. * configure.in: Don't check for getpwnam_r and getpwuid_r with AC_CHECK_FUNCS; use AC_CHECK_FUNC, and only set shell variables. Run stricter tests on return types and numbers of arguments, and only define the C macros if these parameters can actually be determined. * k5-platform.h (k5_getpwnam_r, k5_getpwuid_r): New macros. ticket: 2982 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17155 dc483132-0cff-0310-8789-dd5450dbe970
* shared library support for HP-UX 10Ken Raeburn2005-03-251-7/+80
| | | | | | | | | | | | | | | | | | | | | | | Our somewhat outdated HP-UX support (which was targeted at HP-UX 10, not 11) does not have support for shared library initialization and finalization functions, nor for shared library export lists. The former was causing compilation failures unless shared library support was disabled. * include/k5-platform.h: Expand on init/fini comments some more. (MAKE_FINI_FUNCTION): Add an HP-UX specific variant that defines an auxiliary function fitting the signature of HP-UX 10 library combined initializer/finalizer functions. * config/lib.in (hpux10.exports): New target, constructed similar to osf1.exports but with HP-UX 10.x linker options, no initializers, and "errno" explicitly added to the export list. * shlib.conf (*-*-hpux*): Combine PICFLAGS setting with SHLIB_EXPFLAGS and LDCOMBINE setting. Add linker option "-c hpux10.exports" to LDCOMBINE. Set SHLIB_EXPORT_FILE_DEP to hpux10.exports. Set use_linker_fini_option. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17153 dc483132-0cff-0310-8789-dd5450dbe970
* Fix build problem found testing certain combinations of optionsKen Raeburn2005-02-091-0/+2
| | | | | | | | | | * k5-platform.h (PROGRAM_EXITING) [__GNUC__ && !_WIN32 && CONSTRUCTOR_ATTR_WORKS && !DELAY_INITIALIZER]: Define as zero. ticket: 2916 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17089 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-platform.h (k5_call_init_function) [DELAY_INITIALIZER] [__GNUC__]: Use aKen Raeburn2004-07-141-0/+13
| | | | | | | statement expression so any line number info printed by assertion failures is useful. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16589 dc483132-0cff-0310-8789-dd5450dbe970
* * configure.in: Test for 'inline' support.Ken Raeburn2004-07-011-17/+0
| | | | | | | * k5-platform.h (inline): Don't define here. * win-mac.h (inline): Define as __inline. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16536 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-platform.h (JOIN4, JOIN4_2, JOIN3, JOIN3_2): Unused macros deleted.Ken Raeburn2004-06-251-32/+28
| | | | | | | | | | | (JOIN__2, JOIN__2_2): Renamed from JOIN2 and JOIN2_2. Insert two underscores between the tokens supplied. All uses changed to use new macros, and not use identifiers with leading underscores. ticket: 2603 status: resolved git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16521 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-platform.h (MAKE_INIT_FUNCTION, CALL_INIT_FUNCTION, INITIALIZER_RAN): UseKen Raeburn2004-06-181-5/+6
| | | | | | | | the linker-driven version for Windows. The auxinit function definition needs an argument list. (MAKE_FINI_FUNCTION): Likewise. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16488 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-platform.h (DELAY_INITIALIZER): Don't define.Ken Raeburn2004-04-291-20/+30
| | | | | | | | | | | | | | (CONSTRUCTOR_ATTR_WORKS, DESTRUCTOR_ATTR_WORKS): Don't define. (USE_LINKER_FINI_OPTION): Don't define. (MAYBE_DUMMY_INIT): New macro, to optionally produce a dummy initializer for the linker to reference in the case where other options indicate we don't want to use it. (MAKE_INIT_FUNCTION): Use it in some versions. Set the exported function name to have a __auxinit suffix. (MAKE_FINI_FUNCTION) [!SHARED]: Declare the function static, and do nothing to try to cause it to get invoked. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16282 dc483132-0cff-0310-8789-dd5450dbe970
* Added support for library initialization and finalization, and verificationKen Raeburn2004-04-241-2/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | that the initializer completed successfully. Delay initialization on POSIX until the first "verification" call. Currently specific to a few platforms, but should still build on others without thread support enabled. Use it to finish creating (if necessary) and destroy mutexes, and free some other storage "permanently" allocated by libraries (currently, libkrb5 cache/keytab type registries only). Change initialization of static mutexes to a two-step operation, a static "partial" initializer and a "finish_init" routine called from a thread-safe environment like library initialization is assumed to be. POSIX will use the former, Windows will use the latter, and the debug support will check that *both* have been used. Added init/fini functions to com_err, profile, krb5, and gssapi libraries. (The profile library one may need to be removed later.) The existing ones, not thread-safe, are still around. Use weak symbol support if available to figure out if the pthread library has been linked in, and avoid calling certain routines if the C library stubs are known not to exist or work. Stub declarations for thread-specific data. Minor bugfixes, whitespace changes. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16268 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-platform.h (SIZE_MAX): Provide default definition if stdint.h doesn'tKen Raeburn2003-12-151-2/+36
| | | | | | | | define it. ticket: 2040 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15929 dc483132-0cff-0310-8789-dd5450dbe970
* * k5-platform.h: apply casts (unsigned char) to the assignments fromJeffrey Altman2003-12-151-16/+16
| | | | | | | | 64-bit ints to unsigned char fields to avoid warnings ticket: 1471 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15925 dc483132-0cff-0310-8789-dd5450dbe970
* Add platform-dependent 64-bit and inline-function support via new headerKen Raeburn2003-12-131-0/+136
k5-platform.h. Add 64-bit serializer support. [Not needed for ticket 1471, but needed for 2040 and annoying to check in separately.] Add to (internal for now) crypto API a function to get the mandatory checksum type associated with an enctype. New support for server-generated subkey, selected via an auth_context flag. ticket: 1471 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15908 dc483132-0cff-0310-8789-dd5450dbe970