2 * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
3 * Free Software Foundation, Inc.
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GnuTLS.
9 * The GnuTLS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
26 #include "gnutls_int.h"
27 #include "gnutls_errors.h"
31 #include <gnutls_mpi.h>
34 _gnutls_dump_mpi (const char *prefix
, bigint_t a
)
37 char buf_hex
[2 * sizeof (buf
)];
38 size_t n
= sizeof buf
;
40 if (_gnutls_mpi_print (a
, buf
, &n
))
41 strcpy (buf
, "[can't print value]"); /* Flawfinder: ignore */
42 _gnutls_debug_log ("MPI: length: %d\n\t%s%s\n", (int) n
, prefix
,
43 _gnutls_bin2hex (buf
, n
, buf_hex
, sizeof (buf_hex
),
49 _gnutls_packet2str (content_type_t packet
)
53 case GNUTLS_CHANGE_CIPHER_SPEC
:
54 return "Change Cipher Spec";
57 case GNUTLS_HANDSHAKE
:
59 case GNUTLS_APPLICATION_DATA
:
60 return "Application Data";
61 case GNUTLS_INNER_APPLICATION
:
62 return "Inner Application";
65 return "Unknown Packet";
70 _gnutls_handshake2str (gnutls_handshake_description_t handshake
)
75 case GNUTLS_HANDSHAKE_HELLO_REQUEST
:
76 return "HELLO REQUEST";
78 case GNUTLS_HANDSHAKE_CLIENT_HELLO
:
79 return "CLIENT HELLO";
81 case GNUTLS_HANDSHAKE_SERVER_HELLO
:
82 return "SERVER HELLO";
84 case GNUTLS_HANDSHAKE_CERTIFICATE_PKT
:
87 case GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE
:
88 return "SERVER KEY EXCHANGE";
90 case GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST
:
91 return "CERTIFICATE REQUEST";
93 case GNUTLS_HANDSHAKE_SERVER_HELLO_DONE
:
94 return "SERVER HELLO DONE";
96 case GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY
:
97 return "CERTIFICATE VERIFY";
99 case GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE
:
100 return "CLIENT KEY EXCHANGE";
102 case GNUTLS_HANDSHAKE_FINISHED
:
105 case GNUTLS_HANDSHAKE_SUPPLEMENTAL
:
106 return "SUPPLEMENTAL";
108 case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET
:
109 return "NEW SESSION TICKET";
112 return "Unknown Handshake packet";