From 0c5e4290e141eb0c66fa3ddc2c9e20b07e7feea1 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Thu, 22 May 2014 14:11:13 +0200
Subject: [PATCH] benchmark application also works without POLARSSL_ERROR_C
---
programs/test/benchmark.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index 7077518b1..7262b563e 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -121,6 +121,15 @@ do { \
( hardclock() - tsc ) / ( j * BUFSIZE ) ); \
} while( 0 )
+#if defined(POLARSSL_ERROR_C)
+#define PRINT_ERROR \
+ polarssl_strerror( ret, ( char * )tmp, sizeof( tmp ) ); \
+ printf( "FAILED: %s\n", tmp );
+#else
+#define PRINT_ERROR \
+ printf( "FAILED: -0x%04x\n", -ret );
+#endif
+
#define TIME_PUBLIC( TITLE, TYPE, CODE ) \
do { \
unsigned long i; \
@@ -138,8 +147,7 @@ do { \
\
if( ret != 0 ) \
{ \
- polarssl_strerror( ret, ( char * )tmp, sizeof( tmp ) ); \
- printf( "FAILED: %s\n", tmp ); \
+PRINT_ERROR; \
} \
else \
printf( "%9lu " TYPE "/s\n", i / 3 ); \