* for more details.
*/
+#define _GNU_SOURCE
+#include <dlfcn.h>
+
#include "crypto_tester.h"
#include <debug.h>
};
/**
+ * Get the name of a test vector, if available
+ */
+static const char* get_name(void *sym)
+{
+#ifdef HAVE_DLADDR
+ Dl_info dli;
+
+ if (dladdr(sym, &dli))
+ {
+ return dli.dli_sname;
+ }
+#endif
+ return "unknown";
+}
+
+/**
* Implementation of crypto_tester_t.test_crypter
*/
static bool test_crypter(private_crypto_tester_t *this,
crypter->destroy(crypter);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: test vector %u failed",
- encryption_algorithm_names, alg, tested);
+ DBG1(DBG_LIB, "disabled %N: %s test vector failed",
+ encryption_algorithm_names, alg, get_name(vector));
break;
}
}
signer->destroy(signer);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: test vector %u failed",
- integrity_algorithm_names, alg, tested);
+ DBG1(DBG_LIB, "disabled %N: %s test vector failed",
+ integrity_algorithm_names, alg, get_name(vector));
break;
}
}
hasher->destroy(hasher);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: test vector %u failed",
- hash_algorithm_names, alg, tested);
+ DBG1(DBG_LIB, "disabled %N: %s test vector failed",
+ hash_algorithm_names, alg, get_name(vector));
break;
}
}
prf->destroy(prf);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: test vector %u failed",
- pseudo_random_function_names, alg, tested);
+ DBG1(DBG_LIB, "disabled %N: %s test vector failed",
+ pseudo_random_function_names, alg, get_name(vector));
break;
}
}
rng->destroy(rng);
if (failed)
{
- DBG1(DBG_LIB, "disabled %N: test vector %u failed",
- rng_quality_names, quality, tested);
+ DBG1(DBG_LIB, "disabled %N: %s test vector failed",
+ rng_quality_names, quality, get_name(vector));
break;
}
}