xref: /freebsd/crypto/krb5/src/plugins/preauth/spake/trace.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2*7f2fe78bSCy Schubert /* plugins/preauth/spake/internal.h - SPAKE internal function declarations */
3*7f2fe78bSCy Schubert /*
4*7f2fe78bSCy Schubert  * Copyright (C) 2015 by the Massachusetts Institute of Technology.
5*7f2fe78bSCy Schubert  * All rights reserved.
6*7f2fe78bSCy Schubert  *
7*7f2fe78bSCy Schubert  * Redistribution and use in source and binary forms, with or without
8*7f2fe78bSCy Schubert  * modification, are permitted provided that the following conditions
9*7f2fe78bSCy Schubert  * are met:
10*7f2fe78bSCy Schubert  *
11*7f2fe78bSCy Schubert  * * Redistributions of source code must retain the above copyright
12*7f2fe78bSCy Schubert  *   notice, this list of conditions and the following disclaimer.
13*7f2fe78bSCy Schubert  *
14*7f2fe78bSCy Schubert  * * Redistributions in binary form must reproduce the above copyright
15*7f2fe78bSCy Schubert  *   notice, this list of conditions and the following disclaimer in
16*7f2fe78bSCy Schubert  *   the documentation and/or other materials provided with the
17*7f2fe78bSCy Schubert  *   distribution.
18*7f2fe78bSCy Schubert  *
19*7f2fe78bSCy Schubert  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20*7f2fe78bSCy Schubert  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21*7f2fe78bSCy Schubert  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22*7f2fe78bSCy Schubert  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23*7f2fe78bSCy Schubert  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24*7f2fe78bSCy Schubert  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25*7f2fe78bSCy Schubert  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26*7f2fe78bSCy Schubert  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27*7f2fe78bSCy Schubert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28*7f2fe78bSCy Schubert  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29*7f2fe78bSCy Schubert  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30*7f2fe78bSCy Schubert  * OF THE POSSIBILITY OF SUCH DAMAGE.
31*7f2fe78bSCy Schubert  */
32*7f2fe78bSCy Schubert 
33*7f2fe78bSCy Schubert #ifndef TRACE_H
34*7f2fe78bSCy Schubert #define TRACE_H
35*7f2fe78bSCy Schubert 
36*7f2fe78bSCy Schubert #include "k5-int.h"
37*7f2fe78bSCy Schubert 
38*7f2fe78bSCy Schubert /*
39*7f2fe78bSCy Schubert  * Possible improvements at the cost of more code:
40*7f2fe78bSCy Schubert  * - Groups could be displayed by name instead of number
41*7f2fe78bSCy Schubert  * - We could display the group list when tracing support messages
42*7f2fe78bSCy Schubert  */
43*7f2fe78bSCy Schubert 
44*7f2fe78bSCy Schubert #define TRACE_SPAKE_CLIENT_THASH(c, thash)                      \
45*7f2fe78bSCy Schubert     TRACE(c, "SPAKE final transcript hash: {hexdata}", thash)
46*7f2fe78bSCy Schubert #define TRACE_SPAKE_DERIVE_KEY(c, n, kb)                        \
47*7f2fe78bSCy Schubert     TRACE(c, "SPAKE derived K'[{int}] = {keyblock}", n, kb)
48*7f2fe78bSCy Schubert #define TRACE_SPAKE_KDC_THASH(c, thash)                         \
49*7f2fe78bSCy Schubert     TRACE(c, "SPAKE final transcript hash: {hexdata}", thash)
50*7f2fe78bSCy Schubert #define TRACE_SPAKE_KEYGEN(c, pubkey)                                   \
51*7f2fe78bSCy Schubert     TRACE(c, "SPAKE key generated with pubkey {hexdata}", pubkey)
52*7f2fe78bSCy Schubert #define TRACE_SPAKE_RECEIVE_CHALLENGE(c, group, pubkey)                 \
53*7f2fe78bSCy Schubert     TRACE(c, "SPAKE challenge received with group {int}, pubkey {hexdata}", \
54*7f2fe78bSCy Schubert           group, pubkey)
55*7f2fe78bSCy Schubert #define TRACE_SPAKE_RECEIVE_RESPONSE(c, pubkey)                         \
56*7f2fe78bSCy Schubert     TRACE(c, "SPAKE response received with pubkey {hexdata}", pubkey)
57*7f2fe78bSCy Schubert #define TRACE_SPAKE_RECEIVE_SUPPORT(c, group)                           \
58*7f2fe78bSCy Schubert     TRACE(c, "SPAKE support message received, selected group {int}", group)
59*7f2fe78bSCy Schubert #define TRACE_SPAKE_REJECT_CHALLENGE(c, group)                          \
60*7f2fe78bSCy Schubert     TRACE(c, "SPAKE challenge with group {int} rejected", (int)group)
61*7f2fe78bSCy Schubert #define TRACE_SPAKE_REJECT_SUPPORT(c)           \
62*7f2fe78bSCy Schubert     TRACE(c, "SPAKE support message rejected")
63*7f2fe78bSCy Schubert #define TRACE_SPAKE_RESULT(c, result)                           \
64*7f2fe78bSCy Schubert     TRACE(c, "SPAKE algorithm result: {hexdata}", result)
65*7f2fe78bSCy Schubert #define TRACE_SPAKE_SEND_CHALLENGE(c, group)                    \
66*7f2fe78bSCy Schubert     TRACE(c, "Sending SPAKE challenge with group {int}", group)
67*7f2fe78bSCy Schubert #define TRACE_SPAKE_SEND_RESPONSE(c)            \
68*7f2fe78bSCy Schubert     TRACE(c, "Sending SPAKE response")
69*7f2fe78bSCy Schubert #define TRACE_SPAKE_SEND_SUPPORT(c)             \
70*7f2fe78bSCy Schubert     TRACE(c, "Sending SPAKE support message")
71*7f2fe78bSCy Schubert #define TRACE_SPAKE_UNKNOWN_GROUP(c, name)                      \
72*7f2fe78bSCy Schubert     TRACE(c, "Unrecognized SPAKE group name: {str}", name)
73*7f2fe78bSCy Schubert 
74*7f2fe78bSCy Schubert #endif /* TRACE_H */
75