aboutsummaryrefslogtreecommitdiff
path: root/tests/test-crypto-hash.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-09-29 12:43:35 +0100
committerDaniel P. Berrange <berrange@redhat.com>2016-10-19 10:23:55 +0100
commitd26d6b5d34f825c452f9bf3c9d5126181b10f25b (patch)
tree12bf3ac59b3611dbff012010847bfc5b17e047b4 /tests/test-crypto-hash.c
parent48b95ea4f0933c13d778c0478cb82bbfdd515981 (diff)
crypto: fix initialization of crypto in tests
The test-io-channel-tls test was missing a call to qcrypto_init and test-crypto-hash was initializing it multiple times, Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'tests/test-crypto-hash.c')
-rw-r--r--tests/test-crypto-hash.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/tests/test-crypto-hash.c b/tests/test-crypto-hash.c
index 42fc77a107..214a9f72c3 100644
--- a/tests/test-crypto-hash.c
+++ b/tests/test-crypto-hash.c
@@ -89,8 +89,6 @@ static void test_hash_alloc(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
uint8_t *result = NULL;
size_t resultlen = 0;
@@ -123,8 +121,6 @@ static void test_hash_prealloc(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
uint8_t *result;
size_t resultlen;
@@ -161,8 +157,6 @@ static void test_hash_iov(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
struct iovec iov[3] = {
{ .iov_base = (char *)INPUT_TEXT1, .iov_len = strlen(INPUT_TEXT1) },
@@ -199,8 +193,6 @@ static void test_hash_digest(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
int ret;
char *digest;
@@ -230,8 +222,6 @@ static void test_hash_base64(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
int ret;
char *digest;
@@ -253,6 +243,8 @@ static void test_hash_base64(void)
int main(int argc, char **argv)
{
+ g_assert(qcrypto_init(NULL) == 0);
+
g_test_init(&argc, &argv, NULL);
g_test_add_func("/crypto/hash/iov", test_hash_iov);
g_test_add_func("/crypto/hash/alloc", test_hash_alloc);