4 * Copyright 1994, 1995 by the Massachusetts Institute of Technology.
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
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 M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. M.I.T. makes no representations about the suitability of
20 * this software for any purpose. It is provided "as is" without express
21 * or implied warranty.
27 krb5_error_code INTERFACE mit_raw_des_encrypt_func
28 PROTOTYPE(( krb5_const_pointer, krb5_pointer, const size_t,
29 krb5_encrypt_block *, krb5_pointer ));
31 krb5_error_code INTERFACE mit_raw_des_decrypt_func
32 PROTOTYPE(( krb5_const_pointer, krb5_pointer, const size_t,
33 krb5_encrypt_block *, krb5_pointer ));
35 static krb5_cryptosystem_entry mit_raw_des_cryptosystem_entry = {
37 mit_raw_des_encrypt_func,
38 mit_raw_des_decrypt_func,
41 mit_des_string_to_key,
42 mit_des_init_random_key,
43 mit_des_finish_random_key,
45 sizeof(mit_des_cblock),
47 sizeof(mit_des_cblock),
52 krb5_cs_table_entry krb5_raw_des_cst_entry = {
54 &mit_raw_des_cryptosystem_entry,
58 krb5_error_code INTERFACE
59 mit_raw_des_decrypt_func(in, out, size, key, ivec)
60 krb5_const_pointer in;
63 krb5_encrypt_block * key;
66 return (mit_des_cbc_encrypt ((const mit_des_cblock *) in,
69 (struct mit_des_ks_struct *)key->priv,
70 ivec ? ivec : (krb5_pointer)key->key->contents,
74 krb5_error_code INTERFACE
75 mit_raw_des_encrypt_func(in, out, size, key, ivec)
76 krb5_const_pointer in;
79 krb5_encrypt_block * key;
84 /* round up to des block size */
86 sumsize = krb5_roundup(size, sizeof(mit_des_cblock));
88 /* assemble crypto input into the output area, then encrypt in place. */
90 memset((char *)out, 0, sumsize);
91 memcpy((char *)out, (char *)in, size);
93 /* We depend here on the ability of this DES implementation to
94 encrypt plaintext to ciphertext in-place. */
95 return (mit_des_cbc_encrypt (out,
98 (struct mit_des_ks_struct *)key->priv,
99 ivec ? ivec : (krb5_pointer)key->key->contents,