From: Timo Sirainen Date: Sun, 19 Jun 2016 19:27:00 +0000 (+0300) Subject: lib-dcrypt: Check for all the return values in unit tests X-Git-Tag: 2.2.25.rc1~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7caacdeeea8cc587b8c963af7d6ee067adb8894f;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: Check for all the return values in unit tests --- diff --git a/src/lib-dcrypt/test-crypto.c b/src/lib-dcrypt/test-crypto.c index d1fb75cafe..afc0c92c4e 100644 --- a/src/lib-dcrypt/test-crypto.c +++ b/src/lib-dcrypt/test-crypto.c @@ -134,7 +134,7 @@ void test_cipher_aead_test_vectors(void) test_assert(dcrypt_ctx_sym_init(ctx, &error)); test_assert(dcrypt_ctx_sym_update(ctx, pt->data, pt->used, res, &error)); test_assert(dcrypt_ctx_sym_final(ctx, res, &error)); - dcrypt_ctx_sym_get_tag(ctx, tag_res); + test_assert(dcrypt_ctx_sym_get_tag(ctx, tag_res)); test_assert(buffer_cmp(ct, res) == TRUE); test_assert(buffer_cmp(tag, tag_res) == TRUE); @@ -205,7 +205,7 @@ void test_load_v1_key(void) /* check that key_id matches */ struct dcrypt_public_key *pubkey = NULL; dcrypt_key_convert_private_to_public(pkey, &pubkey); - dcrypt_key_store_public(pubkey, DCRYPT_FORMAT_DOVECOT, key_1, NULL); + test_assert(dcrypt_key_store_public(pubkey, DCRYPT_FORMAT_DOVECOT, key_1, NULL)); buffer_set_used_size(key_1, 0); dcrypt_key_id_public(pubkey, "sha256", key_1, &error); test_assert(strcmp("792caad4d38c9eb2134a0cbc844eae386116de096a0ccafc98479825fc99b6a1", binary_to_hex(key_1->data, key_1->used)) == 0); @@ -219,9 +219,9 @@ void test_load_v1_key(void) /* check that key_id matches */ struct dcrypt_public_key *pubkey = NULL; dcrypt_key_convert_private_to_public(pkey2, &pubkey); - dcrypt_key_store_public(pubkey, DCRYPT_FORMAT_DOVECOT, key_1, NULL); + test_assert(dcrypt_key_store_public(pubkey, DCRYPT_FORMAT_DOVECOT, key_1, NULL)); buffer_set_used_size(key_1, 0); - dcrypt_key_id_public_old(pubkey, key_1, &error); + test_assert(dcrypt_key_id_public_old(pubkey, key_1, &error)); test_assert(strcmp("7c9a1039ea2e4fed73e81dd3ffc3fa22ea4a28352939adde7bf8ea858b00fa4f", binary_to_hex(key_1->data, key_1->used)) == 0); dcrypt_key_free_public(&pubkey); diff --git a/src/lib-dcrypt/test-stream.c b/src/lib-dcrypt/test-stream.c index 2384ba2924..9031bd1c35 100644 --- a/src/lib-dcrypt/test-stream.c +++ b/src/lib-dcrypt/test-stream.c @@ -220,10 +220,10 @@ int main(void) { dcrypt_initialize("openssl", NULL, NULL); random_init(); - dcrypt_key_load_private(&test_v1_kp.priv, DCRYPT_FORMAT_PEM, key_v1_priv, NULL, NULL, NULL); - dcrypt_key_load_public(&test_v1_kp.pub, DCRYPT_FORMAT_PEM, key_v1_pub, NULL); - dcrypt_key_load_private(&test_v2_kp.priv, DCRYPT_FORMAT_PEM, key_v2_priv, NULL, NULL, NULL); - dcrypt_key_load_public(&test_v2_kp.pub, DCRYPT_FORMAT_PEM, key_v2_pub, NULL); + test_assert(dcrypt_key_load_private(&test_v1_kp.priv, DCRYPT_FORMAT_PEM, key_v1_priv, NULL, NULL, NULL)); + test_assert(dcrypt_key_load_public(&test_v1_kp.pub, DCRYPT_FORMAT_PEM, key_v1_pub, NULL)); + test_assert(dcrypt_key_load_private(&test_v2_kp.priv, DCRYPT_FORMAT_PEM, key_v2_priv, NULL, NULL, NULL)); + test_assert(dcrypt_key_load_public(&test_v2_kp.pub, DCRYPT_FORMAT_PEM, key_v2_pub, NULL)); static void (*test_functions[])(void) = { test_static_v1_input,