pull up r25483 and r25484 from trunk
[krb5.git] / src / lib / krb5 / krb / fast.h
1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* lib/krb5/krb/fast.h */
3 /*
4  * Copyright (C) 2009 by the Massachusetts Institute of Technology.
5  * All rights reserved.
6  *
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.
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 M.I.T. not be used in advertising or publicity pertaining
18  * to distribution of the software without specific, written prior
19  * permission.  Furthermore if you modify this software you must label
20  * your software as modified software and not distribute it in such a
21  * fashion that it might be confused with the original M.I.T. software.
22  * M.I.T. makes no representations about the suitability of
23  * this software for any purpose.  It is provided "as is" without express
24  * or implied warranty.
25  */
26
27 #ifndef KRB_FAST_H
28
29 #define KRB_FAST_H
30
31 #include <k5-int.h>
32
33 struct krb5int_fast_request_state {
34     krb5_kdc_req fast_outer_request;
35     krb5_keyblock *armor_key; /*non-null means fast is in use*/
36     krb5_fast_armor *armor;
37     krb5_ui_4 fast_state_flags;
38     krb5_ui_4 fast_options;
39     krb5_int32 nonce;
40 };
41
42 #define KRB5INT_FAST_DO_FAST     (1l<<0)  /* Perform FAST */
43 #define KRB5INT_FAST_ARMOR_AVAIL (1l<<1)
44
45 krb5_error_code
46 krb5int_fast_prep_req_body(krb5_context context,
47                            struct krb5int_fast_request_state *state,
48                            krb5_kdc_req *request,
49                            krb5_data **encoded_req_body);
50
51 typedef krb5_error_code (*kdc_req_encoder_proc)(const krb5_kdc_req *,
52                                                 krb5_data **);
53
54 krb5_error_code
55 krb5int_fast_prep_req(krb5_context context,
56                       struct krb5int_fast_request_state *state,
57                       krb5_kdc_req *request,
58                       const krb5_data *to_be_checksummed,
59                       kdc_req_encoder_proc encoder,
60                       krb5_data **encoded_request);
61
62 krb5_error_code
63 krb5int_fast_process_error(krb5_context context,
64                            struct krb5int_fast_request_state *state,
65                            krb5_error **err_replyptr,
66                            krb5_pa_data ***out_padata,
67                            krb5_boolean *retry);
68
69 krb5_error_code
70 krb5int_fast_process_response(krb5_context context,
71                               struct krb5int_fast_request_state *state,
72                               krb5_kdc_rep *resp,
73                               krb5_keyblock **strengthen_key);
74
75 krb5_error_code
76 krb5int_fast_make_state(krb5_context context,
77                         struct krb5int_fast_request_state **state);
78
79 void
80 krb5int_fast_free_state(krb5_context context,
81                         struct krb5int_fast_request_state *state);
82
83 krb5_error_code
84 krb5int_fast_as_armor(krb5_context context,
85                       struct krb5int_fast_request_state *state,
86                       krb5_gic_opt_ext *opte, krb5_kdc_req *request);
87
88 krb5_error_code
89 krb5int_fast_reply_key(krb5_context context,
90                        krb5_keyblock *strengthen_key,
91                        krb5_keyblock *existing_key, krb5_keyblock *output_key);
92
93
94 krb5_error_code
95 krb5int_fast_verify_nego(krb5_context context,
96                          struct krb5int_fast_request_state *state,
97                          krb5_kdc_rep *rep, krb5_data *request,
98                          krb5_keyblock *decrypting_key,
99                          krb5_boolean *fast_avail);
100
101 krb5_boolean
102 krb5int_upgrade_to_fast_p(krb5_context context,
103                           struct krb5int_fast_request_state *state,
104                           krb5_pa_data **padata);
105
106 #endif