Commit Graph

308 Commits

Author SHA1 Message Date
Steffen Jaeckel
ae5cc35298 surround most macros with "do{}while(0)" 2014-04-04 01:03:54 +02:00
Steffen Jaeckel
2bdebb3932 dh: remove including of c-files 2014-04-04 00:38:08 +02:00
Steffen Jaeckel
71ccad06bd dh: remove unused variables 2014-04-04 00:38:07 +02:00
Steffen Jaeckel
f3cdac05ec sha2: remove including of c-files 2014-04-04 00:38:06 +02:00
Steffen Jaeckel
cbd59421bd protect all tables by an ifdef; adjust safer to the same concept 2014-04-04 00:38:05 +02:00
Steffen Jaeckel
ffeb70b48a fix typedef of LTC_FAST_TYPE on x86_64 2014-04-03 22:22:01 +02:00
Steffen Jaeckel
53f04b8e6b only use ulong32 or ulong64 in the macros 2014-04-03 15:06:56 +02:00
Steffen Jaeckel
1f7cf9dc0b move typedefs from tomcrypt_macros.h to tomcrypt_cfg.h 2014-04-03 15:05:56 +02:00
Steffen Jaeckel
561fe83532 fix strict-aliasing compiler warnings 2014-03-04 21:59:16 +01:00
Steffen Jaeckel
0aee5f3217 fix wrong spelled macros 2014-03-04 21:50:18 +01:00
Steffen Jaeckel
84298440f4 trim trailing spaces 2014-03-04 21:50:17 +01:00
Steffen Jaeckel
1d52f3b49b tomcrypt_custom.h: move dependency checks together 2014-03-04 18:09:12 +01:00
Michael Stapelberg
8d7e3d8216 fix typo: s/Endianess/Endianness/ 2014-02-25 10:38:29 +01:00
Steffen Jaeckel
65fd19c1fb dh: fix renamed macro 2014-02-25 10:09:35 +01:00
Steffen Jaeckel
77cca4175f ccm_memory_ex: disable until documented and fixed 2014-02-18 16:07:24 +01:00
Steffen Jaeckel
ed9940175d hmac test: add some more tests from RFC's 2014-02-16 18:55:24 +01:00
Steffen Jaeckel
ddb26a4276 hmac test: remove comments, prepare for extension 2014-02-16 18:41:33 +01:00
Steffen Jaeckel
2adca46735 pkcs#5: add tests for 'algo 2' 2014-02-16 18:41:33 +01:00
Steffen Jaeckel
e48838559b der_encode_setof: fix compiler warning when compiling for windows 64bit 2014-02-16 18:41:32 +01:00
Karel Miko
45dcbc654d fixing broken camellia 2014-02-16 18:41:31 +01:00
Steffen Jaeckel
d2c1329f77 camellia: add new testvector 2014-02-16 18:41:30 +01:00
karel-m
f3789b31b6 fixing warnings when compiling camellia.c with 64bit MS compiler 2014-02-16 18:41:30 +01:00
Steffen Jaeckel
3da9adc366 aes: remove compiler warning when compiled with ENCRYPT_ONLY 2014-02-16 18:41:29 +01:00
Steffen Jaeckel
8e7777b554 trim trailing spaces/clean up 2014-02-16 18:41:28 +01:00
Steffen Jaeckel
d78aa37c10 base64: add define LTC_BASE64_URL, make _internal functions static 2013-11-24 22:11:44 +01:00
Karel Miko
947fe41bbb Add URL safe base64 de-/encoding 2013-10-27 21:49:26 +02:00
Steffen Jaeckel
4f86ad7dcf hkdf: don't compile if not requested 2013-10-15 10:17:53 +02:00
Steffen Jaeckel
b1b15910ed fix rng_get_bytes() when compiling with mingw-gcc 2013-10-15 10:17:17 +02:00
Steffen Jaeckel
bf1ccb629b fix rsa_sign_saltlen_get_max_ex() 2013-10-14 14:16:44 +02:00
Steffen Jaeckel
aacfec441e add rsa_sign_saltlen_get_max_ex() 2013-10-14 14:16:42 +02:00
Steffen Jaeckel
73c201da1f add rsa_get_size() 2013-10-14 14:16:41 +02:00
Steffen Jaeckel
fb65cd0772 fix clang compiler warnings 2013-10-02 01:03:40 +02:00
Steffen Jaeckel
a667a93d52 trim trailing spaces 2013-10-02 01:02:58 +02:00
Steffen Jaeckel
031e551c57 tomcrypt_custom.h: improve and clean-up
Add the possibility to define LTC_NOTHING that disables everything
Remove LTC_NO_MATH as it didn't do anything at all
Enable RSA blinding by default
2013-08-14 16:12:56 +02:00
Steffen Jaeckel
c0b8774cc1 move hkdf to misc 2013-08-14 15:47:07 +02:00
Steffen Jaeckel
bfcf1eb200 trim trailing spaces in header files 2013-03-22 15:15:05 +02:00
Steffen Jaeckel
2526d5df8f xtea: use correct load and store macros 2013-03-22 15:15:04 +02:00
Steffen Jaeckel
0f0b182610 xtea: add new testvectors 2013-03-22 15:15:04 +02:00
Steffen Jaeckel
fa7051c21e xtea: trim trailing spaces 2013-03-22 15:15:02 +02:00
Steffen Jaeckel
e531af7add ecc: fix compiler warnings 2013-03-22 15:14:44 +02:00
Steffen Jaeckel
14b3a5290e include stddef.h per default 2013-03-22 15:14:44 +02:00
Steffen Jaeckel
9203472789 dsa: fix compiler warning 2013-03-22 15:14:43 +02:00
Steffen Jaeckel
2addbcf315 noekeon: fix compiler warning 2013-03-22 15:14:42 +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
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
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
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
c98857a47e add hkdf impl 2013-03-15 11:16:16 +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
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
Patrick Pelletier
5b662d6ed8 Fix some small typos in documentation 2012-11-18 15:24:15 +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
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
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
d61c537a2a missing a comma 2012-11-18 15:20:08 +01:00
Patrick Pelletier
233f207c17 Use "GMP_DESC" instead of "GPM_DESC"
This seemed to be the only place in the code that was using this
particular transposition.  And, indeed, when compiling with
"GMP_DESC", it looks like it is necessary to disable Diffie-Hellman.
(Otherwise, the test fails for me.)
2012-11-18 15:20:07 +01:00
Steffen Jaeckel
77860ba866 yarrow: prevent access to NULL pointer 2012-05-04 01:01:24 +02:00
Steffen Jaeckel
9c4fc762fc yarrow: trim trailing spaces 2012-05-04 01:00:25 +02:00
Steffen Jaeckel
2cd666f284 rsa_import: prevent double-free 2012-04-24 18:08:13 +02:00
Gregory Pakosz
1346ccdee8 replaced free(in) by XFREE(in) at line 56 2011-07-12 05:56:48 -07:00
Steffen Jaeckel
8859f6e73d fixed wrong return value interpretation of register_crypt/hash/prng function calls 2011-06-14 20:56:42 +02:00
Steffen Jaeckel
8dc8a2d551 Added define LTC_RSA_BLINDING to be able to disable rsa blinding 2011-03-21 22:50:49 +01:00
Steffen Jaeckel
380693edd9 fixed error causing segmentation fault 2011-03-21 21:17:59 +01:00
Steffen Jaeckel
25bd5c1275 added missing handling of new type LTC_ASN1_RAW_BIT_STRING in der_encode_sequence_multi() 2011-03-21 21:12:46 +01:00
Nikos Mavrogiannopoulos
fa22e791d4 RSA and DSA public keys are stored using the SubjectPublicKeyInfo format. 2011-03-21 19:24:10 +01:00
Nikos Mavrogiannopoulos
8c2850f8d9 Added RSA blinding (requires mp_rand()). 2011-03-21 08:26:41 +01:00
Nikos Mavrogiannopoulos
ed6897d90f DSA private keys are being exported to a compatible with OpenSSL and GnuTLS format. 2011-03-21 08:26:27 +01:00
Steffen Jaeckel
edf11c62c0 Diffie-Hellman/Math: introduced the proposed changes by Alexander Kurpiers
addmod and submod are moved to the end of the math descriptor, in order
to be able to run existing software against a new version of ltc without need
to rebuild the software.
2011-01-18 21:16:11 +01:00
Steffen Jaeckel
6fecec107d rejoined diffie hellman code from ltc 1.05, thanks to Alexander Kurpiers 2011-01-18 20:06:03 +01:00
Steffen Jaeckel
e7ce129e9b flushed content of CVS/SVN tags 2010-06-16 20:02:51 +02:00
Steffen Jaeckel
c3018d69d0 removed gcc compiler warnings 2010-06-16 20:02:11 +02:00
Steffen Jaeckel
59f9c00f98 removed IAR compiler warnings 2010-06-16 20:02:01 +02:00
Steffen Jaeckel
3522c754aa changed LTC_LTC_PKCS_1_* enum members to LTC_PKCS_1_* 2010-06-16 20:01:31 +02:00
Steffen Jaeckel
0a432b6b08 adjusted file dependant functions
when LTC_NO_FILE is defined, the functions hash_filehandle()
and hash_file() won't be available at all instead of returning CRYPT_NOP
2010-06-16 20:00:50 +02:00
Steffen Jaeckel
6816ac3f3f modification to suppress compiler warning when LTC_FAST is not defined 2010-06-16 19:59:39 +02:00
Steffen Jaeckel
2f1fc7c50d import of libtomcrypt
out of
  lt_tree.tar.bz2
