#include <stddef.h>
#include <setjmp.h>
#include <string.h>
- #include <stdio.h>
+#include <stdio.h>
#include "zrtp.h"
#include "cmockery/cmockery.h"
* 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;
/*
* 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");
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),
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 {
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);
}