etypes.c revision 159d09a20817016f09b3ea28d1bdada4a336bb91
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* 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.
*/
#ifdef _KERNEL
/* Solaris Kerberos:
* we don't provide these functions to the kernel
*/
#define krb5int_des_string_to_key NULL
#define krb5_dk_string_to_key NULL
#define krb5int_arcfour_string_to_key NULL
#endif /* _KERNEL */
#include <k5-int.h>
#include <enc_provider.h>
#include <hash_provider.h>
#include <etypes.h>
#include <old.h>
#include <raw.h>
#include <dk.h>
#include <arcfour.h>
/* these will be linear searched. if they ever get big, a binary
search or hash table would be better, which means these would need
to be sorted. An array would be more efficient, but that assumes
that the keytypes are all near each other. I'd rather not make
that assumption. */
struct krb5_keytypes krb5_enctypes_list[] = {
"des-cbc-crc", "DES cbc mode with CRC-32",
#ifndef _KERNEL
#else
NULL,
#endif /* !_KERNEL */
},
"des-cbc-md5", "DES cbc mode with RSA-MD5",
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
"des", "DES cbc mode with RSA-MD5", /* alias */
#ifndef _KERNEL
#else
#endif /* _KERNEL */
},
"des-cbc-raw", "DES cbc mode raw",
NULL,
#ifndef _KERNEL
#else
NULL,
#endif /* !_KERNEL */
},
"des3-cbc-raw", "Triple DES cbc mode raw",
NULL,
#ifndef _KERNEL
#else
NULL,
#endif /* !_KERNEL */
},
#ifndef _KERNEL
#else
#endif
},
{ ENCTYPE_DES3_CBC_SHA1, /* alias */
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
{ ENCTYPE_DES3_CBC_SHA1, /* alias */
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
/* The des3-cbc-hmac-sha1-kd is the official enctype associated with
*/
{ ENCTYPE_DES3_CBC_SHA1, /* alias */
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
NULL,
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
{ ENCTYPE_ARCFOUR_HMAC, /* alias */
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
{ ENCTYPE_ARCFOUR_HMAC, /* alias */
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
{ ENCTYPE_ARCFOUR_HMAC_EXP, /* alias */
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
{ ENCTYPE_ARCFOUR_HMAC_EXP, /* alias */
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
/*
* Note, all AES enctypes must use SUN_CKM_AES_CBC. See aes_provider.c for
* more info.
*/
"aes128-cts-hmac-sha1-96", "AES-128 CTS mode with 96-bit SHA-1 HMAC",
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
"aes128-cts", "AES-128 CTS mode with 96-bit SHA-1 HMAC",
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
"aes256-cts-hmac-sha1-96", "AES-256 CTS mode with 96-bit SHA-1 HMAC",
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
"aes256-cts", "AES-256 CTS mode with 96-bit SHA-1 HMAC",
#ifndef _KERNEL
#else
#endif /* !_KERNEL */
},
};
const int krb5_enctypes_length =
sizeof(krb5_enctypes_list)/sizeof(struct krb5_keytypes);
#ifdef _KERNEL
/*
* Routine to pre-fetch the mechanism types from KEF so
* we dont keep doing this step later.
*/
void
{
int i;
struct krb5_keytypes *kt;
for (i=0; i<krb5_enctypes_length; i++) {
}
}
}
}
/*ARGSUSED*/
{
int i;
struct krb5_keytypes *kt;
return (CRYPTO_MECH_INVALID);
for (i=0; i<krb5_enctypes_length; i++) {
"found %s %ld",
return (kt->kef_cipher_mt);
}
}
return (CRYPTO_MECH_INVALID);
}
/*ARGSUSED*/
{
int i;
struct krb5_keytypes *kt;
return (CRYPTO_MECH_INVALID);
for (i=0; i<krb5_enctypes_length; i++) {
"found %s %ld",
return (kt->kef_hash_mt);
}
}
return (CRYPTO_MECH_INVALID);
}
#endif /* _KERNEL */