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