2
/* part of Cygnus Network Security */
3
/* Copyright 1994 Cygnus Support */
5
* Permission to use, copy, modify, and
6
* distribute this software and its documentation for any purpose and
7
* without fee is hereby granted, provided that the above copyright
8
* notice appear in all copies and that both that copyright notice and
9
* this permission notice appear in supporting documentation.
10
* Cygnus Support makes no representations about the suitability of
11
* this software for any purpose. It is provided "as is" without express
12
* or implied warranty.
22
/* #define KERB_ERR_PREAUTH_SHORT 11 */
23
/* #define KERB_ERR_PREAUTH_MISMATCH 12 */
27
krb_rd_preauth(pkt, preauth_p, preauth_len, auth_pr, key)
37
name_p = auth_pr->name;
40
/* Decrypt preauth_p using key as the key and initialization vector. */
41
/* check preauth_len */
42
if ((((strlen(name_p) + 1) / 8) + 1) * 8 != preauth_len)
43
return KERB_ERR_PREAUTH_SHORT;
45
des_key_schedule key_s;
47
if (des_key_sched(key, key_s)) {
50
des_pcbc_encrypt((des_cblock *)preauth_p, (des_cblock *)preauth_p,
51
(long)preauth_len, key_s, (des_cblock *)key,
53
memset(key_s, 0, sizeof(key_s));
55
#endif /* R3_NO_MODIFICATIONS */
57
/* since the preauth data has the trailing 0, this just works */
58
st = strcmp(preauth_p, name_p);
60
return KERB_ERR_PREAUTH_MISMATCH;