Commit Graph

274 Commits

Author SHA1 Message Date
Francois Perrad
9749958fe5 the comment FALLTHROUGH is common for several lint tool 2017-02-24 16:23:19 +01:00
Francois Perrad
c22acc2d07 remove useless include 2017-02-24 16:23:15 +01:00
Francois Perrad
7b48f4d5f7 fix indentation 2017-02-24 16:23:10 +01:00
Steffen Jaeckel
ecb2402ba8 remove [X]CLOCKS_PER_SEC 2017-02-24 00:28:59 +01:00
Karel Miko
979e9a9d15 fix for #90 ltc_ecc_mul2add.c integer sign issue (sjaeckel's way) 2017-02-24 00:18:55 +01:00
Karel Miko
0c226834cc introducing LTC_INLINE 2017-02-23 23:47:56 +01:00
Karel Miko
3d5b90d24d LTC_NO_PROTOTYPES related cosmetics 2017-02-23 11:03:55 +01:00
Steffen Jaeckel
76b289833c only define LTC_NO_PROTOTYPES on one point
This closes #132
2017-02-23 11:03:55 +01:00
Karel Miko
a2c87f54de adding rsa_import_radix 2017-02-21 16:55:09 +01:00
Karel Miko
10545366d2 adding dsa_import_radix 2017-02-21 16:54:10 +01:00
Karel Miko
bcf7753a26 use MIN macro 2017-02-21 16:36:17 +01:00
Karel Miko
ecbac7324e DSA: properly handle FIPS 186-4 (4.6 + 4.7) 2017-02-21 16:36:17 +01:00
Karel Miko
b36e75b7f1 don't read from c:\dev\random on windows 2017-02-21 13:34:52 +01:00
Steffen Jaeckel
d727b16898 use proper defines as of [1]
[1] http://predef.sourceforge.net
2017-02-21 13:34:52 +01:00
zeromus
c341d36c6a do it differently 2017-02-21 11:49:35 +01:00
zeromus
32f19995f8 do it differently 2017-02-21 11:49:35 +01:00
zeromus
793ff08986 do it differently 2017-02-21 11:49:35 +01:00
zeromus
c83763bd46 fix tiny compile error in tomcrypt_pk.h macro
An ARM compiler gives me this: 

libtomcrypt\pk\asn1\der\sequence\der_decode_subject_public_key_info.c(65,4): error #188-D: enumerated type mixed with another type

Since der_decode_subject_public_key_info's parameters_type is of type 'unsigned long', an attempt to assign it to ltc_asn1_list's member 'ltc_asn1_type type' fails.

My fix solves this in a simple way by casting it at the point of assignment.

But while studying this I noticed there's no use of enum in the codebase other than a few PK-related things.  Perhaps a more appropriate solution would be to remove these enums. I mean, enums seem like an OK enough idea, but I don't know anything about the practicality of using enums in archaic C dialects like libtomcrypt conforms (thankfully!) to...
2017-02-21 11:49:35 +01:00
Steffen Jaeckel
383f200cb6 fix LTC_MINIMAL 2017-02-20 19:19:44 +01:00
Steffen Jaeckel
fd99c3e3c0 remove duplicate define 2017-02-20 18:58:20 +01:00
Steffen Jaeckel
08aabc7f8c improve print_hex() prototype 2017-02-17 11:53:14 +01:00
Steffen Jaeckel
8fc1af1b7e make implementation easier to read
damn you negated logic...
2017-02-15 23:15:43 +01:00
Steffen Jaeckel
7d418b34b3 Fix GCM counter reuse
GCM should error out after processing (2^32)-1 blocks / (2^39)-256 bits
2016-09-28 20:18:09 +02:00
Karel Miko
6ad5225268 removing forgotten debug comment 2016-07-07 15:03:33 +02:00
Karel Miko
966496ea1a fixing GCM troubles at HP-UX/IA64 2016-01-23 18:09:03 +01:00
Karel Miko
af77f1fae9 RORc instead of ROR 2016-01-19 00:03:54 +01:00
Karel Miko
d0a534393a fix for issue #92 - const is meaningless on cast type 2016-01-19 00:03:54 +01:00
Karel Miko
15b3f39a4f avoid using declaration after statements (rng_win32) 2016-01-14 21:46:53 +01:00
Karel Miko
7c1e251e75 avoid using declaration after statements 2016-01-14 21:46:53 +01:00
Steffen Jaeckel
10e577e24a there's no need to check out on function entry
...someone could then do something like this...

