]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Clean up in libzrtp tests
authorViktor Krykun <viktor@krykun.com>
Fri, 15 Jun 2012 07:23:46 +0000 (10:23 +0300)
committerTravis Cross <tc@traviscross.com>
Mon, 11 Feb 2013 16:41:53 +0000 (16:41 +0000)
Modified-by: Travis Cross <tc@traviscross.com>
Signed-off-by: Travis Cross <tc@traviscross.com>
libs/libzrtp/test/cache_test.c
libs/libzrtp/test/cipher_test.c
libs/libzrtp/test/test_engine.c

index 8ba699ee3f2cd67471e754bc1b276f4540b9ef13..5713249b7eccb3d0ed5529c2005b4ad3acd9b376 100644 (file)
@@ -11,7 +11,7 @@
 #include <stddef.h>
 #include <setjmp.h>
 #include <string.h>
- #include <stdio.h>
+#include <stdio.h>
 
 #include "zrtp.h"
 #include "cmockery/cmockery.h"
@@ -109,7 +109,7 @@ void cache_init_store_empty_test() {
  * Add few entries to the empty cache, flush it and then load again. Check if
  * all the entries were restored successfully.
  */
-void cache_add2empty_test() {  
+void cache_add2empty_test() {
        zrtp_status_t status;   
        int intres;
        
@@ -146,8 +146,8 @@ void cache_save_unchanged_test() {
        
        /*
         * TEST: now let's store the cache making no changes to it.
-         * After opening it should include all the secrets untouched.
-       */
+        * After opening it should include all the secrets untouched.
+        */
        
        printf("==> And the cache again, it should contain all the stored values.\n");
        
index 4098d8b16e2d0bf6b6f2bdcdf6bfd13c796d52fc..8ef7ec15d27b24d000dd5a5b182210ee79576302 100644 (file)
@@ -52,64 +52,7 @@ static void aes256_cfb_test() {
        assert_non_null(cipher);
        cipher->self_test(cipher, ZRTP_CIPHER_MODE_CFB);
 }
-/*
-static void aes256_cfb_test2() {
-               rtp_aes_cfb_ctx_t *ctx = (zrtp_aes_cfb_ctx_t*)self->start( self,
-                                                                                                                                   aes_cfb_test_key,
-                                                                                                                                   NULL,
-                                                                                                                                   ZRTP_CIPHER_MODE_CFB);
-               if (NULL == ctx) {
-                       return zrtp_status_fail;
-               }
-
-               ZRTP_LOG(3, (_ZTU_,"256 bit AES CFB\n"));
-               ZRTP_LOG(3, (_ZTU_, "1st test...\n"));
-
-               zrtp_memcpy(aes_cfb_test_buf2b, aes_cfb_test_buf2a, sizeof(aes_cfb_test_buf2a));
-               zrtp_memcpy(&tmp_iv, aes_cfb_test_iv, sizeof(tmp_iv));
-
-               ZRTP_LOG(3, (_ZTU_, "\tencryption... "));
-
-               self->set_iv(self, ctx, &tmp_iv);
-               err = self->encrypt(self, ctx, aes_cfb_test_buf2b, sizeof(aes_cfb_test_buf2b));
-               if (zrtp_status_ok != err) {
-                       ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB encrypt returns error %d\n", err));
-                       self->stop(self, ctx);
-                       return err;
-               }
 
-               for (i=0; i<16; i++) {
-                       if (aes_cfb_test_buf2b[i] != 0x00) {
-                               ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB failed on encrypt test\n"));
-                               self->stop(self, ctx);
-                               return zrtp_status_fail;
-                       }
-               }
-               ZRTP_LOGC(3, ("OK\n"));
-
-               ZRTP_LOG(3, (_ZTU_, "\tdecryption... "));
-
-               zrtp_memcpy(&tmp_iv, aes_cfb_test_iv, sizeof(tmp_iv));
-               self->set_iv(self, ctx,  &tmp_iv);
-
-               err = self->decrypt(self, ctx, aes_cfb_test_buf2b, sizeof(aes_cfb_test_buf2b));
-               if (zrtp_status_ok != err) {
-                       ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB decrypt returns error %d\n", err));
-                       self->stop(self, ctx);
-                       return err;
-               }
-               for (i=0; i<sizeof(aes_cfb_test_buf2b); i++) {
-                       if (aes_cfb_test_buf2b[i] != aes_cfb_test_buf2a[i]) {
-                               ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB failed on decrypt test\n"));
-                               self->stop(self, ctx);
-                               return zrtp_status_fail;
-                       }
-               }
-               self->stop(self, ctx);
-               ZRTP_LOGC(3, ("OK\n"));
-
-}
-*/
 int main(void) {
        const UnitTest tests[] = {
                unit_test_setup_teardown(aes128_ctr_test, setup, teardown),
index 3b40985f579d47269e1de4a837561058407060c7..8ec6fc23815a5968dc82a7f5c505530c89ae9d2d 100644 (file)
@@ -132,7 +132,6 @@ static int on_send_packet(const zrtp_stream_t* ctx, char* message, unsigned int
                zrtp_test_id_t *stream_id = zrtp_stream_get_userdata(ctx);
                zrtp_test_stream_t *stream = zrtp_test_stream_by_id(*stream_id);
                if (stream) {
-                       printf("trace>>> PUSH from stream ID=%u\n", stream->id);
                        zrtp_test_queue_push(stream->output, elem);
                        return zrtp_status_ok;
                } else {
@@ -168,24 +167,8 @@ static zrtp_test_stream_t *get_stream_to_process_(zrtp_endpoint_t *endpoint) {
        j = (unsigned)i;
        j = j % streams_count;
 
-       printf("trace>>> CHOOSE stream Endpoint=%u IDX=%u ID=%u\n", endpoint->id,  j, all_streams[j]);
+       //printf("trace>>> CHOOSE stream Endpoint=%u IDX=%u ID=%u\n", endpoint->id,  j, all_streams[j]);
        return zrtp_test_stream_by_id(all_streams[j]);
-
-
-//     unsigned is_found = 0;
-//     zrtp_test_id_t result, left;
-//     for (i=0; i<streams_count; i++) {
-//             result = all_streams[i];
-//             if (result > stream_id) {
-//                     is_found = 1;
-//                     break;
-//             } else {
-//                     left = result;
-//             }
-//     }
-//
-//     printf("TRACE>>> choose stream ID=%u\n", is_found ? result : left);
-//     return zrtp_test_stream_by_id(is_found ? result : left);
 }