summaryrefslogtreecommitdiffhomepage
path: root/libtomcrypt/src/mac/pmac/pmac_test.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-02-09 21:44:05 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-02-09 21:44:05 +0800
commit4f2eb1914bdac3ed3ee504ad86061281dbe0d074 (patch)
tree078293375c3f3ee2d485cf9559a08d65d460786a /libtomcrypt/src/mac/pmac/pmac_test.c
parentd72f50ff3284e15124a0f233c26339229fe305ac (diff)
Update to libtomcrypt 1.18.1, merged with Dropbear changes
Diffstat (limited to 'libtomcrypt/src/mac/pmac/pmac_test.c')
-rw-r--r--libtomcrypt/src/mac/pmac/pmac_test.c37
1 files changed, 13 insertions, 24 deletions
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$ */