Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ciphers/aes/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ int ECB_TEST(void)

rijndael_ecb_encrypt(tests[i].pt, tmp[0], &key);
rijndael_ecb_decrypt(tmp[0], tmp[1], &key);
if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES Encrypt", i) ||
compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES Decrypt", i)) {
if (ltc_compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES Encrypt", i) ||
ltc_compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES Decrypt", i)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/aes/aes_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ int AES_TEST(void)
}

AES_ENC(tests[i].pt, tmp[0], &key);
if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES Encrypt", i)) {
if (ltc_compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES Encrypt", i)) {
return CRYPT_FAIL_TESTVECTOR;
}
#ifndef ENCRYPT_ONLY
AES_DEC(tmp[0], tmp[1], &key);
if (compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES Decrypt", i)) {
if (ltc_compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES Decrypt", i)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/aes/aesni.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ int aesni_test(void)

aesni_ecb_encrypt(tests[i].pt, tmp[0], &key);
aesni_ecb_decrypt(tmp[0], tmp[1], &key);
if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES-NI Encrypt", i) ||
compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES-NI Decrypt", i)) {
if (ltc_compare_testvector(tmp[0], 16, tests[i].ct, 16, "AES-NI Encrypt", i) ||
ltc_compare_testvector(tmp[1], 16, tests[i].pt, 16, "AES-NI Decrypt", i)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
6 changes: 3 additions & 3 deletions src/ciphers/anubis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1502,14 +1502,14 @@ int anubis_test(void)
anubis_setup(tests[x].key, tests[x].keylen, 0, &skey);
anubis_ecb_encrypt(tests[x].pt, buf[0], &skey);
anubis_ecb_decrypt(buf[0], buf[1], &skey);
if (compare_testvector(buf[0], 16, tests[x].ct, 16, "Anubis Encrypt", x) ||
compare_testvector(buf[1], 16, tests[x].pt, 16, "Anubis Decrypt", x)) {
if (ltc_compare_testvector(buf[0], 16, tests[x].ct, 16, "Anubis Encrypt", x) ||
ltc_compare_testvector(buf[1], 16, tests[x].pt, 16, "Anubis Decrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}

for (y = 0; y < 1000; y++) anubis_ecb_encrypt(buf[0], buf[0], &skey);
for (y = 0; y < 1000; y++) anubis_ecb_decrypt(buf[0], buf[0], &skey);
if (compare_testvector(buf[0], 16, tests[x].ct, 16, "Anubis 1000", 1000)) {
if (ltc_compare_testvector(buf[0], 16, tests[x].ct, 16, "Anubis 1000", 1000)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/blowfish.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,8 @@ int blowfish_test(void)
blowfish_ecb_decrypt(tmp[0], tmp[1], &key);

/* compare */
if ((compare_testvector(tmp[0], 8, tests[x].ct, 8, "Blowfish Encrypt", x) != 0) ||
(compare_testvector(tmp[1], 8, tests[x].pt, 8, "Blowfish Decrypt", x) != 0)) {
if ((ltc_compare_testvector(tmp[0], 8, tests[x].ct, 8, "Blowfish Encrypt", x) != 0) ||
(ltc_compare_testvector(tmp[1], 8, tests[x].pt, 8, "Blowfish Decrypt", x) != 0)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/camellia.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ int camellia_test(void)
return err;
}
camellia_done(&skey);
if (compare_testvector(tests[x].ct, 16, buf[0], 16, "Camellia Encrypt", x) ||
compare_testvector(tests[x].pt, 16, buf[1], 16, "Camellia Decrypt", x)) {
if (ltc_compare_testvector(tests[x].ct, 16, buf[0], 16, "Camellia Encrypt", x) ||
ltc_compare_testvector(tests[x].pt, 16, buf[1], 16, "Camellia Decrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/cast5.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ int cast5_test(void)
}
cast5_ecb_encrypt(tests[i].pt, tmp[0], &key);
cast5_ecb_decrypt(tmp[0], tmp[1], &key);
if ((compare_testvector(tmp[0], 8, tests[i].ct, 8, "CAST5 Encrypt", i) != 0) ||
(compare_testvector(tmp[1], 8, tests[i].pt, 8, "CAST5 Decrypt", i) != 0)) {
if ((ltc_compare_testvector(tmp[0], 8, tests[i].ct, 8, "CAST5 Encrypt", i) != 0) ||
(ltc_compare_testvector(tmp[1], 8, tests[i].pt, 8, "CAST5 Decrypt", i) != 0)) {
return CRYPT_FAIL_TESTVECTOR;
}
/* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */
Expand Down
14 changes: 7 additions & 7 deletions src/ciphers/des.c
Original file line number Diff line number Diff line change
Expand Up @@ -2026,13 +2026,13 @@ int des_test(void)

des_ecb_encrypt(cases[i].txt, ct, &skey);

if (compare_testvector(ct, sizeof(ct), cases[i].out, 8, "DES Encrypt", i) != 0) {
if (ltc_compare_testvector(ct, sizeof(ct), cases[i].out, 8, "DES Encrypt", i) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

des_ecb_decrypt(ct, pt, &skey);

if (compare_testvector(pt, sizeof(pt), cases[i].txt, 8, "DES Decrypt", i) != 0) {
if (ltc_compare_testvector(pt, sizeof(pt), cases[i].txt, 8, "DES Decrypt", i) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand All @@ -2049,7 +2049,7 @@ int des_test(void)
for (i = 0; i < 1000; i++) des_ecb_encrypt(tmp, tmp, &skey);
for (i = 0; i < 1000; i++) des_ecb_decrypt(tmp, tmp, &skey);

if (compare_testvector(tmp, 8, pt, 8, "DES", 0) != 0) {
if (ltc_compare_testvector(tmp, 8, pt, 8, "DES", 0) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down Expand Up @@ -2082,7 +2082,7 @@ int desx_test(void)
for (i = 0; i < 1000; i++) desx_ecb_encrypt(tmp, tmp, &skey);
for (i = 0; i < 1000; i++) desx_ecb_decrypt(tmp, tmp, &skey);

if (compare_testvector(tmp, 8, pt, 8, "DES-X", 0) != 0) {
if (ltc_compare_testvector(tmp, 8, pt, 8, "DES-X", 0) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down Expand Up @@ -2133,13 +2133,13 @@ int des3_test(void)

des3_ecb_encrypt(cases[i].txt, ct, &skey);

if (compare_testvector(ct, sizeof(ct), cases[i].out, 8, "3DES Encrypt", i) != 0) {
if (ltc_compare_testvector(ct, sizeof(ct), cases[i].out, 8, "3DES Encrypt", i) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

des3_ecb_decrypt(ct, pt, &skey);

if (compare_testvector(pt, sizeof(pt), cases[i].txt, 8, "3DES Decrypt", i) != 0) {
if (ltc_compare_testvector(pt, sizeof(pt), cases[i].txt, 8, "3DES Decrypt", i) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand All @@ -2156,7 +2156,7 @@ int des3_test(void)
for (i = 0; i < 1000; i++) des3_ecb_encrypt(tmp, tmp, &skey);
for (i = 0; i < 1000; i++) des3_ecb_decrypt(tmp, tmp, &skey);

if (compare_testvector(tmp, 8, pt, 8, "3DES", 0) != 0) {
if (ltc_compare_testvector(tmp, 8, pt, 8, "3DES", 0) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/idea.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@ int idea_test(void)
if ((err = idea_ecb_encrypt(tests[x].pt, buf[0], &key)) != CRYPT_OK) {
return err;
}
if (compare_testvector(buf[0], 8, tests[x].ct, 8, "IDEA Encrypt", x)) {
if (ltc_compare_testvector(buf[0], 8, tests[x].ct, 8, "IDEA Encrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
if ((err = idea_ecb_decrypt(tests[x].ct, buf[1], &key)) != CRYPT_OK) {
return err;
}
if (compare_testvector(buf[1], 8, tests[x].pt, 8, "IDEA Decrypt", x)) {
if (ltc_compare_testvector(buf[1], 8, tests[x].pt, 8, "IDEA Decrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/kasumi.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ int kasumi_test(void)
if ((err = kasumi_ecb_decrypt(tests[x].ct, buf[1], &key)) != CRYPT_OK) {
return err;
}
if (compare_testvector(buf[1], 8, tests[x].pt, 8, "Kasumi Decrypt", x) ||
compare_testvector(buf[0], 8, tests[x].ct, 8, "Kasumi Encrypt", x)) {
if (ltc_compare_testvector(buf[1], 8, tests[x].pt, 8, "Kasumi Decrypt", x) ||
ltc_compare_testvector(buf[0], 8, tests[x].ct, 8, "Kasumi Encrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/ciphers/khazad.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,14 +798,14 @@ int khazad_test(void)
khazad_setup(tests[x].key, 16, 0, &skey);
khazad_ecb_encrypt(tests[x].pt, buf[0], &skey);
khazad_ecb_decrypt(buf[0], buf[1], &skey);
if (compare_testvector(buf[0], 8, tests[x].ct, 8, "Khazad Encrypt", x) ||
compare_testvector(buf[1], 8, tests[x].pt, 8, "Khazad Decrypt", x)) {
if (ltc_compare_testvector(buf[0], 8, tests[x].ct, 8, "Khazad Encrypt", x) ||
ltc_compare_testvector(buf[1], 8, tests[x].pt, 8, "Khazad Decrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}

for (y = 0; y < 1000; y++) khazad_ecb_encrypt(buf[0], buf[0], &skey);
for (y = 0; y < 1000; y++) khazad_ecb_decrypt(buf[0], buf[0], &skey);
if (compare_testvector(buf[0], 8, tests[x].ct, 8, "Khazad 1000", 1000)) {
if (ltc_compare_testvector(buf[0], 8, tests[x].ct, 8, "Khazad 1000", 1000)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/kseed.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ int kseed_test(void)
kseed_setup(tests[x].key, 16, 0, &skey);
kseed_ecb_encrypt(tests[x].pt, buf[0], &skey);
kseed_ecb_decrypt(buf[0], buf[1], &skey);
if (compare_testvector(buf[0], 16, tests[x].ct, 16, "KSEED Encrypt", x) ||
compare_testvector(buf[1], 16, tests[x].pt, 16, "KSEED Decrypt", x)) {
if (ltc_compare_testvector(buf[0], 16, tests[x].ct, 16, "KSEED Encrypt", x) ||
ltc_compare_testvector(buf[1], 16, tests[x].pt, 16, "KSEED Decrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/ciphers/multi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ int multi2_test(void)
return err;
}

if (compare_testvector(buf, 8, tests[x].ct, 8, "Multi2 Encrypt", x)) {
if (ltc_compare_testvector(buf, 8, tests[x].ct, 8, "Multi2 Encrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}

if ((err = multi2_ecb_decrypt(buf, buf, &skey)) != CRYPT_OK) {
return err;
}
if (compare_testvector(buf, 8, tests[x].pt, 8, "Multi2 Decrypt", x)) {
if (ltc_compare_testvector(buf, 8, tests[x].pt, 8, "Multi2 Decrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand All @@ -274,7 +274,7 @@ int multi2_test(void)
if ((err = multi2_ecb_decrypt(ct, buf, &skey)) != CRYPT_OK) {
return err;
}
if (compare_testvector(buf, 8, tests[0].pt, 8, "Multi2 Rounds", x)) {
if (ltc_compare_testvector(buf, 8, tests[0].pt, 8, "Multi2 Rounds", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/noekeon.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ int noekeon_test(void)

noekeon_ecb_encrypt(tests[i].pt, tmp[0], &key);
noekeon_ecb_decrypt(tmp[0], tmp[1], &key);
if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "Noekeon Encrypt", i) ||
compare_testvector(tmp[1], 16, tests[i].pt, 16, "Noekeon Decrypt", i)) {
if (ltc_compare_testvector(tmp[0], 16, tests[i].ct, 16, "Noekeon Encrypt", i) ||
ltc_compare_testvector(tmp[1], 16, tests[i].pt, 16, "Noekeon Decrypt", i)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/rc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ int rc2_test(void)
rc2_ecb_encrypt(tests[x].pt, tmp[0], &skey);
rc2_ecb_decrypt(tmp[0], tmp[1], &skey);

if (compare_testvector(tmp[0], 8, tests[x].ct, 8, "RC2 CT", x) ||
compare_testvector(tmp[1], 8, tests[x].pt, 8, "RC2 PT", x)) {
if (ltc_compare_testvector(tmp[0], 8, tests[x].ct, 8, "RC2 CT", x) ||
ltc_compare_testvector(tmp[1], 8, tests[x].pt, 8, "RC2 PT", x)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/rc5.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ int rc5_test(void)
rc5_ecb_decrypt(tmp[0], tmp[1], &key);

/* compare */
if (compare_testvector(tmp[0], 8, tests[x].ct, 8, "RC5 Encrypt", x) != 0 ||
compare_testvector(tmp[1], 8, tests[x].pt, 8, "RC5 Decrypt", x) != 0) {
if (ltc_compare_testvector(tmp[0], 8, tests[x].ct, 8, "RC5 Encrypt", x) != 0 ||
ltc_compare_testvector(tmp[1], 8, tests[x].pt, 8, "RC5 Decrypt", x) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/rc6.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ int rc6_test(void)
rc6_ecb_decrypt(tmp[0], tmp[1], &key);

/* compare */
if (compare_testvector(tmp[0], 16, tests[x].ct, 16, "RC6 Encrypt", x) ||
compare_testvector(tmp[1], 16, tests[x].pt, 16, "RC6 Decrypt", x)) {
if (ltc_compare_testvector(tmp[0], 16, tests[x].ct, 16, "RC6 Encrypt", x) ||
ltc_compare_testvector(tmp[1], 16, tests[x].pt, 16, "RC6 Decrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
12 changes: 6 additions & 6 deletions src/ciphers/safer/safer.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ int safer_k64_test(void)
safer_ecb_encrypt(k64_pt, buf[0], &skey);
safer_ecb_decrypt(buf[0], buf[1], &skey);

if (compare_testvector(buf[0], 8, k64_ct, 8, "Safer K64 Encrypt", 0) != 0 ||
compare_testvector(buf[1], 8, k64_pt, 8, "Safer K64 Decrypt", 0) != 0) {
if (ltc_compare_testvector(buf[0], 8, k64_ct, 8, "Safer K64 Encrypt", 0) != 0 ||
ltc_compare_testvector(buf[1], 8, k64_pt, 8, "Safer K64 Decrypt", 0) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down Expand Up @@ -421,8 +421,8 @@ int safer_sk64_test(void)
safer_ecb_encrypt(sk64_pt, buf[0], &skey);
safer_ecb_decrypt(buf[0], buf[1], &skey);

if (compare_testvector(buf[0], 8, sk64_ct, 8, "Safer SK64 Encrypt", 0) != 0 ||
compare_testvector(buf[1], 8, sk64_pt, 8, "Safer SK64 Decrypt", 0) != 0) {
if (ltc_compare_testvector(buf[0], 8, sk64_ct, 8, "Safer SK64 Encrypt", 0) != 0 ||
ltc_compare_testvector(buf[1], 8, sk64_pt, 8, "Safer SK64 Decrypt", 0) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down Expand Up @@ -465,8 +465,8 @@ int safer_sk128_test(void)
safer_ecb_encrypt(sk128_pt, buf[0], &skey);
safer_ecb_decrypt(buf[0], buf[1], &skey);

if (compare_testvector(buf[0], 8, sk128_ct, 8, "Safer SK128 Encrypt", 0) != 0 ||
compare_testvector(buf[1], 8, sk128_pt, 8, "Safer SK128 Decrypt", 0) != 0) {
if (ltc_compare_testvector(buf[0], 8, sk128_ct, 8, "Safer SK128 Encrypt", 0) != 0 ||
ltc_compare_testvector(buf[1], 8, sk128_pt, 8, "Safer SK128 Decrypt", 0) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/safer/saferp.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ int saferp_test(void)
saferp_ecb_decrypt(tmp[0], tmp[1], &skey);

/* compare */
if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "Safer+ Encrypt", i) ||
compare_testvector(tmp[1], 16, tests[i].pt, 16, "Safer+ Decrypt", i)) {
if (ltc_compare_testvector(tmp[0], 16, tests[i].ct, 16, "Safer+ Encrypt", i) ||
ltc_compare_testvector(tmp[1], 16, tests[i].pt, 16, "Safer+ Decrypt", i)) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/serpent.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,13 +700,13 @@ int serpent_test(void)
if ((err = serpent_ecb_encrypt(tests[x].pt, buf[0], &key)) != CRYPT_OK) {
return err;
}
if (compare_testvector(buf[0], 16, tests[x].ct, 16, "SERPENT Encrypt", x)) {
if (ltc_compare_testvector(buf[0], 16, tests[x].ct, 16, "SERPENT Encrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
if ((err = serpent_ecb_decrypt(tests[x].ct, buf[1], &key)) != CRYPT_OK) {
return err;
}
if (compare_testvector(buf[1], 16, tests[x].pt, 16, "SERPENT Decrypt", x)) {
if (ltc_compare_testvector(buf[1], 16, tests[x].pt, 16, "SERPENT Decrypt", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/skipjack.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ int skipjack_test(void)
skipjack_ecb_decrypt(buf[0], buf[1], &key);

/* compare */
if (compare_testvector(buf[0], 8, tests[x].ct, 8, "Skipjack Encrypt", x) != 0 ||
compare_testvector(buf[1], 8, tests[x].pt, 8, "Skipjack Decrypt", x) != 0) {
if (ltc_compare_testvector(buf[0], 8, tests[x].ct, 8, "Skipjack Encrypt", x) != 0 ||
ltc_compare_testvector(buf[1], 8, tests[x].pt, 8, "Skipjack Decrypt", x) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
8 changes: 4 additions & 4 deletions src/ciphers/sm4.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,24 +316,24 @@ static int sm4_self_test_ltc(void)

/*A.1 example 1*/
sm4_ecb_encrypt(plaintext, output, &skey);
if (compare_testvector(output, 16, ciphertext, 16, "SM4 single encryption", 0) != 0)
if (ltc_compare_testvector(output, 16, ciphertext, 16, "SM4 single encryption", 0) != 0)
result = CRYPT_ERROR;

sm4_ecb_decrypt(ciphertext, output, &skey);
if (compare_testvector(output, 16, plaintext, 16, "SM4 single decryption", 0) != 0)
if (ltc_compare_testvector(output, 16, plaintext, 16, "SM4 single decryption", 0) != 0)
result = CRYPT_ERROR;

/*A.2 example 2*/
XMEMCPY(output, plaintext, 16);
for (i = 0; i < 1000000; ++i)
sm4_ecb_encrypt(output, output, &skey);
if (compare_testvector(output, 16, ciphertext_1000000t, 16, "SM4 1000000 times encryption", 0) != 0)
if (ltc_compare_testvector(output, 16, ciphertext_1000000t, 16, "SM4 1000000 times encryption", 0) != 0)
result = CRYPT_ERROR;

XMEMCPY(output, ciphertext_1000000t, 16);
for (i = 0; i < 1000000; ++i)
sm4_ecb_decrypt(output, output, &skey);
if (compare_testvector(output, 16, plaintext, 16, "SM4 1000000 times encryption", 0) != 0)
if (ltc_compare_testvector(output, 16, plaintext, 16, "SM4 1000000 times encryption", 0) != 0)
result = CRYPT_ERROR;

keysize = 128;
Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/tea.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ int tea_test(void)
tea_ecb_encrypt(ptct[0], tmp[0], &skey);
tea_ecb_decrypt(tmp[0], tmp[1], &skey);

if (compare_testvector(tmp[0], 8, ptct[1], 8, "TEA Encrypt", i) != 0 ||
compare_testvector(tmp[1], 8, ptct[0], 8, "TEA Decrypt", i) != 0) {
if (ltc_compare_testvector(tmp[0], 8, ptct[1], 8, "TEA Encrypt", i) != 0 ||
ltc_compare_testvector(tmp[1], 8, ptct[0], 8, "TEA Decrypt", i) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ciphers/twofish/twofish.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ int twofish_test(void)
}
twofish_ecb_encrypt(tests[i].pt, tmp[0], &key);
twofish_ecb_decrypt(tmp[0], tmp[1], &key);
if (compare_testvector(tmp[0], 16, tests[i].ct, 16, "Twofish Encrypt", i) != 0 ||
compare_testvector(tmp[1], 16, tests[i].pt, 16, "Twofish Decrypt", i) != 0) {
if (ltc_compare_testvector(tmp[0], 16, tests[i].ct, 16, "Twofish Encrypt", i) != 0 ||
ltc_compare_testvector(tmp[1], 16, tests[i].pt, 16, "Twofish Decrypt", i) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}
/* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */
Expand Down
Loading