Commit Graph

610 Commits

Author SHA1 Message Date
Steffen Jaeckel
05e9f0ee79 Revert "use ltc_pk_part in rsa_import_radix()"
This reverts commit 023e4a2c23641d852cf47000948fa29a53249457.
2017-06-27 20:05:36 +02:00
Steffen Jaeckel
083e8af78b Revert "also test binary import"
This reverts commit 8b6f8c8cce325fa1ce3b61805aa80cdabc1826b4.
2017-06-27 20:05:36 +02:00
Steffen Jaeckel
4afc024f6a also test binary import 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
00a5212d99 use ltc_pk_part in rsa_import_radix() 2017-06-27 20:05:36 +02:00
Steffen Jaeckel
0a6af8d333 rsa_exptmod(): verify that p and q are valid before going the CRT path 2017-06-27 19:01:56 +02:00
Steffen Jaeckel
f5b8cc9dae this should really implement a patch for the illegal access 2017-06-27 12:35:39 +02:00
Steffen Jaeckel
1a3880fda5 Revert "re-factor size checks in blake2 implementations"
This reverts commit af38b1830e.
2017-06-27 12:33:40 +02:00
Steffen Jaeckel
af38b1830e re-factor size checks in blake2 implementations 2017-06-26 14:02:52 +02:00
Steffen Jaeckel
3cfb2a5e2e hide some of the 'new since 1.17' internal functions 2017-06-23 14:14:05 +02:00
Steffen Jaeckel
a80d3c00a8 no need for DH_BUF_SIZE 2017-06-23 14:05:57 +02:00
Francois Perrad
446fec1bc4 refactor switch with default 2017-06-22 17:13:40 +02:00
Steffen Jaeckel
e3937a2906 fix compile warning when building w/o tests 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
11338d2496 introduce XMEMMOVE and check for its usage 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
e9c90e7f63 no need to use XMEM_NEQ() in PK crypto 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
ae698927ff improve mem_neq() documentation 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
1bf42ea99a update some of the static functions 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
27b3ffc627 use compare_testvector() instead of XMEMCMP() in tests 2017-06-22 14:21:14 +02:00
Steffen Jaeckel
05e28d6cfa fix potential timing attacks in rsa, eax, ocb and ocb3 2017-06-22 14:21:14 +02:00
Karel Miko
243a1dc33e drop _dh_make_key_ex 2017-06-22 13:19:48 +02:00
Karel Miko
cba1569c82 fix tomcrypt_pk.h 2017-06-22 13:19:48 +02:00
Karel Miko
5eaff56d90 remove dh_export_radix.c dh_import_radix.c 2017-06-22 13:19:47 +02:00
Karel Miko
771d67e102 DH facelift part1 2017-06-22 13:19:47 +02:00
Steffen Jaeckel
26b57032e7 use correct amount of M-R tests in dsa_make_params() 2017-06-22 11:55:08 +02:00
Steffen Jaeckel
7453eddae9 improve ltc_math_descriptor a bit
* introduce LTC_MILLER_RABIN_REPS which is used as default value
  in the isprime() implementations
