Commit Graph

1282 Commits

Author SHA1 Message Date
Steffen Jaeckel
ee4a9477ec update gitignore 2013-03-20 18:34:16 +02:00
Steffen Jaeckel
f107e6e465 demos: trim trailing spaces 2013-03-20 18:34:00 +02:00
Steffen Jaeckel
5d0eadcd42 Merge branch 'feature/OCBv3' into develop 2013-03-20 18:32:38 +02:00
Steffen Jaeckel
6b5b35e6cc ocb3: don't zero ocb3 context in ocb3_{de,en}crypt_last 2013-03-20 18:10:51 +02:00
Steffen Jaeckel
05b050b943 update makefiles 2013-03-15 17:46:58 +02:00
Steffen Jaeckel
faaa17aec2 add OCBv3 testvectors 2013-03-15 17:46:45 +02:00
Karel Miko
c5c067fd12 ocb_init fix (preventing index overflow) 2013-03-15 13:30:40 +02:00
Karel Miko
9c2193b722 ocb3_init fix (preventing index overflow) 2013-03-15 13:30:39 +02:00
karel-m
abab7089a3 OCBv3 according http://tools.ietf.org/html/draft-krovetz-ocb-03 2013-03-15 13:30:29 +02:00
Larry Bugbee
8e22b17a8e fix define LTC_YARROW_AES 2013-03-15 12:24:00 +02:00
Steffen Jaeckel
7efe74427b update gitignore 2013-03-15 12:23:59 +02:00
Steffen Jaeckel
d540496db1 Merge branch 'feature/hkdf' into develop 2013-03-15 11:17:16 +01:00
RyanC
fe18c95e76 add the rest of the hkdf test cases 2013-03-15 11:16:17 +01:00
RyanC
11f50bfb3c fix hkdf_expand arguments 2013-03-15 11:16:17 +01:00
Steffen Jaeckel
1c779b88f1 moar debug output 2013-03-15 11:16:17 +01:00
Steffen Jaeckel
8fcd408a98 fixed latex compile errors 2013-03-15 11:16:17 +01:00
Steffen Jaeckel
e81ac102bd add misc_test() 2013-03-15 11:16:17 +01:00
Steffen Jaeckel
c1243feef2 hkdf: improve argument validation 2013-03-15 11:16:16 +01:00
Steffen Jaeckel
13c42a00f6 hkdf: fix compiler warning 2013-03-15 11:16:16 +01:00
Steffen Jaeckel
abeddd6c4b add hkdf_test() 2013-03-15 11:16:16 +01:00
RyanC
d7a1480f9e docs for HKDF 2013-03-15 11:16:16 +01:00
RyanC
c98857a47e add hkdf impl 2013-03-15 11:16:16 +01:00
Steffen Jaeckel
d84af284a3 build/testme: remove -j4 parameter 2013-03-15 11:08:54 +01:00
Steffen Jaeckel
2b2f5de743 rename README 2013-02-13 11:42:19 +01:00
Steffen Jaeckel
8a53674b18 updated README 2013-02-13 11:38:25 +01:00
Steffen Jaeckel
eb9bad79bf udpate testme to display correct version when run out of repository 2013-02-13 11:33:39 +01:00
Steffen Jaeckel
dda83c9da1 Merge branch 'ccbrown/master' into develop 2013-02-13 10:05:02 +01:00
Christopher Brown
9953c69455 update makefiles 2013-02-13 10:01:21 +01:00
Christopher Brown
2cb8c44113 der fixes and additions 2013-02-13 10:01:20 +01:00
Steffen Jaeckel
7050bdb7c8 use corrected version of zeromem() from @dtrebbien 2012-11-23 00:53:54 +01:00
Steffen Jaeckel
f32e52d5ac mark scripts as executable 2012-11-23 00:49:26 +01:00
Steffen Jaeckel
21ddcf3568 fix multi2 as proposed by kmx 2012-11-18 18:44:14 +01:00
Steffen Jaeckel
8cda684a0e improved multi2_test() 2012-11-18 18:41:46 +01:00
Steffen Jaeckel
bb8bd034f5 Merge branch 'ppelleti/ltc-fix-noekeon-gmp' into develop 2012-11-18 15:24:52 +01:00
Patrick Pelletier
5b662d6ed8 Fix some small typos in documentation 2012-11-18 15:24:15 +01:00
Patrick Pelletier
80ef95f3c1 Checked in program which generates Noekeon vectors using BouncyCastle. 2012-11-18 15:24:15 +01:00
Patrick Pelletier
e7b4705fca corrected Noekeon vectors 2012-11-18 15:24:14 +01:00
Patrick Pelletier
0e143a5cfe EAX-noekeon vectors from BouncyCastle 2012-11-18 15:24:14 +01:00
Patrick Pelletier
6dc089015a Fix LTC's bug in PI1/PI2 of Noekeon. Add vectors from BouncyCastle. 2012-11-18 15:24:13 +01:00
Patrick Pelletier
5708adb6c1 Add Camellia to the test vectors. 2012-11-18 15:24:12 +01:00
Patrick Pelletier
65254f65bf Fix camellia_keysize() to not change the keysize if it is correct.
It was rounding 32 down to 24, 24 down to 16, and claiming 16 was invalid.
2012-11-18 15:24:12 +01:00
Patrick Pelletier
e3acd4cabe Make GMP use uppercase to match LibTomMath. 2012-11-18 15:24:11 +01:00
Patrick Pelletier
3fbccfcb5c support base 64 for GMP 2012-11-18 15:24:11 +01:00
Steffen Jaeckel
20f0c74d17 Merge branch 'ppelleti/ltc-fixes' into develop 2012-11-18 15:21:51 +01:00
Patrick Pelletier
382c9d4d85 Some fixes necessary to support the Clang compiler
First of all, it had a failure in SEED:

