2 * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include "gnutls_int.h"
26 #include "gnutls_errors.h"
35 _gnutls_print_state (gnutls_session_t session
)
38 _gnutls_debug_log ("GNUTLS State:\n");
39 _gnutls_debug_log ("Connection End: %d\n",
40 session
->security_parameters
.entity
);
41 _gnutls_debug_log ("Cipher Algorithm: %d\n",
42 session
->security_parameters
.read_bulk_cipher_algorithm
);
43 _gnutls_debug_log ("MAC algorithm: %d\n",
44 session
->security_parameters
.read_mac_algorithm
);
45 _gnutls_debug_log ("Compression Algorithm: %d\n",
46 session
->security_parameters
.read_compression_algorithm
);
47 _gnutls_debug_log ("\n");
54 _gnutls_packet2str (content_type_t packet
)
58 case GNUTLS_CHANGE_CIPHER_SPEC
:
59 return "Change Cipher Spec";
62 case GNUTLS_HANDSHAKE
:
64 case GNUTLS_APPLICATION_DATA
:
65 return "Application Data";
66 case GNUTLS_INNER_APPLICATION
:
67 return "Inner Application";
70 return "Unknown Packet";
75 _gnutls_handshake2str (gnutls_handshake_description_t handshake
)
80 case GNUTLS_HANDSHAKE_HELLO_REQUEST
:
81 return "HELLO REQUEST";
83 case GNUTLS_HANDSHAKE_CLIENT_HELLO
:
84 return "CLIENT HELLO";
86 case GNUTLS_HANDSHAKE_SERVER_HELLO
:
87 return "SERVER HELLO";
89 case GNUTLS_HANDSHAKE_CERTIFICATE_PKT
:
92 case GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE
:
93 return "SERVER KEY EXCHANGE";
95 case GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST
:
96 return "CERTIFICATE REQUEST";
98 case GNUTLS_HANDSHAKE_SERVER_HELLO_DONE
:
99 return "SERVER HELLO DONE";
101 case GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY
:
102 return "CERTIFICATE VERIFY";
104 case GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE
:
105 return "CLIENT KEY EXCHANGE";
107 case GNUTLS_HANDSHAKE_FINISHED
:
110 case GNUTLS_HANDSHAKE_SUPPLEMENTAL
:
111 return "SUPPLEMENTAL";
114 return "Unknown Handshake packet";
120 _gnutls_dump_mpi (const char *prefix
, mpi_t a
)
123 size_t n
= sizeof buf
;
125 if (gcry_mpi_print (GCRYMPI_FMT_HEX
, buf
, n
, &n
, a
))
126 strcpy (buf
, "[can't print value]"); /* Flawfinder: ignore */
127 _gnutls_hard_log ("MPI: length: %d\n\t%s%s\n", (n
- 1) / 2, prefix
, buf
);