2017-06-22 11:55:08 +02:00
Karel Miko
b8f22157b3 PK_MAX_RETRIES 2017-06-21 13:38:39 +02:00
Karel Miko
0c115a162d whitespace 2017-06-21 13:26:52 +02:00
Karel Miko
fff832091f ecc_sign_hash max_iterations 2017-06-21 13:25:06 +02:00
Karel Miko
cdf04b6140 fix mp_montgomery_setup 2017-06-21 13:01:22 +02:00
Karel Miko
a937f23821 static functions name fix 2017-06-21 12:49:19 +02:00
Karel Miko
67200b641d ecc_sign+verify_hash_raw > ecc_sign+verify_hash_rfc7518 2017-06-21 12:11:35 +02:00
Steffen Jaeckel
6fc0a90a1e fix headers & footers in demos & tests 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
4cd1355b8f more clean-up of headers/footers 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
fe19dad623 replace SVN tags 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
66527b3e5e include "tomcrypt.h", not <tomcrypt.h>
we want to include the local version of the header, not the system-version
2017-06-20 15:16:11 +02:00
Steffen Jaeckel
fb35d5be54 more clean-up of headers 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
4dc211e19d clean-up headers 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
f2076f0700 use zeromem() where appropriate 2017-06-15 01:07:44 +02:00
Steffen Jaeckel
258de3cecc use ltc_mp_digit instead of unsigned long 2017-06-15 01:07:44 +02:00
Steffen Jaeckel
98b500e873 update crypt_build_settings et al. 2017-06-15 01:07:44 +02:00
Steffen Jaeckel
0cf7c49045 sync ltc_math_descriptor from doc 2017-06-15 00:46:50 +02:00
Francois Perrad
0bc0d55245 refactor REGISTER_* 2017-06-12 20:07:23 +02:00
Francois Perrad
ec51f880b5 Right hand side of assignment needs parenthesis 2017-06-12 20:07:23 +02:00
Francois Perrad
f40bda7cb3 fix indentation 2017-06-12 20:07:23 +02:00
Steffen Jaeckel
fec05471ae the latest tfm version has fp_rand() available, so we can test this now 2017-06-12 18:45:24 +02:00
Steffen Jaeckel
48e4ec07be use LTC_ARGCHK() for all mutex operations 2017-06-12 17:19:43 +02:00
Karel Miko
4f12e41d29 fix trailing ; 2017-06-12 16:35:27 +02:00
Karel Miko
114b694735 trying to fix dh_shared_secret - #119 2017-06-11 23:20:46 +02:00
Karel Miko
bc4236d90f tuning dh_make_key 2017-06-11 21:12:14 +02:00
Karel Miko
361778d2ac another dh_make_key redesign 2017-06-11 19:43:08 +02:00
Karel Miko
71884788e3 fix warning: comparison between signed and unsigned integer 2017-06-11 10:12:18 +02:00
Karel Miko
532c511f52 improved dh_make_key 2017-06-10 23:02:30 +02:00
Steffen Jaeckel
c9f4628693 don't call rng_make_prng() from dh_make_key()
While testing with multiple threads I had spurious errors where some tests
can't read from the PRNG.
If I tracked it down correctly that's caused by `dh_make_key()`
calling `rng_make_prng()` which re-initializes the selected PRNG.

