From 838782f19810d38ef2ffe556426faaf6e49d42f5 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Sun, 12 May 2013 20:57:19 -0400 Subject: [PATCH] [test suite] added fko_destroy() calls to fko-wrapper --- test/fko-wrapper/fko_wrapper.c | 127 ++++++++++++++++++++++++++++++--- 1 file changed, 118 insertions(+), 9 deletions(-) diff --git a/test/fko-wrapper/fko_wrapper.c b/test/fko-wrapper/fko_wrapper.c index 2b710152..2b0ad1ab 100644 --- a/test/fko-wrapper/fko_wrapper.c +++ b/test/fko-wrapper/fko_wrapper.c @@ -13,119 +13,229 @@ #include "fko.h" #define ENABLE_GPG_TESTS 0 -#define FCN_CALLS 5 +#define FCN_CALLS 5 +#define CTX_DESTROY 0 +#define NO_CTX_DESTROY 1 static void display_ctx(fko_ctx_t ctx); +static void test_loop(int destroy_ctx_flag); int main(void) { + test_loop(NO_CTX_DESTROY); + test_loop(CTX_DESTROY); + + return 0; +} + +static void +test_loop(int destroy_ctx_flag) +{ fko_ctx_t ctx = NULL, decrypt_ctx = NULL; int i; - char *spa_data; + char *spa_data = NULL; printf("fko_new(): %d\n", fko_new(&ctx)); for (i=0; i" : spa_data); + if (destroy_ctx_flag == CTX_DESTROY) + { + fko_destroy(ctx); + ctx = NULL; + } } /* now decrypt */ printf("fko_new_with_data(): %d\n", fko_new_with_data(&decrypt_ctx, spa_data, NULL, - 0, ctx->encryption_mode, NULL, 0, 0)); + 0, FKO_ENC_MODE_CBC, NULL, 0, 0)); for (i=0; i" : spa_message); printf(" Nat Access: %s\n", nat_access == NULL ? "" : nat_access); printf(" Server Auth: %s\n", server_auth == NULL ? "" : server_auth); - printf(" Client Timeout: %u\n", client_timeout); + printf(" Client Timeout: %d\n", client_timeout); printf(" Digest Type: %d\n", digest_type); printf(" HMAC Type: %d\n", hmac_type); printf("Encryption Mode: %d\n", encryption_mode); @@ -192,4 +302,3 @@ display_ctx(fko_ctx_t ctx) printf("\nFinal Packed/Encrypted/Encoded Data:\n\n%s\n\n", spa_data); } -