From 4f2eb1914bdac3ed3ee504ad86061281dbe0d074 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Fri, 9 Feb 2018 21:44:05 +0800 Subject: Update to libtomcrypt 1.18.1, merged with Dropbear changes --- libtomcrypt/src/mac/pmac/pmac_test.c | 37 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'libtomcrypt/src/mac/pmac/pmac_test.c') diff --git a/libtomcrypt/src/mac/pmac/pmac_test.c b/libtomcrypt/src/mac/pmac/pmac_test.c index 5d2e42a..19329c6 100644 --- a/libtomcrypt/src/mac/pmac/pmac_test.c +++ b/libtomcrypt/src/mac/pmac/pmac_test.c @@ -5,20 +5,18 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" -/** +/** @file pmac_test.c - PMAC implementation, self-test, by Tom St Denis + PMAC implementation, self-test, by Tom St Denis */ #ifdef LTC_PMAC -/** +/** Test the LTC_OMAC implementation @return CRYPT_OK if successful, CRYPT_NOP if testing has been disabled */ @@ -27,7 +25,7 @@ int pmac_test(void) #if !defined(LTC_TEST) return CRYPT_NOP; #else - static const struct { + static const struct { int msglen; unsigned char key[16], msg[34], tag[16]; } tests[] = { @@ -125,7 +123,7 @@ int pmac_test(void) unsigned long len; unsigned char outtag[MAXBLOCKSIZE]; - /* AES can be under rijndael or aes... try to find it */ + /* AES can be under rijndael or aes... try to find it */ if ((idx = find_cipher("aes")) == -1) { if ((idx = find_cipher("rijndael")) == -1) { return CRYPT_NOP; @@ -137,29 +135,20 @@ int pmac_test(void) if ((err = pmac_memory(idx, tests[x].key, 16, tests[x].msg, tests[x].msglen, outtag, &len)) != CRYPT_OK) { return err; } - - if (XMEMCMP(outtag, tests[x].tag, len)) { -#if 0 - unsigned long y; - printf("\nTAG:\n"); - for (y = 0; y < len; ) { - printf("0x%02x", outtag[y]); - if (y < len-1) printf(", "); - if (!(++y % 8)) printf("\n"); - } -#endif + + if (compare_testvector(outtag, len, tests[x].tag, sizeof(tests[x].tag), "PMAC", x)) { return CRYPT_FAIL_TESTVECTOR; } - } - return CRYPT_OK; + } + return CRYPT_OK; #endif /* LTC_TEST */ } #endif /* PMAC_MODE */ - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ + +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ -- cgit v1.2.3