checksums of lt_tree.tar.bz2
MD5: 3c36e1ca95518f4d00a76dc9b7049952
SHA1: 4f31d1aa8cd1b9d7452b777cd52f8280dc7ebcbc
2010-06-16 19:58:20 +02:00
Tom St Denis
bbc52b9e1b added libtomcrypt-1.17 2010-06-16 12:39:13 +02:00
Tom St Denis
e24b01d392 added libtomcrypt-1.16 2010-06-16 12:39:09 +02:00
Tom St Denis
2de2976d25 added libtomcrypt-1.15 2010-06-16 12:39:06 +02:00
Tom St Denis
479cc9c261 added libtomcrypt-1.14 2010-06-16 12:39:03 +02:00
Tom St Denis
1eed98f629 added libtomcrypt-1.13 2010-06-16 12:39:00 +02:00
Tom St Denis
2945dea3e2 added libtomcrypt-1.12 2010-06-16 12:38:57 +02:00
Tom St Denis
64d7ebe166 added libtomcrypt-1.11 2010-06-16 12:38:54 +02:00
Tom St Denis
99b6d03203 added libtomcrypt-1.10 2010-06-16 12:38:51 +02:00
Tom St Denis
a3ce807bae added libtomcrypt-1.09 2010-06-16 12:38:49 +02:00
Tom St Denis
1eeff0bfb4 added libtomcrypt-1.08 2010-06-16 12:38:47 +02:00
Tom St Denis
4a1a5796de added libtomcrypt-1.07 2010-06-16 12:38:44 +02:00
Tom St Denis
72412f6dac added libtomcrypt-1.06 2010-06-16 12:38:41 +02:00
Tom St Denis
9264e34ffb added libtomcrypt-1.05 2010-06-16 12:38:39 +02:00
Tom St Denis
9da48eb84b added libtomcrypt-1.04 2010-06-16 12:38:36 +02:00
Tom St Denis
3964a6523a added libtomcrypt-1.03 2010-06-16 12:38:34 +02:00
Tom St Denis
65c1317eee added libtomcrypt-1.02 2010-06-16 12:38:32 +02:00
Tom St Denis
6ac9952498 added libtomcrypt-1.01 2010-06-16 12:38:29 +02:00
Tom St Denis
bfc2f5b078 added libtomcrypt-1.00 2010-06-16 12:38:26 +02:00