/*
* 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.
*/
#include "k5-int.h"
#include "dk.h"
/*
* Search for a derived key based on the input key,
* the usage constant and the dkid byte.
*
* Return *derived key on success, NULL on failure.
*/
{
"find_derived_key - MATCH FOUND %d 0x%0x",
return(dknode->derived_key);
}
}
return(NULL);
}
/*
* Add a derived key to the dk_list for the indicated key.
*/
{
return (ENOMEM);
} else {
/*
* Find last derived key in list
*/
return (ENOMEM);
}
return (0);
}
/*
* Utility function to create a new keyblock
* Return NULL on failure.
*/
{
return (NULL);
return (NULL);
}
#ifdef _KERNEL
#else
#endif /* _KERNEL */
return(key);
}
/*
* initialize the derived key values in the context.
*/
const struct krb5_enc_provider *enc,
{
/*
* Get a derived encryption key, either from the cache
* or by calculation.
*/
if (cached_key != NULL)
*d_encr_key = cached_key;
else {
if (*d_encr_key == NULL) {
return (ENOMEM);
}
*d_encr_key, &d1);
if (rv != 0) {
*d_encr_key = NULL;
return (rv);
}
*d_encr_key);
if (rv != 0) {
*d_encr_key = NULL;
return (rv);
}
}
/*
* Get a derived HMAC key, either from the cache
* or by calculation.
*/
if (cached_key != NULL)
*d_hmac_key = cached_key;
else {
if (*d_hmac_key == NULL) {
return (ENOMEM);
}
if (rv != 0) {
*d_hmac_key = NULL;
return (rv);
}
#ifdef _KERNEL
/*
* By default, derived keys get the "mech_type"
* that was associated with their parent.
* we need to switch the mech type of the derived HMAC key
* to correspond to the mech type for the hmac key.
*/
}
if (rv != 0) {
*d_hmac_key = NULL;
return (rv);
}
}
#endif /* _KERNEL */
if (rv == 0) {
*d_hmac_key);
if (rv != 0) {
*d_hmac_key = NULL;
return (rv);
}
}
}
return (rv);
}
{
return(KRB5_CRYPTO_INTERNAL);
/* allocate and set up buffers */
return(ENOMEM);
return(ENOMEM);
}
return(ENOMEM);
}
/* initialize the input block */
} else {
}
/* loop encrypting the blocks until enough key bytes are generated */
n = 0;
while (n < keybytes) {
if (ret) {
goto cleanup;
}
break;
}
}
/* postprocess the key */
/* clean memory, free resources and exit */
return(ret);
}