X-Git-Url: https://git.toastfreeware.priv.at/debian/iodine.git/blobdiff_plain/e0c989f43a67e3df499db03e16368bce741d4a3f..2662615bea0bc61afc36ec018f0bf515c3991778:/tests/login.c?ds=inline diff --git a/tests/login.c b/tests/login.c index 2745c92..1ef23f4 100644 --- a/tests/login.c +++ b/tests/login.c @@ -28,7 +28,7 @@ START_TEST(test_login_hash) int len; int seed; - len = 16; + len = sizeof(ans); seed = 15; memset(ans, 0, sizeof(ans)); @@ -37,6 +37,26 @@ START_TEST(test_login_hash) } END_TEST +START_TEST(test_login_hash_short) +{ + char ans[8]; + char check[sizeof(ans)]; + char pass[32] = "iodine is the shit"; + int len; + int seed; + + len = sizeof(ans); + seed = 15; + + memset(ans, 0, sizeof(ans)); + memset(check, 0, sizeof(check)); + + /* If len < 16, it should do nothing */ + login_calculate(ans, len, pass, seed); + fail_if(memcmp(ans, check, sizeof(ans))); +} +END_TEST + TCase * test_login_create_tests() { @@ -44,6 +64,7 @@ test_login_create_tests() tc = tcase_create("Login"); tcase_add_test(tc, test_login_hash); + tcase_add_test(tc, test_login_hash_short); return tc; }