dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / gss_mechs / mech_krb5 / crypto / keylengths.c
blob419638e470c967a80f05d9b91a9a1f45162bf327
1 /*
2 * COPYRIGHT (c) 2006
3 * The Regents of the University of Michigan
4 * ALL RIGHTS RESERVED
5 *
6 * Permission is granted to use, copy, create derivative works
7 * and redistribute this software and such derivative works
8 * for any purpose, so long as the name of The University of
9 * Michigan is not used in any advertising or publicity
10 * pertaining to the use of distribution of this software
11 * without specific, written prior authorization. If the
12 * above copyright notice or any other identification of the
13 * University of Michigan is included in any copy of any
14 * portion of this software, then the disclaimer below must
15 * also be included.
17 * THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION
18 * FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY
19 * PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY OF
20 * MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
21 * WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
23 * REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE
24 * FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR
25 * CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING
26 * OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN
27 * IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGES.
32 #include "k5-int.h"
33 #include "etypes.h"
36 * keybytes is the number of bytes required as input to make a key,
37 * keylength is the length of the final key in bytes
39 krb5_error_code KRB5_CALLCONV
40 krb5_c_keylengths(krb5_context context, krb5_enctype enctype,
41 size_t *keybytes, size_t *keylength)
43 int i;
45 if (keybytes == NULL && keylength == NULL)
46 return(EINVAL);
48 for (i=0; i<krb5_enctypes_length; i++) {
49 if (krb5_enctypes_list[i].etype == enctype)
50 break;
53 if (i == krb5_enctypes_length)
54 return(KRB5_BAD_ENCTYPE);
56 if (keybytes)
57 *keybytes = krb5_enctypes_list[i].enc->keybytes;
58 if (keylength)
59 *keylength = krb5_enctypes_list[i].enc->keylength;
61 return(0);