LTC_KSEED failed for x=0, I got:
expected    actual   (ciphertext)
     5e  ==  5e
     ba  ==  ba
     c6  ==  c6
     e0  ==  e0
     05  !=  00
     4e  !=  00
     16  !=  00
     68  !=  00
     19  ==  19
     af  ==  af
     f1  ==  f1
     cc  ==  cc
     6d  !=  00
     34  !=  00
     6c  !=  00
     db  !=  00

Since SEED uses the 32H macros, this is really analogous to the
problem I saw with the 64H macros in Camellia with gcc.  Not sure why
gcc only had a problem with 64H and not 32H, but since this is an
interaction with the optimizer, it's not going to happen every time
the macro is used (hence why the store tests pass; only when you get
into the complexity of a real cipher do you start having problems) and
it makes sense it will vary from compiler to compiler.

Anyway, I went ahead and added the ability to use __builtin_bswap32,
in addition to __builtin_bswap64, which I already did in a previous
commit.  This solves the problem for clang, although I had to add new
logic to detect the bswap builtins in clang, since it has a different
way to detect them than gcc (see the comments in the code).  The
detection logic was complicated enough, and applied to both the 32H
and 64H macros, so I factored out the detection logic into
tomcrypt_cfg.h.
2012-11-18 15:20:12 +01:00
Patrick Pelletier
ad566e1b00 Use __builtin_bswap64 if it is available
This produces slightly better performance than the inline assembly,
and has the added benefit that it should be portable to other systems
that use gcc, not just x86-64.

Here are the results on my "AMD Athlon(tm) 7450 Dual-Core Processor"
with "gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3":

with portable 64H macros:

camellia            : Schedule at   1659
camellia            [ 23]: Encrypt at   431, Decrypt at   434
whirlpool           : Process at    55

with inline assembly (with "memory clobber" for correctness):

camellia            : Schedule at   1380
camellia            [ 23]: Encrypt at   406, Decrypt at   403
whirlpool           : Process at    50

with __builtin_bswap64:

camellia            : Schedule at   1352
camellia            [ 23]: Encrypt at   396, Decrypt at   391
whirlpool           : Process at    46
2012-11-18 15:20:12 +01:00
Patrick Pelletier
cefff85550 Add "memory" as a clobber for bswap inline assembly.
This had been causing Camellia (the only cipher that uses these
macros) to fail when compiling "out-of-the-box" with gcc version
"4.3.3-5ubuntu4".  I think because the compiler had no idea any memory
access was going on in these macros.

Adding "memory" as a clobber solves the problem, but is probably
overkill.  I suspect that if we specify the constraint for y
differently, we could get rid of both "memory" and __volatile__, which
would allow the compiler to optimize much more.

Also, in gcc versions that support it, we should probably use the
bswap builtins instead.
2012-11-18 15:20:11 +01:00
Patrick Pelletier
ee7c031ddf Added some code (commented out) to print details about Camellia test failure
(and ditto for SEED)

This is modeled after similar commented-out code in sober128_test(),
but slightly fancier.
2012-11-18 15:20:10 +01:00
Patrick Pelletier
cecbbb88fc When a test fails, print the algorithm that it failed on.
As near as I can tell, LibTomCrypt doesn't provide any way to tell
which cipher failed when it reports a cipher test failure.  For
example, I was getting:

Algorithm failed test vectors. (5)
cipher_hash_test.c:14:cipher_descriptor[x].test()

But there's no way to tell what value x has, and even if there was, it
would take a bit of digging to determine which algorithm that
corresponds to.  So, I added a variant of the DO() macro, DOX(), which
takes an additional string argument which is displayed on failure.  So
now I get:

Algorithm failed test vectors. (5) - camellia
cipher_hash_test.c:14:cipher_descriptor[x].test()
2012-11-18 15:20:10 +01:00
Patrick Pelletier
9228cbbd1e don't delete doc/crypt.pdf in "make clean"
"make clean" was deleting "doc/*.pdf", despite the fact that there
were two comments (one above and one below) stating that it did not.

Since doc/crypt.pdf is checked into git, running "make clean" made my
git state dirty, which seems undesirable.

I took sort of a compromise position and had "make clean" continue to
delete any other .pdf files in doc (such as refman.pdf), but
explicitly not delete crypt.pdf.
2012-11-18 15:20:09 +01:00