I like the idea of "refreshing" the PRNG with entropy from a hopefully
secure RNG before generating a new key, but I don't think it's the duty
of a key-generation function to ensure that, but merely the application
that implements key-generation.
2017-06-09 18:56:04 +02:00
Steffen Jaeckel
f31d8ff864 implement smaller private key sizes 2017-06-09 18:33:51 +02:00
Karel Miko
f46b32ba2e better DH primes 2017-06-09 14:14:07 +02:00
Karel Miko
2a883b44c7 do not expose dsa_make_params as a public API 2017-06-09 13:01:30 +02:00
Steffen Jaeckel
ef450fe14a fix error handling 2017-06-08 23:34:16 +02:00
Karel Miko
52a496e9e1 rsa_import_pkcs8 - passwd is now "const void *" 2017-06-08 23:34:16 +02:00
Karel Miko
d96f4bdcff rsa_import_pkcs8 2017-06-08 23:34:16 +02:00
Steffen Jaeckel
4bbce780c4 always provide compare_testvector() as a function 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
4e971a8518 don't use print_hex() from library 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
4ceb82bf54 add register_all_{ciphers,hashes,prngs}() 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
7f91e5ae65 requiring 'name != NULL' in find_cipher_any() doesn't make sense 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
8c1d55f4c0 fix error when compiling w/ LTC_CLEAN_STACK but w/o LTC_FAST 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
b78c5551f7 move compare_testvector() implementation to the library 2017-06-08 22:20:45 +02:00
Steffen Jaeckel
0a23c6d32e also check for cipher descriptors 2017-06-08 22:20:44 +02:00
Steffen Jaeckel
4929860641 fix file modes 2017-05-31 01:57:40 +02:00
Kelvin Sherlock
a8d81a7214 fix sha3 test numbers 2017-05-21 15:32:16 -04:00
Kelvin Sherlock
30f8aaad8c replace XMEMCMP with compare_testvector, other consistency cleanup in testing code. 2017-05-14 22:17:59 -04:00
Karel Miko
43e46a2efc fix clang static analyzer warnings/errors - see #217 2017-05-11 20:37:06 +02:00
Karel Miko
e2cf11da25 fix windows warnings - #212 and #213 2017-05-11 17:42:43 +02:00
Karel Miko
6d70827d1f Windows: fix warning: 'rng_nix' defined but not used 2017-05-11 17:42:43 +02:00
Karel Miko
91b61630be improved #ifdefs - related to: 'num' not referenced 2017-05-09 21:43:28 +02:00
Karel Miko
04262d3aec fix: local struct member 'poly_div' not referenced 2017-05-09 21:31:12 +02:00
Karel Miko
f6ea738fee fix: Loss of sign (initialization) (int to unsigned long long) 2017-05-09 21:30:44 +02:00
Karel Miko
421266cf5f fix void *orig 2017-05-05 19:57:20 +02:00
Karel Miko
adf0ad95c9 IBM xlc compiler does not like "static inline" (related to #209) 2017-05-05 19:57:20 +02:00
Steffen Jaeckel
31dcb9ff2a only set outlen on success 2017-05-03 18:10:45 +02:00
Karel Miko
4e66160ac2 one more readable for loop 2017-05-03 17:01:18 +02:00
Karel Miko
f831e27702 more readable for loops 2017-05-03 12:56:25 +02:00
Karel Miko
a1615daa3c shake be fix (hopefully final) 2017-05-03 12:56:25 +02:00
Karel Miko
961b6109d5 cosmetics 2017-05-03 12:56:25 +02:00
Karel Miko
da8501f55a sha3_shake_done another be fix 2017-05-03 12:56:25 +02:00
Karel Miko
c3f2e4530a declaration of ‘i’ shadows a previous local (better) 2017-05-03 12:56:25 +02:00
Karel Miko
df4e47978e declaration of ‘i’ shadows a previous local 2017-05-03 12:56:25 +02:00
Karel Miko
e5c0e7ffd3 SHAKE (SHA3 related) big endian fix 2017-05-03 12:56:25 +02:00
Steffen Jaeckel
67ca1c0b9a fix for compilation with LTC_DEBUG 2017-05-03 12:37:24 +02:00
Steffen Jaeckel
aa4bae5ae9 add option to do PKCS#1 v1.5 EMSA without ASN.1 around hash
Somehow someone forgot to add the OID in the signature field
of a SERVER_KEY_EXCHANGE message in early versions of the SSL protocol.
Therefore provide an option to be able to sign/verify a message
in that format.
2017-05-01 23:15:11 +02:00
Francois Perrad
a52b586ed2 Unusual use of a Boolean expression 2017-05-01 14:51:35 +02:00
Steffen Jaeckel
2858373e2e clean stack properly 2017-05-01 14:12:47 +02:00
Steffen Jaeckel
3e2ac192a1 Merge pull request #200 from fperrad/20170429_lint
LTC_PTHREAD: some linting
2017-05-01 14:08:59 +02:00
Karel Miko
87142382da lint fixes discussed in #199 2017-04-29 19:59:03 +02:00
Francois Perrad
7e72dafe5f remove useless semicolon
the macro LTC_MUTEX_TYPE already contains a semicolon
see https://github.com/libtom/libtomcrypt/blob/develop/src/headers/tomcrypt_custom.h#L552
2017-04-29 17:52:27 +02:00
Karel Miko
6417f96ea9 fortuna - import does not fail when input data are larger than export_size 2017-04-29 14:12:36 +02:00
Karel Miko
d7f2b2dd6e fortuna - move LBL_UNLOCK before zeromem 2017-04-29 13:39:48 +02:00
Karel Miko
c6cee7bef0 prngs/sober128 - import fix 2017-04-29 13:36:45 +02:00
Karel Miko
9c972c833d fix chacha20poly1305_test 2017-04-29 13:30:19 +02:00
Karel Miko
eb209aa2f9 more error checking in *_test 2017-04-28 19:24:58 +02:00
Karel Miko
90b482aa1e stream/chacha - improved counter increment 2017-04-28 19:24:58 +02:00
Karel Miko
9232f2e970 fortuna/yarrow & export_size 2017-04-28 19:24:58 +02:00
Karel Miko
1732ed8ce8 increase coverage 2017-04-28 19:24:58 +02:00
Karel Miko
784a009efe increase coverage 2017-04-28 19:24:58 +02:00
Karel Miko
da25a23712 increasing prngs/rc4 coverage 2017-04-28 19:24:58 +02:00
Karel Miko
0df0c9b12c LTC_CHACHA_STREAM >> LTC_CHACHA 2017-04-28 19:24:58 +02:00
Karel Miko
dd35e86c60 renaming rc4+sober128 stream API to *_stream_* 2017-04-28 19:24:58 +02:00
Karel Miko
fe14c8bfaf Move RC4 + SOBER128 to src/stream/ 2017-04-28 19:24:58 +02:00
Karel Miko
0d998fd4c8 stream/chacha ivlen cosmetics 2017-04-25 01:10:15 +02:00
Karel Miko
0f0f1e40be indentation 2017-04-24 21:59:21 +02:00
Karel Miko
61105b67f4 test vectors from https://github.com/BLAKE2 2017-04-23 23:27:54 +02:00
Karel Miko
0d585958c1 BLAKE2 based MACs 2017-04-23 23:27:54 +02:00
Steffen Jaeckel
7a83cea4db use appropriate names for sha3 hashes 2017-04-23 15:55:49 +02:00
Karel Miko
336c52ca5f Facelift of *_file functions 2017-04-21 16:11:22 +02:00
Kelvin Sherlock
56a2efa729 fix blake2s-160/224 hash sizes. 2017-04-20 11:22:16 -04:00
Kelvin Sherlock
4905232eda more tests. 2017-04-19 16:50:34 -04:00
Kelvin Sherlock
c65d24222e always zeromem hash_state when done 2017-04-19 16:47:03 -04:00
Kelvin Sherlock
2dc574d477 use - in hash descriptors. 2017-04-19 16:46:36 -04:00
Kelvin Sherlock
4ee9d767bb add key/keylen parameters to blake2x_init 2017-04-10 18:29:51 -04:00
Kelvin Sherlock
0f97bb7415 fix burn blake2b stack size. 2017-04-10 16:37:34 -04:00
Kelvin Sherlock
55450078ea use compare_testvector in tests. 2017-04-10 12:00:22 -04:00
Kelvin Sherlock
ea8dde7f63 formatting 2017-04-10 11:34:59 -04:00
Kelvin Sherlock
dfbdb626c3 add missing const. 2017-04-10 10:50:34 -04:00
Kelvin Sherlock
6b46b447b5 replace packed parameter struct with offsets into a unsigned char buffer. 2017-04-10 10:40:20 -04:00
Kelvin Sherlock
6acdfe9a55 cleanup, resins with updated reference source 2017-04-10 10:22:50 -04:00
Kelvin Sherlock
afc6e8d370 minor cleanup. 2017-04-10 10:21:51 -04:00
Kelvin Sherlock
b4594ab3c6 remove inline and c99 variable declarations. 2017-04-09 17:22:42 -04:00
Kelvin Sherlock
268c87e33d add LTC_ARGCHK for blake2b_process. 2017-04-08 17:00:39 -04:00
Kelvin Sherlock
6f6e2d30a8 clang-format 2017-04-08 15:43:38 -04:00
Kelvin Sherlock
7c5fef9b71 add blake2b hash 2017-04-08 15:40:56 -04:00
Kelvin Sherlock
5924bd43e6 tweak source to conform a little better 2017-04-08 15:40:20 -04:00
Kelvin Sherlock
51075724c1 use hash_state * for all arguments. 2017-04-07 23:46:52 -04:00
Kelvin Sherlock
063df0bffe more tests. 2017-04-07 23:46:17 -04:00
Kelvin Sherlock
4449cdcea3 sort and number the ltc_hash_descriptors. 2017-04-07 23:45:49 -04:00
Kelvin Sherlock
1b5ae955d2 moe clang-format 2017-04-07 21:24:47 -04:00
Kelvin Sherlock
51f6b063d6 clang format 2017-04-07 21:12:54 -04:00
Kelvin Sherlock
647b53d880 add blake2s to various places. 2017-04-07 20:50:28 -04:00
Kelvin Sherlock
68296e0608 blake2s hash 2017-04-07 20:47:44 -04:00
Francois Perrad
b6c27c2f08 no room for nul terminator 2017-04-07 12:16:48 +02:00
Francois Perrad
0be45a6341 remove unreachable code 2017-04-07 12:16:44 +02:00
Francois Perrad
9941648125 remove suspicious ; 2017-04-07 00:17:43 +02:00
Steffen Jaeckel
08415d37f3 fix compare_testvector() macro 2017-04-06 22:47:36 +02:00
Francois Perrad
168472f753 misuse of compare_testvector 2017-04-05 09:28:32 +02:00
Karel Miko
eefb8dc479 renaming prngs/chacha.c prngs/chacha20.c 2017-04-03 22:54:27 +02:00
Karel Miko
bfe9484a3d renaming chacha_prng > chacha20_prng 2017-04-03 22:52:17 +02:00
Karel Miko
2520e6c061 add link to arc4random.c which was the inspiration for chacha_prng 2017-04-03 20:04:00 +02:00
Karel Miko
7b93f04390 wrong use of sizeof(buf) 2017-04-03 19:54:51 +02:00
Karel Miko
ce37498ec6 chacha_prng_desc > chacha20_prng_desc 2017-04-03 19:52:03 +02:00
Karel Miko
08a028ab04 missing LTC_FILE_READ_BUFSIZE in crypt.c 2017-04-02 18:13:45 +02:00
Karel Miko
883db95da2 FILE_READ_BUFSIZE > LTC_FILE_READ_BUFSIZE 2017-04-02 18:13:45 +02:00
Karel Miko
06b1582de6 new #define FILE_READ_BUFSIZE 2017-04-02 18:13:45 +02:00
Karel Miko
ff5b02d371 LTC_CHACHA vs. LTC_CHACHA20_PRNG 2017-04-02 18:13:45 +02:00
Karel Miko
2656a040e0 chacha_prng > chacha20_prng 2017-04-02 18:13:45 +02:00