summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-02-21 19:00:15 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-02-21 19:00:15 +0100
commit864be199082e2eb7fd291d7d6443971081edf74c (patch)
tree37ed6d75c6f6b2b35a6d9236018d68d5181c1e2a
parent48d453468b5995da66d3ef55b2f94f41485c8831 (diff)
downloadgnutls-864be199082e2eb7fd291d7d6443971081edf74c.tar.gz
added error reporting
-rw-r--r--tests/gc.c9
-rw-r--r--tests/pskself.c18
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/gc.c b/tests/gc.c
index 5058592bdc..2cc06941d7 100644
--- a/tests/gc.c
+++ b/tests/gc.c
@@ -32,6 +32,12 @@
#include "../lib/x509/pbkdf2-sha1.h"
#include "../lib/debug.h"
+static void
+tls_log_func (int level, const char *str)
+{
+ fprintf (stderr, "|<%d>| %s", level, str);
+}
+
void
doit (void)
{
@@ -40,6 +46,9 @@ doit (void)
/* XXX: We need this to fix secure memory. */
gnutls_global_init ();
+ gnutls_global_set_log_function (tls_log_func);
+ if (debug)
+ gnutls_global_set_log_level (4711);
err =
_gnutls_hmac_fast (GNUTLS_MAC_MD5, "keykeykey", 9, "abcdefgh", 8, digest);
diff --git a/tests/pskself.c b/tests/pskself.c
index f4c058b70c..f6eed94c69 100644
--- a/tests/pskself.c
+++ b/tests/pskself.c
@@ -46,6 +46,14 @@
/* A very basic TLS client, with PSK authentication.
*/
+const char* side = "";
+
+static void
+tls_log_func (int level, const char *str)
+{
+ fprintf (stderr, "%s|<%d>| %s", side, level, str);
+}
+
#define MAX_BUF 1024
#define MSG "Hello TLS"
@@ -60,6 +68,11 @@ client (void)
const gnutls_datum_t key = { (void *) "DEADBEEF", 8 };
gnutls_global_init ();
+ gnutls_global_set_log_function (tls_log_func);
+ if (debug)
+ gnutls_global_set_log_level (4711);
+
+ side = "client";
gnutls_psk_allocate_client_credentials (&pskcred);
gnutls_psk_set_client_credentials (pskcred, "test", &key,
@@ -237,6 +250,11 @@ server (void)
/* this must be called once in the program
*/
gnutls_global_init ();
+ gnutls_global_set_log_function (tls_log_func);
+ if (debug)
+ gnutls_global_set_log_level (4711);
+
+ side = "server";
gnutls_psk_allocate_server_credentials (&server_pskcred);
gnutls_psk_set_server_credentials_function (server_pskcred, pskfunc);