13 * This routine performs DES cipher-block-chaining checksum operation,
14 * a.k.a. Message Authentication Code. It ALWAYS encrypts from input
15 * to a single 64 bit output MAC checksum.
16 *
17 * The key schedule is passed as an arg, as well as the cleartext or
18 * ciphertext. The cleartext and ciphertext should be in host order.
19 *
20 * NOTE-- the output is ALWAYS 8 bytes long. If not enough space was
21 * provided, your program will get trashed.
22 *
23 * The input is null padded, at the end (highest addr), to an integral
24 * multiple of eight bytes.
25 */
26 unsigned long
27 mit_des_cbc_cksum(krb5_context context,
28 const krb5_octet *in, krb5_octet *out,
29 unsigned long length, krb5_keyblock *key,
30 const krb5_octet *ivec)
31 {
32 krb5_error_code ret = 0;
33 /* EXPORT DELETE START */
34 krb5_data input;
35 krb5_data output;
36 krb5_data ivecdata;
37
38 input.data = (char *)in;
39 input.length = length;
40 output.data = (char *)out;
41 output.length = MIT_DES_BLOCK_LENGTH;
42 ivecdata.data = (char *)ivec;
43 ivecdata.length = MIT_DES_BLOCK_LENGTH;
44
45 ret = k5_ef_mac(context, key, &ivecdata,
46 (const krb5_data *)&input, &output);
47
48 /* EXPORT DELETE END */
49 return (ret);
50 }
|
13 * This routine performs DES cipher-block-chaining checksum operation,
14 * a.k.a. Message Authentication Code. It ALWAYS encrypts from input
15 * to a single 64 bit output MAC checksum.
16 *
17 * The key schedule is passed as an arg, as well as the cleartext or
18 * ciphertext. The cleartext and ciphertext should be in host order.
19 *
20 * NOTE-- the output is ALWAYS 8 bytes long. If not enough space was
21 * provided, your program will get trashed.
22 *
23 * The input is null padded, at the end (highest addr), to an integral
24 * multiple of eight bytes.
25 */
26 unsigned long
27 mit_des_cbc_cksum(krb5_context context,
28 const krb5_octet *in, krb5_octet *out,
29 unsigned long length, krb5_keyblock *key,
30 const krb5_octet *ivec)
31 {
32 krb5_error_code ret = 0;
33 krb5_data input;
34 krb5_data output;
35 krb5_data ivecdata;
36
37 input.data = (char *)in;
38 input.length = length;
39 output.data = (char *)out;
40 output.length = MIT_DES_BLOCK_LENGTH;
41 ivecdata.data = (char *)ivec;
42 ivecdata.length = MIT_DES_BLOCK_LENGTH;
43
44 ret = k5_ef_mac(context, key, &ivecdata,
45 (const krb5_data *)&input, &output);
46
47 return (ret);
48 }
|