1 /*
2 * Copyright (C) 1998 by the FundsXpress, INC.
3 *
4 * All rights reserved.
5 *
6 * Export of this software from the United States of America may require
7 * a specific license from the United States Government. It is the
8 * responsibility of any person or organization contemplating export to
9 * obtain such a license before exporting.
10 *
11 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
12 * distribute this software and its documentation for any purpose and
13 * without fee is hereby granted, provided that the above copyright
14 * notice appear in all copies and that both that copyright notice and
15 * this permission notice appear in supporting documentation, and that
16 * the name of FundsXpress. not be used in advertising or publicity pertaining
17 * to distribution of the software without specific, written prior
18 * permission. FundsXpress makes no representations about the suitability of
19 * this software for any purpose. It is provided "as is" without express
20 * or implied warranty.
21 *
22 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
24 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25 */
26
27 #include "k5-int.h"
28 #include "old.h"
29 #include <des_int.h>
30
31 /* XXX */
32 extern krb5_error_code mit_des_string_to_key_int
33 (krb5_context context,
34 krb5_keyblock * keyblock,
35 const krb5_data * data,
36 const krb5_data * salt);
37
38 /*ARGSUSED*/
39 krb5_error_code
krb5int_des_string_to_key(krb5_context context,const struct krb5_enc_provider * enc,const krb5_data * string,const krb5_data * salt,const krb5_data * parm,krb5_keyblock * key)40 krb5int_des_string_to_key(krb5_context context,
41 const struct krb5_enc_provider *enc,
42 const krb5_data *string,
43 const krb5_data *salt, const krb5_data *parm,
44 krb5_keyblock *key)
45 {
46 int type;
47 if (parm ) {
48 if (parm->length != 1)
49 return KRB5_ERR_BAD_S2K_PARAMS;
50 type = parm->data[0];
51 }
52 else type = 0;
53 switch(type) {
54 case 0:
55 /* Solaris Kerberos */
56 return(mit_des_string_to_key_int(context, key, string, salt));
57 case 1:
58 /* Solaris Kerberos */
59 return mit_afs_string_to_key(context, key, string, salt);
60 default:
61 return KRB5_ERR_BAD_S2K_PARAMS;
62 }
63 }
64