2N/A/*
2N/A * COPYRIGHT (c) 2006
2N/A * The Regents of the University of Michigan
2N/A * ALL RIGHTS RESERVED
2N/A *
2N/A * Permission is granted to use, copy, create derivative works
2N/A * and redistribute this software and such derivative works
2N/A * for any purpose, so long as the name of The University of
2N/A * Michigan is not used in any advertising or publicity
2N/A * pertaining to the use of distribution of this software
2N/A * without specific, written prior authorization. If the
2N/A * above copyright notice or any other identification of the
2N/A * University of Michigan is included in any copy of any
2N/A * portion of this software, then the disclaimer below must
2N/A * also be included.
2N/A *
2N/A * THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION
2N/A * FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY
2N/A * PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY OF
2N/A * MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
2N/A * WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
2N/A * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
2N/A * REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE
2N/A * FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR
2N/A * CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING
2N/A * OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN
2N/A * IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF
2N/A * SUCH DAMAGES.
2N/A */
2N/A
2N/A
2N/A#include "k5-int.h"
2N/A#include "etypes.h"
2N/A
2N/A/*
2N/A * keybytes is the number of bytes required as input to make a key,
2N/A * keylength is the length of the final key in bytes
2N/A */
2N/Akrb5_error_code KRB5_CALLCONV
2N/Akrb5_c_keylengths(krb5_context context, krb5_enctype enctype,
2N/A size_t *keybytes, size_t *keylength)
2N/A{
2N/A int i;
2N/A
2N/A if (keybytes == NULL && keylength == NULL)
2N/A return(EINVAL);
2N/A
2N/A for (i=0; i<krb5_enctypes_length; i++) {
2N/A if (krb5_enctypes_list[i].etype == enctype)
2N/A break;
2N/A }
2N/A
2N/A if (i == krb5_enctypes_length)
2N/A return(KRB5_BAD_ENCTYPE);
2N/A
2N/A if (keybytes)
2N/A *keybytes = krb5_enctypes_list[i].enc->keybytes;
2N/A if (keylength)
2N/A *keylength = krb5_enctypes_list[i].enc->keylength;
2N/A
2N/A return(0);
2N/A}