From f1ef7b2a3875e13de3a6b835951ec319a4513f81 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Fri, 6 Mar 2015 20:02:19 +0000 Subject: bugfix wrong pointer --- src/unittest.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/unittest.cpp') diff --git a/src/unittest.cpp b/src/unittest.cpp index a9e6bf9..2aa1edc 100644 --- a/src/unittest.cpp +++ b/src/unittest.cpp @@ -166,8 +166,8 @@ void testCrypt() c->decrypt(*kd, encrypted_packet, plain_packet); - if (memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) { - std::cerr << "crypto test failed" << std::endl; + if (int pos = memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) { + std::cerr << "crypto test failed at position "<< pos << std::endl; std::cout << test_text << std::endl; ssize_t len = write(0, plain_packet.getPayload(), plain_packet.getLength()); if (len) @@ -187,8 +187,8 @@ void testCrypt() //exit(-1); } cnew->decrypt(encrypted_packet, plain_packet, masterkey, mastersalt, ROLE_RIGHT ); - if (memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) { - std::cerr << "crypto test failed" << std::endl; + if (int pos = memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) { + std::cerr << "crypto test failed at position "<< pos << std::endl; std::cout << test_text << std::endl; ssize_t len = write(0, plain_packet.getPayload(), plain_packet.getLength()); if (len) @@ -234,8 +234,8 @@ void newCrypt() } cnew->decrypt(encrypted_packet, plain_packet, masterkey, mastersalt, ROLE_RIGHT ); - if (memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) { - std::cerr << "crypto test failed" << std::endl; + if (int pos = memcmp(plain_packet.getPayload(), test_text, sizeof(test_text))) { + std::cerr << "crypto test failed at position "<< pos << std::endl; std::cout << test_text << std::endl; ssize_t len = write(0, plain_packet.getPayload(), plain_packet.getLength()); if (len) -- cgit v1.2.3