unsigned char* out = NULL;
unsigned long len = 0;
while(ecc_ansi_x963_export(key, out, &len) == CRYPT_BUFFER_OVERFLOW &&
	len == 0) {
  out = malloc(len);
}

...as if someone would ever like to do something like that...
2016-01-14 21:32:33 +01:00
Karel Miko
42bad9f580 fix for issue #58 - possible overflow in ecc_ansi_x963_export 2016-01-11 00:25:13 +01:00
Karel Miko
8cf7eb1801 fix for issue #91 - redefinition of macro "setbit" 2016-01-10 18:45:04 +01:00
Steffen Jaeckel
7c2ff8ebfe show ROtate operator configuration in build settings
[skip ci]
2016-01-05 23:55:06 +01:00
Steffen Jaeckel
f5016d88dd Prevent undefined behavior
Don't call XMEMCPY() in case info (the source parameter to memcpy) is NULL
as this would trigger UB
2015-12-05 14:31:38 +01:00
Steffen Jaeckel
318dbbccc3 fix wrongly used LTC_ARGCHK/LTC_ARGCHKVD macros 2015-12-05 14:31:37 +01:00
Steffen Jaeckel
460b8716c9 fix clang-analyzer warnings
This fixes #80
2015-12-05 14:31:01 +01:00
Steffen Jaeckel
16f397d55c prevent segfault in case we hit an empty sequence 2015-09-10 19:17:42 +02:00
Steffen Jaeckel
d4945ac521 add (nearly) all defines from tomcrypt_custom.h to crypt_build_settings
... and provide a new make target to check if something is missing
2015-09-08 21:09:49 +02:00
Steffen Jaeckel
733c52aa00 add LTC_RSA_CRT_HARDENING to crypt_build_settings 2015-09-08 21:04:33 +02:00
Steffen Jaeckel
01f1845402 harden RSA CRT by implementing the proposed countermeasure
... from ch. 1.3 of [1]

[1] https://people.redhat.com/~fweimer/rsa-crt-leaks.pdf
2015-09-08 02:44:17 +02:00
Steffen Jaeckel
6ec93afa3c clean-up test-build and extend tomcrypt_custom.h
added LTC_MINIMAL to be able do a build without nearly any
functionality :)
make sure timing resistant RSA & ECC are enabled if not said otherwise
2015-09-01 17:36:43 +02:00
Steffen Jaeckel
8cb20e6059 add more DES test vectors 2015-08-31 15:09:36 +02:00
Sebastian Verschoor
75b114517a make sure no cache-based timing attack is possible
instead of two different buffers, there is just one buffer. Based upon the verification result, a mask is applied to the buffer before it is written to the output buffer.
2015-08-26 00:08:38 +02:00
Steffen Jaeckel
09e4b0ec9b don't reveal plaintext if authentication failed
Create two buffers of the same size as the input data.
Copy the input data to the first one and work with that version to hold the
decrypted data, zeroize the second one.
Copy depending on the verification result, either the zero-buffer or the
real plaintext to the output buffer.
2015-08-26 00:08:38 +02:00
Steffen Jaeckel
6c11ca771b fix compile error of tests 2015-08-26 00:08:38 +02:00
Sebastian Verschoor
25af184cd5 Quickfix for issue #73
The API of the function is changed (for decryption, tag is now an input
parameter). With the old API it is impossible to confirm to the NIST
specification and a timing sidechannel leak is inevitable.
2015-08-26 00:08:38 +02:00
Steffen Jaeckel
f9c8c9c229 also test XTS accelerators 2015-08-26 00:05:07 +02:00
Steffen Jaeckel
181d2f2df7 auto-format xts code 2015-08-26 00:02:50 +02:00
Steffen Jaeckel
b25d04ed94 fix pointer check 2015-08-25 23:58:22 +02:00
Jerome Forissier
5c3f177b34 Add function pointers for accelerated XTS to ltc_cipher_descriptor
Similar to what already exists for other modes.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
2015-08-25 23:58:22 +02:00