k5-int.h revision c54c769d4c1cde75dd28975fb0090a8f944651a6
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (C) 1989-1995 by the Massachusetts Institute of Technology,
* Cambridge, MA, USA. All Rights Reserved.
*
* This software is being provided to you, the LICENSEE, by the
* Massachusetts Institute of Technology (M.I.T.) under the following
* that you have read, understood, and will comply with these terms and
* conditions:
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
* this software and its documentation for any purpose and without fee or
* royalty is hereby granted, provided that you agree to comply with the
* following copyright notice and statements, including the disclaimer, and
* that the same appear on ALL copies of the software and documentation,
* including modifications that you make for internal use or for
* distribution:
*
* THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
* OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not
* limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
* THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
* PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
*
* The name of the Massachusetts Institute of Technology or M.I.T. may NOT
* be used in advertising or publicity pertaining to distribution of the
* software. Title to copyright in this software and any associated
* documentation shall at all times remain with M.I.T., and USER agrees to
* preserve same.
*/
/*
* Copyright (C) 1998 by the FundsXpress, INC.
*
* All rights reserved.
*
* Export of this software from the United States of America may require
* a specific license from the United States Government. It is the
* responsibility of any person or organization contemplating export to
* obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of FundsXpress. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. FundsXpress makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/*
* This prototype for k5-int.h (Krb5 internals include file)
* includes the user-visible definitions from krb5.h and then
* includes other definitions that are not user-visible but are
* required for compiling Kerberos internal routines.
*
* John Gilmore, Cygnus Support, Sat Jan 21 22:45:52 PST 1995
*/
#ifndef _KRB5_INT_H
#define _KRB5_INT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef _KERNEL
#include <osconf.h>
#include <security/cryptoki.h>
#else
#endif
#ifdef DEBUG
#if !defined(KRB5_DEBUG)
#define KRB5_DEBUG
#endif
#ifndef KRB5_LOG_LVL
#define KRB5_LOG_LVL KRB5_ERR
#endif
#endif /* DEBUG */
#ifdef _KERNEL
#ifdef DEBUG
extern void prom_printf();
#endif /* DEBUG */
#else /* !_KERNEL */
#define prom_printf printf
#endif /* !_KERNEL */
#ifdef KRB5_LOG_LVL
/* krb5_log is used to set the logging level to determine what class of messages
* are output by the mech. Note, more than one logging level can be used by
* bit or'ing the log values together.
*
* All log messages are captured by syslog.
*/
extern unsigned int krb5_log;
/* Note, these defines should be mutually exclusive bit fields */
#ifdef _KERNEL
#define KRB5_LOG1(A, B, C, D) \
#define KRB5_LOG(A, B, C) \
#define KRB5_LOG0(A, B) \
#else /* !_KERNEL */
#include <syslog.h>
#define KRB5_LOG1(A, B, C, D) \
#define KRB5_LOG(A, B, C) \
#define KRB5_LOG0(A, B) \
#endif /* _KERNEL */
#else /* ! KRB5_LOG_LVL */
#define KRB5_LOG1(A, B, C, D)
#define KRB5_LOG(A, B, C)
#define KRB5_LOG0(A, B)
#endif /* KRB5_LOG_LVL */
#ifdef POSIX_TYPES
#else
#define timetype long
#endif
/*
* Begin "k5-config.h"
*/
#ifndef KRB5_CONFIG__
#define KRB5_CONFIG__
/*
* Machine-type definitions: PC Clone 386 running Microsoft Windows
*/
#include "win-mac.h"
/* Kerberos Windows initialization file */
#define KERBEROS_INI "kerberos.ini"
#define INI_FILES "Files"
#define ANSI_STDIO
#endif
#ifndef _KERNEL
#ifndef KRB5_AUTOCONF__
#define KRB5_AUTOCONF__
#include <autoconf.h>
#endif
#endif /* !_KERNEL */
#ifndef KRB5_SYSTYPES__
#define KRB5_SYSTYPES__
#ifdef HAVE_SYS_TYPES_H /* From autoconf.h */
#else /* HAVE_SYS_TYPES_H */
#endif /* HAVE_SYS_TYPES_H */
#endif /* KRB5_SYSTYPES__ */
/* #include "k5-platform.h" SUNW XXX */
/* not used in krb5.h (yet) */
typedef int64_t krb5_int64;
#define DEFAULT_PWD_STRING1 "Enter password:"
#define DEFAULT_PWD_STRING2 "Re-enter password for verification:"
/*
* Windows requires a different api interface to each function. Here
* just define it as NULL.
*/
#ifndef KRB5_CALLCONV
#define KRB5_CALLCONV
#define KRB5_CALLCONV_C
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
#endif /* KRB5_CONFIG__ */
/*
* End "k5-config.h"
*/
/*
* After loading the configuration definitions, load the Kerberos definitions.
*/
#ifndef _KERNEL
#include <errno.h>
#include "profile.h"
#endif
#include <krb5.h>
#ifndef _KERNEL
#if 1 /* def NEED_SOCKETS */
#include <port-sockets.h>
#include <socket-utils.h>
#else
#ifndef SOCK_DGRAM
struct sockaddr;
#endif
#endif
#endif
/* Get mutex support; currently used only for the replay cache. */
#include "k5-thread.h"
The ones that it doesn't include, we include below. */
/*
* Begin "k5-errors.h"
*/
#ifndef KRB5_ERRORS__
#define KRB5_ERRORS__
/* Error codes used in KRB_ERROR protocol messages.
Return values of library routines are based on a different error table
(which allows non-ambiguous error codes between subsystems) */
/* KDC errors */
#define KDC_ERR_NONE 0 /* No error */
/* required */
/* ticket don't match*/
/* Application errors */
/* method required */
/* in message */
/* checksum in message */
/* retry with TCP */
/* other errors */
/* in e-text) */
#endif /* KRB5_ERRORS__ */
/*
* End "k5-errors.h"
*/
/*
* This structure is returned in the e-data field of the KRB-ERROR
* message when the error calling for an alternative form of
* authentication is returned, KRB_AP_METHOD.
*/
typedef struct _krb5_alt_method {
unsigned int length;
/*
* A null-terminated array of this structure is returned by the KDC as
* the data part of the ETYPE_INFO preauth type. It informs the
* client which encryption types are supported.
* The same data structure is used by both etype-info and etype-info2
* but s2kparams must be null when encoding etype-info.
*/
typedef struct _krb5_etype_info_entry {
unsigned int length;
/*
* This is essentially -1 without sign extension which can screw up
* comparisons on 64 bit machines. If the length is this value, then
* the salt data is not present. This is to distinguish between not
* being set and being of 0 length.
*/
#define KRB5_ETYPE_NO_SALT VALID_UINT_BITS
typedef krb5_etype_info_entry ** krb5_etype_info;
/*
* a sam_challenge is returned for alternate preauth
*/
/*
SAMFlags ::= BIT STRING {
use-sad-as-key[0],
send-encrypted-sad[1],
must-pk-encrypt-sad[2]
}
*/
/*
PA-SAM-CHALLENGE ::= SEQUENCE {
sam-type[0] INTEGER,
sam-flags[1] SAMFlags,
sam-type-name[2] GeneralString OPTIONAL,
sam-track-id[3] GeneralString OPTIONAL,
sam-challenge-label[4] GeneralString OPTIONAL,
sam-challenge[5] GeneralString OPTIONAL,
sam-response-prompt[6] GeneralString OPTIONAL,
sam-pk-for-sad[7] EncryptionKey OPTIONAL,
sam-nonce[8] INTEGER OPTIONAL,
sam-cksum[9] Checksum OPTIONAL
}
*/
/* sam_type values -- informational only */
#if 1 /* XXX need to figure out who has which numbers assigned */
#endif
typedef struct _krb5_predicted_sam_response {
typedef struct _krb5_sam_challenge {
typedef struct _krb5_sam_key { /* reserved for future use */
} krb5_sam_key;
typedef struct _krb5_enc_sam_response_enc {
typedef struct _krb5_sam_response {
typedef struct _krb5_sam_challenge_2 {
typedef struct _krb5_sam_challenge_2_body {
typedef struct _krb5_sam_response_2 {
typedef struct _krb5_enc_sam_response_enc_2 {
/*
* Begin "dbm.h"
*/
#ifndef _KERNEL
/*
* Since we are always using db, use the db-ndbm include header file.
*/
#include "db-ndbm.h"
#endif /* !KERNEL */
/*
* End "dbm.h"
*/
/*
* Begin "ext-proto.h"
*/
#ifndef KRB5_EXT_PROTO__
#define KRB5_EXT_PROTO__
#ifndef _KERNEL
#include <stdlib.h>
#include <string.h>
#endif /* !_KERNEL */
#ifndef HAVE_STRDUP
extern char *strdup (const char *);
#endif
#ifndef _KERNEL
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#endif /* !_KERNEL */
#endif /* KRB5_EXT_PROTO__ */
/*
* End "ext-proto.h"
*/
/*
* Begin "sysincl.h"
*/
#ifndef KRB5_SYSINCL__
#define KRB5_SYSINCL__
#ifndef KRB5_SYSTYPES__
#define KRB5_SYSTYPES__
/* needed for much of the rest -- but already handled in krb5.h? */
#endif /* KRB5_SYSTYPES__ */
#ifdef _KERNEL
#else
#ifdef HAVE_SYS_TIME_H
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#else
#include <time.h>
#endif
#endif /* _KERNEL */
#ifdef HAVE_SYS_STAT_H
#endif
#ifdef HAVE_SYS_PARAM_H
#endif
#ifdef HAVE_SYS_FILE_H
syscalls; flags for open &
friends */
#endif
#ifdef _KERNEL
#else
#include <fcntl.h>
#endif
#endif /* KRB5_SYSINCL__ */
/*
* End "sysincl.h"
*/
/*
* Begin "los-proto.h"
*/
#ifndef KRB5_LIBOS_PROTO__
#define KRB5_LIBOS_PROTO__
#ifndef _KERNEL
#include <stdio.h>
struct addrlist;
#endif
/* libos.spec */
(krb5_context, int, int);
(krb5_context, int);
int krb5_net_read
(krb5_context, int , char *, int);
int krb5_net_write
(krb5_context, int , const char *, int);
krb5_data *, int *, int);
(krb5_context, const krb5_data *, char ***);
(krb5_context, char * const *);
(krb5_context, const krb5_address *, const char *, char **);
(krb5_context, const char * pathname);
#ifndef _KERNEL
#endif
(krb5_context);
void krb5_os_free_context (krb5_context);
/* This function is needed by KfM's KerberosPreferences API
* because it needs to be able to specify "secure" */
#ifndef _KERNEL
#endif
(krb5_context, const char *, krb5_address ***);
#ifndef _KERNEL
/* N.B.: You need to include fake-addrinfo.h *before* k5-int.h if you're
* going to use this structure. */
struct addrlist {
int naddrs;
int space;
};
#define ADDRLIST_INIT { 0, 0, 0 }
extern void krb5int_free_addrlist (struct addrlist *);
extern int krb5int_grow_addrlist (struct addrlist *, int);
extern int krb5int_add_host_to_list (struct addrlist *, const char *,
int, int, int, int);
struct addrlist *,
/* Only meaningful for kdc, really... */
int want_masters,
/* look up [realms]->$realm->$name in krb5.conf */
const char *profilename,
/* SRV record lookup */
const char *dnsname,
int is_stream_service,
/* Port numbers, in network order! For profile
version only, DNS code gets port numbers
itself. Use 0 for dflport2 if there's no
secondary port (most common, except kdc
case). */
int family);
#endif /* _KERNEL */
#endif /* KRB5_LIBOS_PROTO__ */
/* new encryption provider api */
struct krb5_enc_provider {
/* keybytes is the input size to make_key;
keylength is the output size */
/* cipher-state == 0 fresh state thrown away at end */
krb5_error_code (*encrypt) (
krb5_error_code (*decrypt) (
const krb5_keyblock *,
krb5_keyusage, krb5_data *);
};
struct krb5_hash_provider {
/* this takes multiple inputs to avoid lots of copying. */
};
struct krb5_keyhash_provider {
krb5_error_code (*hash) (
krb5_error_code (*verify) (
};
typedef void (*krb5_encrypt_length_func) (
typedef krb5_error_code (*krb5_crypt_func) (
#ifndef _KERNEL
typedef krb5_error_code (*krb5_str2key_func) (
krb5_keyblock *key);
#endif /* _KERNEL */
struct krb5_keytypes {
char *in_string;
char *out_string;
const struct krb5_enc_provider *enc;
const struct krb5_hash_provider *hash;
#ifndef _KERNEL
/* Solaris Kerberos: strings to key conversion not done in the kernel */
#else /* _KERNEL */
char *mt_e_name;
char *mt_h_name;
#endif /* _KERNEL */
};
struct krb5_cksumtypes {
unsigned int flags;
char *in_string;
char *out_string;
/* if the hash is keyed, this is the etype it is keyed with.
Actually, it can be keyed by any etype which has the same
enc_provider as the specified etype. DERIVE checksums can
be keyed with any valid etype. */
/* I can't statically initialize a union, so I'm just going to use
two pointers here. The keyhash is used if non-NULL. If NULL,
is set. Otherwise, a non-keyed hash is computed. This is all
kind of messy, but so is the krb5 api. */
const struct krb5_keyhash_provider *keyhash;
const struct krb5_hash_provider *hash;
/* This just gets uglier and uglier. In the key derivation case,
we produce an hmac. To make the hmac code work, we can't hack
the output size indicated by the hash provider, but we may want
a truncated hmac. If we want truncation, this is the number of
bytes we truncate to; it should be 0 otherwise. */
unsigned int trunc_size;
#ifdef _KERNEL
char *mt_c_name;
#endif /* _KERNEL */
};
#define KRB5_CKSUMFLAG_DERIVE 0x0001
#define KRB5_CKSUMFLAG_NOT_COLL_PROOF 0x0002
const krb5_keyblock *,
krb5_keyusage, krb5_data *);
krb5_cksumtype *);
/*
* normally to free a cipher_state you can just memset the length to zero and
* free it.
*/
/*
* Combine two keys (normally used by the hardware preauth mechanism)
*/
/*
*/
#ifdef _KERNEL
int k5_ef_crypto(
const char *, char *,
long, krb5_keyblock *,
const krb5_data *, int);
#else
krb5_const struct krb5_hash_provider *,
#endif /* _KERNEL */
const krb5_data *,
unsigned long,
const krb5_data *,
const krb5_data *);
/* Make this a function eventually? */
#ifdef WIN32
#else
/* GNU libc generates multiple bogus initialization warnings if we
pass memset a volatile pointer. The compiler should do well enough
with memset even without GNU libc's attempt at optimization. */
# endif
#endif /* WIN32 */
#define zap(p,l) krb5int_zap_data(p,l)
/*
* These declarations are here, so both krb5 and k5crypto
* can get to them.
* krb5 needs to get to them so it can make them available to libgssapi.
*/
extern const struct krb5_enc_provider krb5int_enc_arcfour;
extern const struct krb5_hash_provider krb5int_hash_md5;
/* #ifdef KRB5_OLD_CRYPTO XXX SUNW14resync */
(krb5_int32 *, krb5_int32 *);
/* #endif KRB5_OLD_CRYPTO */
/* this helper fct is in libkrb5, but it makes sense declared here. */
/*
* End "los-proto.h"
*/
/*
* Include the KDB definitions.
*/
#ifndef _KERNEL
#endif /* !_KERNEL */
/*
* Begin "libos.h"
*/
#ifndef KRB5_LIBOS__
#define KRB5_LIBOS__
typedef struct _krb5_os_context {
char * default_ccname;
} *krb5_os_context;
/*
* Flags for the os_flags field
*
* KRB5_OS_TOFFSET_VALID means that the time offset fields are valid.
* The intention is that this facility to correct the system clocks so
* that they reflect the "real" time, for systems where for some
* reason we can't set the system clock. Instead we calculate the
* offset between the system time and real time, and store the offset
* in the os context so that we can correct the system clock as necessary.
*
* KRB5_OS_TOFFSET_TIME means that the time offset fields should be
* returned as the time by the krb5 time routines. This should only
* be used for testing purposes (obviously!)
*/
#define KRB5_OS_TOFFSET_VALID 1
#define KRB5_OS_TOFFSET_TIME 2
/* lock mode flags */
#define KRB5_LOCKMODE_SHARED 0x0001
#define KRB5_LOCKMODE_EXCLUSIVE 0x0002
#define KRB5_LOCKMODE_DONTBLOCK 0x0004
#define KRB5_LOCKMODE_UNLOCK 0x0008
#endif /* KRB5_LIBOS__ */
/*
* End "libos.h"
*/
/*
* Define our view of the size of a DES key.
*/
#define KRB5_MIT_DES_KEYSIZE 8
/*
* Define a couple of SHA1 constants
*/
#define SHS_DATASIZE 64
#define SHS_DIGESTSIZE 20
/*
* Check if des_int.h has been included before us. If so, then check to see
* that our view of the DES key size is the same as des_int.h's.
*/
#ifdef MIT_DES_KEYSIZE
#endif /* MIT_DES_KEYSIZE != KRB5_MIT_DES_KEYSIZE */
#endif /* MIT_DES_KEYSIZE */
#ifndef _KERNEL
/* Solaris Kerberos: only define PROVIDE_DES3_CBC_SHA if the following are
* defined.
*/
#define PROVIDE_DES3_CBC_SHA 1
#define PROVIDE_NIST_SHA 1
#endif /* !_KERNEL */
/*
* Begin "preauth.h"
*
* (Originally written by Glen Machin at Sandia Labs.)
*/
/*
* Sandia National Laboratories also makes no representations about the
* suitability of the modifications, or additions to this software for
* any purpose. It is provided "as is" without express or implied warranty.
*
*/
#ifndef KRB5_PREAUTH__
#define KRB5_PREAUTH__
typedef struct _krb5_pa_enc_ts {
typedef krb5_error_code (*krb5_preauth_obtain_proc)
krb5_pa_data *,
krb5_error_code ( * )(krb5_context,
krb5_data *,
krb5_keyblock **),
krb5_creds *,
krb5_kdc_req *,
krb5_pa_data **);
typedef krb5_error_code (*krb5_preauth_process_proc)
krb5_pa_data *,
krb5_kdc_req *,
krb5_kdc_rep *,
krb5_error_code ( * )(krb5_context,
krb5_data *,
krb5_keyblock **),
krb5_error_code ( * )(krb5_context,
krb5_kdc_rep * ),
krb5_keyblock **,
krb5_creds *,
krb5_int32 *,
krb5_int32 *);
typedef struct _krb5_preauth_ops {
int type;
int flags;
/*
* Preauthentication property flags
*/
#define KRB5_PREAUTH_FLAGS_ENCRYPT 0x00000001
#define KRB5_PREAUTH_FLAGS_HARDWARE 0x00000002
#endif /* KRB5_PREAUTH__ */
/*
* End "preauth.h"
*/
typedef krb5_error_code (*krb5_gic_get_as_key_fct)
void *prompter_data,
void *gak_data);
void *prompter_data,
char *in_tkt_service,
void *gak_data,
int *master,
krb5_kdc_rep **as_reply);
void krb5int_populate_gic_opt (
(krb5_context, krb5_kdc_req *,
krb5_pa_data **, krb5_pa_data ***,
krb5_prompter_fct, void *,
krb5_gic_get_as_key_fct, void *);
#endif /* _KERNEL */
(krb5_context, krb5_sam_challenge * );
(krb5_context, krb5_sam_challenge_2 * );
(krb5_context, krb5_sam_response * );
(krb5_context, krb5_sam_response_2 * );
(krb5_context, krb5_sam_challenge * );
(krb5_context, krb5_sam_challenge_2 * );
(krb5_context, krb5_sam_response * );
(krb5_context, krb5_pa_enc_ts *);
/* #include "krb5/wordsize.h" -- comes in through base-defs.h. */
#ifndef _KERNEL
#include "com_err.h"
#endif /* _KERNEL */
/*
* Solaris Kerberos: moved from sendto_kdc.c so other code can reference
*/
#define DEFAULT_UDP_PREF_LIMIT 1465
#ifndef _KERNEL
#include "profile.h"
#include <strings.h>
#endif /* _KERNEL */
#ifndef _KERNEL
typedef struct _arcfour_ctx {
#endif /* !_KERNEL */
struct _krb5_context {
int in_tkt_ktype_count;
int tgs_ktype_count;
/* This used to be a void*, but since we always allocate them
together (though in different source files), and the types
are declared in the same header, might as well just combine
them.
The array[1] is so the existing code treating the field as
a pointer will still work. For cleanliness, it should
eventually get changed to a single element instead of an
array. */
char *default_realm;
int ser_ctx_count;
void *ser_ctx;
#ifndef _KERNEL
void *db_context;
void *kdblog_context;
/* allowable clock skew */
int fcc_default_format;
int scc_default_format;
/* Message size above which we'll try TCP first in send-to-kdc
type code. Aside from the 2**16 size limit, we put no
absolute limit on the UDP packet size. */
int udp_pref_limit;
/* This is the tgs_ktypes list as read from the profile, or
set to compiled-in defaults. The application code cannot
override it. This is used for session keys for
intermediate ticket-granting tickets used to acquire the
requested ticket (the session key of which may be
constrained by tgs_ktypes above). */
/* Use the _configured version? */
#ifdef KRB5_DNS_LOOKUP
#endif /* KRB5_DNS_LOOKUP */
/* Solaris Kerberos: handles for PKCS#11 crypto */
/*
* Warning, do not access hSession directly as this is not fork() safe.
* Instead use the krb_ctx_hSession() macro below.
*/
int cryptoki_initialized;
/* arcfour_ctx: used only for rcmd stuff so no fork safety issues apply */
#else /* ! KERNEL */
#endif /* ! KERNEL */
};
#ifndef _KERNEL
extern pid_t __krb5_current_pid;
/*
* fork safety: barring the ef_init code, every other function must use the
* krb_ctx_hSession() macro to access the hSession field in a krb context.
* Note, if the pid of the krb ctx == the current global pid then it is safe to
* use the ctx hSession otherwise it needs to be re-inited before it is returned
* to the caller.
*/
#define krb_ctx_hSession(ctx) \
#endif
#define MD5_CKSUM_LENGTH 16
#define RSA_MD5_CKSUM_LENGTH 16
#define MD5_BLOCKSIZE 64
/*
* Solaris Kerberos:
* This next section of prototypes and constants
* are all unique to the Solaris Kerberos implementation.
* Because Solaris uses the native encryption framework
* to provide crypto support, the following routines
* are needed to support this system.
*/
/*
* Begin Solaris Crypto Prototypes
*/
/*
* define constants that are used for creating the constant
* which is used to make derived keys.
*/
#define DK_ENCR_KEY_BYTE 0xAA
#define DK_HASH_KEY_BYTE 0x55
#define DK_CKSUM_KEY_BYTE 0x99
krb5_keyblock **, krb5_keyblock **);
krb5_keyblock *);
#ifdef _KERNEL
void make_kef_key(krb5_keyblock *);
int update_key_template(krb5_keyblock *);
void setup_kef_keytypes();
void setup_kef_cksumtypes();
#else
/*
* This structure is used to map Kerberos supported OID's,
* to PKCS11 mechanisms
*/
#define USE_ENCR 0x01
#define USE_HASH 0x02
typedef struct krb5_mech_2_pkcs {
#endif /* !_KERNEL */
krb5_keyblock *, krb5_keyblock *);
/*
* End Solaris Crypto Prototypes
*/
#define KRB5_LIBOPT_SYNC_KDCTIME 0x0001
/* internal message representations */
typedef struct _krb5_safe {
optional */
} krb5_safe;
typedef struct _krb5_priv {
} krb5_priv;
typedef struct _krb5_priv_enc_part {
(krb5_context, krb5_safe * );
(krb5_context, krb5_priv * );
(krb5_context, krb5_priv_enc_part * );
/*
* Begin "asn1.h"
*/
#ifndef KRB5_ASN1__
#define KRB5_ASN1__
/* ASN.1 encoding knowledge; KEEP IN SYNC WITH ASN.1 defs! */
/* here we use some knowledge of ASN.1 encodings */
/*
Ticket is APPLICATION 1.
Authenticator is APPLICATION 2.
AS_REQ is APPLICATION 10.
AS_REP is APPLICATION 11.
TGS_REQ is APPLICATION 12.
TGS_REP is APPLICATION 13.
AP_REQ is APPLICATION 14.
AP_REP is APPLICATION 15.
KRB_SAFE is APPLICATION 20.
KRB_PRIV is APPLICATION 21.
KRB_CRED is APPLICATION 22.
EncASRepPart is APPLICATION 25.
EncTGSRepPart is APPLICATION 26.
EncAPRepPart is APPLICATION 27.
EncKrbPrivPart is APPLICATION 28.
EncKrbCredPart is APPLICATION 29.
KRB_ERROR is APPLICATION 30.
*/
/* allow either constructed or primitive encoding, so check for bit 6
set or reset */
#define krb5_is_krb_ticket(dat)\
#define krb5_is_krb_authenticator(dat)\
#define krb5_is_as_req(dat)\
#define krb5_is_as_rep(dat)\
#define krb5_is_tgs_req(dat)\
#define krb5_is_tgs_rep(dat)\
#define krb5_is_ap_req(dat)\
#define krb5_is_ap_rep(dat)\
#define krb5_is_krb_safe(dat)\
#define krb5_is_krb_priv(dat)\
#define krb5_is_krb_cred(dat)\
#define krb5_is_krb_enc_as_rep_part(dat)\
#define krb5_is_krb_enc_tgs_rep_part(dat)\
#define krb5_is_krb_enc_ap_rep_part(dat)\
#define krb5_is_krb_enc_krb_priv_part(dat)\
#define krb5_is_krb_enc_krb_cred_part(dat)\
#define krb5_is_krb_error(dat)\
/*************************************************************************
* Prototypes for krb5_encode.c
*************************************************************************/
/*
krb5_error_code encode_krb5_structure(const krb5_structure *rep,
krb5_data **code);
modifies *code
effects Returns the ASN.1 encoding of *rep in **code.
Returns ASN1_MISSING_FIELD if a required field is emtpy in *rep.
Returns ENOMEM if memory runs out.
*/
/* yes, the translation is identical to that used for KDC__REP */
/* yes, the translation is identical to that used for KDC__REP */
(const krb5_enc_data *, krb5_data **);
(const krb5_pa_enc_ts *, krb5_data **);
(const krb5_sam_challenge * , krb5_data **);
(const krb5_sam_key * , krb5_data **);
(const krb5_enc_sam_response_enc * , krb5_data **);
(const krb5_sam_response * , krb5_data **);
(const krb5_predicted_sam_response * , krb5_data **);
(const krb5_sam_challenge_2 * , krb5_data **);
(const krb5_sam_challenge_2_body * , krb5_data **);
(const krb5_enc_sam_response_enc_2 * , krb5_data **);
(const krb5_sam_response_2 * , krb5_data **);
/*************************************************************************
* End of prototypes for krb5_encode.c
*************************************************************************/
/*************************************************************************
* Prototypes for krb5_decode.c
*************************************************************************/
/*
krb5_error_code decode_krb5_structure(const krb5_data *code,
krb5_structure **rep);
requires Expects **rep to not have been allocated;
a new *rep is allocated regardless of the old value.
effects Decodes *code into **rep.
Returns ENOMEM if memory is exhausted.
Returns asn1 and krb5 errors.
*/
(const krb5_data *, krb5_sam_challenge **);
(const krb5_data *, krb5_sam_key **);
(const krb5_data *, krb5_enc_sam_response_enc **);
(const krb5_data *, krb5_sam_response **);
(const krb5_data *, krb5_predicted_sam_response **);
(const krb5_data *, krb5_sam_challenge_2 **);
(const krb5_data *, krb5_sam_challenge_2_body **);
(const krb5_data *, krb5_enc_sam_response_enc_2 **);
(const krb5_data *, krb5_sam_response_2 **);
/*************************************************************************
* End of prototypes for krb5_decode.c
*************************************************************************/
#endif /* KRB5_ASN1__ */
/*
* End "asn1.h"
*/
/*
* Internal krb5 library routines
*/
krb5_ticket *);
int using_subkey,
krb5_kdc_rep *,
krb5_data ** );
/*
* [De]Serialization Handle and operations.
*/
struct __krb5_serializer {
size_t *);
krb5_octet **,
size_t *);
krb5_pointer *,
krb5_octet **,
size_t *);
};
typedef struct __krb5_serializer * krb5_ser_handle;
typedef struct __krb5_serializer krb5_ser_entry;
const krb5_ser_entry *);
/* Determine the external size of a particular opaque structure */
size_t *);
/* Serialize the structure into a buffer */
krb5_octet * *,
size_t *);
/* Deserialize the structure from a buffer */
krb5_pointer *,
krb5_octet **,
size_t *);
/* Serialize data into a buffer */
krb5_octet **,
size_t *);
/*
* Initialization routines.
*/
/* Initialize serialization for krb5_[os_]context */
(krb5_context);
/* Initialize serialization for krb5_auth_context */
(krb5_context);
/* Initialize serialization for krb5_keytab */
(krb5_context);
/* Initialize serialization for krb5_ccache */
(krb5_context);
/* Initialize serialization for krb5_rcache */
(krb5_context);
/* [De]serialize 4-byte integer */
krb5_octet **,
size_t *);
(krb5_int32 *,
krb5_octet **,
size_t *);
/* [De]serialize 8-byte integer */
/* [De]serialize byte string */
(krb5_octet *,
krb5_octet **,
size_t *);
(krb5_octet *,
krb5_octet **,
size_t *);
(krb5_context, krb5_ccache *);
(krb5_context, krb5_prompt_type *);
krb5_keyblock * /* Old keyblock, not new! */);
/* set and change password helpers */
char **result_codestr);
const char **result_codestr);
struct srv_dns_entry {
struct srv_dns_entry *next;
int priority;
int weight;
unsigned short port;
char *host;
};
const char *service,
const char *protocol,
struct srv_dns_entry **answers);
void krb5int_free_srv_dns_data(struct srv_dns_entry *);
/*
* Convenience function for structure magic number
*/
/* SUNW14resync XXX - see k5-util.h */
#if 0
int krb5_seteuid (int);
#endif
char * krb5_getenv(const char *);
int krb5_setenv (const char *, const char *, int);
void krb5_unsetenv (const char *);
/* SUNW14resync - (from here to EOF) not sure if we need this but will add it
for future resync sake */
/* To keep happy libraries which are (for now) accessing internal stuff */
/* Make sure to increment by one when changing the struct */
#define KRB5INT_ACCESS_STRUCT_VERSION 9
#ifndef ANAME_SZ
#endif
typedef struct _krb5int_access {
/* crypto stuff */
const struct krb5_hash_provider *md5_hash_provider;
const struct krb5_enc_provider *arcfour_enc_provider;
const krb5_keyblock *key,
/* service location and communication */
#ifndef _KERNEL
struct addrlist *, int,
const char *, const char *,
int, int, int, int);
const char *hostname,
void (*free_addrlist) (struct addrlist *);
#endif /* _KERNEL */
const char *service,
const char *protocol,
struct srv_dns_entry **answers);
void (*free_srv_dns_data)(struct srv_dns_entry *);
int (*use_dns_kdc)(krb5_context);
/* krb4 compatibility stuff -- may be null if not enabled */
int (*krb524_encode_v4tkt)(struct ktext *, char *, unsigned int *);
#define KRB5INT_ACCESS_VERSION \
(krb5int_access*, krb5_int32);
/* Ick -- some krb524 and krb4 support placed in the krb5 library,
because AFS (and potentially other applications?) use the krb4
object as an opaque token, which (in some implementations) is not
in fact a krb4 ticket, so we don't want to drag in the krb4 support
just to enable this. */
#define KRB524_SERVICE "krb524"
#define KRB524_PORT 4444
/* v4lifetime.c */
/* conv_creds.c */
/* send524.c */
struct _krb5_ccache {
const struct _krb5_cc_ops *ops;
};
struct _krb5_cc_ops {
char *prefix;
const char *);
krb5_creds *);
krb5_flags, krb5_creds *,
krb5_creds *);
krb5_principal *);
krb5_cc_cursor *);
krb5_cc_cursor *, krb5_creds *);
krb5_cc_cursor *);
krb5_flags, krb5_creds *);
};
extern const krb5_cc_ops *krb5_cc_dfl_ops;
typedef struct _krb5_donot_replay {
char *server; /* null-terminated */
char *client; /* null-terminated */
krb5_rcache *);
krb5_rcache *,char *);
krb5_rcache *,char *);
char * krb5_rc_get_type
char * krb5_rc_default_type
(krb5_context);
char * krb5_rc_default_name
(krb5_context);
(krb5_context, krb5_rcache, char *);
typedef struct _krb5_kt_ops {
char *prefix;
/* routines always present */
const char *,
krb5_keytab *);
char *,
unsigned int);
krb5_kt_cursor *);
krb5_kt_cursor *);
krb5_kt_cursor *);
/* routines to be included on extended version (write routines) */
/* Handle for serializer */
const krb5_ser_entry *serializer;
} krb5_kt_ops;
extern const krb5_kt_ops krb5_kt_dfl_ops;
extern krb5_error_code krb5int_translate_gai_error (int);
/* Not sure it's ready for exposure just yet. */
extern krb5_error_code
extern int krb5int_crypto_init (void);
extern int krb5int_prng_init(void);
/*
* SUNW14resync
*/
#define inline
/* Solaris kerberos */
#endif /* _KRB5_INT_H */