3 * The Regents of the University of Michigan
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
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
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
)
45 if (keybytes
== NULL
&& keylength
== NULL
)
48 for (i
=0; i
<krb5_enctypes_length
; i
++) {
49 if (krb5_enctypes_list
[i
].etype
== enctype
)
53 if (i
== krb5_enctypes_length
)
54 return(KRB5_BAD_ENCTYPE
);
57 *keybytes
= krb5_enctypes_list
[i
].enc
->keybytes
;
59 *keylength
= krb5_enctypes_list
[i
].enc
->keylength
;