Commit Graph
99 Commits
Author SHA1 Message Date
Kim 08f873adc7 Roll up year to 2016 2016-04-22 22:50:26 +08:00
Syrone Wong 0bbf6c36a7 use sodium_memzero() to clear sensitive data
Close #603

After use, sensitive data should be overwritten, but memset() and hand-written code can be silently stripped out by an optimizing compiler or by the linker.

The sodium_memzero() function tries to effectively zero len bytes starting at pnt, even if optimizations are being applied to the code.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-22 18:00:19 +08:00
Max Lv 114128668c Refine helper functions 2016-04-16 00:43:27 +08:00
Syrone Wong ebe79bbbd8 Refine memory management (#579)
- Added one macro to avoid dangling pointers
- Added two functions to perform NULL pointer check
  since the allocation is not guaranteed by C library, although it
  is a rare case, just for sanity
- Add NULL pointer check to brealloc() and bfree() and for sanity as well

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-15 09:16:38 -07:00
Syrone Wong 58264c77fc Polish code
code issues found by Clang with
CFLAGS="-Os -Wall -Wextra -Werror=unused-const-variable -Wno-error=unused-parameter"
enabled

The details as follows:
- variable initialization issue, modified them as Clang suggested
- data type mismatch when comparing, fix them either by casting or changing
  the data type of index of iterator
- get_sockaddr() in netutils may return -1 thus changed returning type from
  size_t to ssize_t, which makes Clang happier
- recvfrom() in udprelay is identical, fix this by creating local variable
  for comparison  and assign back to buf->len when returning value is acceptable

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2016-04-07 21:28:23 -07:00
Max Lv da06378915 Clean up 2016-01-31 17:21:44 +08:00
Syrone Wong 5c3ed5c9c1 add IETF-compatible Chacha20 cipher support
Note:
- ChaCha20 with an extended (96 bit) nonce and a 32-bit counter has
been implemented as crypto_stream_chacha20_ietf() from LibSodium 1.0.4
- The name of new cipher is "chacha20-ietf"

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2015-12-13 19:30:41 +08:00
Max Lv d2ef245a05 Refine buffer allocation (2) 2015-12-13 10:57:55 +08:00
Max Lv 596f03665b Refine buffer allocation 2015-12-12 11:17:30 +08:00
Syrone Wong 06eef7fdd1 use sha1_hmac function directly for PolarSSL
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2015-12-08 11:46:54 +08:00
Max Lv 125cce3ff1 Remove internal hmac-sha1 2015-12-08 10:50:08 +08:00
Syrone Wong 0f4db65e23 use mbed TLS provided sha1-hmac function
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2015-12-06 12:28:41 +08:00
Max Lv 156223a366 Fix a potential timing attack by @swordfeng 2015-12-06 09:46:13 +08:00
Max Lv d57b63fd31 fix #466 2015-12-01 12:12:46 +08:00
Max Lv b0600a8784 Refine buffer handling 2015-11-30 15:03:04 +08:00
Max Lv f4fa30da5c Refine buffer handling 2015-11-29 20:01:50 +08:00
Max Lv 12ff6c8f2f fix a buffer corruption 2015-10-29 19:17:11 +08:00
Max Lv 25c575cb78 clean up 2015-10-29 15:41:36 +08:00
Max Lv c1959cac7f refine the log 2015-10-29 14:35:48 +08:00
Max Lv 99633b9908 fix #441 2015-10-29 14:27:46 +08:00
Max Lv 032c609c4d truncate HMAC-SHA1 to 10 bytes 2015-09-24 17:46:46 +08:00
Max Lv 5be0c9c55d fix #404 2015-09-24 14:28:36 +08:00
Max Lv 529eab29f4 fix a typo 2015-09-24 12:38:38 +08:00
Max Lv a76fae5b37 fix missing hmac-sha1 2015-09-24 12:36:12 +08:00
Max Lv b8e282b6d5 use OpenSSL's HMAC by default 2015-09-24 12:21:21 +08:00
Max Lv 8d46ced3c9 fix auth in udprelay 2015-09-24 11:00:13 +08:00
Max Lv c1db81d7db fix a buffer overflow 2015-09-23 22:34:45 +08:00
Max Lv 4301ded40e fix a typo 2015-09-23 22:21:08 +08:00
Max Lv 0e79c93ad1 add auth to udprelay 2015-09-23 22:15:59 +08:00
Max Lv f0f23b4199 replace poly1305 with hmac-sha1 2015-09-23 21:25:48 +08:00
Max Lv 0987fb3632 fix an issue of endian 2015-09-23 13:28:23 +08:00
Max Lv f3686420ea fix typos 2015-09-22 20:17:06 +08:00
Max Lv 9f553536cb Use IV + Chunk id as key of BLAKE2b 2015-09-22 18:23:23 +08:00
Max Lv 552fca1bff Use one time key for BLAKE2b 2015-09-22 17:57:44 +08:00
Max Lv d3e43e09a2 Refine the authentication for true CCA 2015-09-22 17:57:44 +08:00
Max Lv 5ae4df94e4 Update the hash function 2015-09-21 09:06:48 +08:00
Max Lv b49edb9095 fix a buffer overflow 2015-09-17 14:19:07 +08:00
Max Lv 53c2900b19 refine onetime auth 2015-09-17 09:59:52 +08:00
Max Lv 8d13b2d34e fix #398 2015-09-17 09:21:28 +08:00
Max Lv de8041b618 fix a buffer issue 2015-09-16 21:08:45 +08:00
Max Lv 6d79387715 use crc16 2015-09-16 20:36:18 +08:00
Max Lv 703374cae8 fix a buf issue 2015-09-16 09:53:36 +08:00
Max Lv 9e021aa919 add CRC8 for payload authentication 2015-09-15 12:28:02 +08:00
Max Lv 9f4c4953dc fix #391 2015-09-08 15:56:26 +08:00
Max Lv 4daab0e869 disable iv check for rc4 2015-09-04 22:12:04 +08:00
Max Lv 42ee808681 add onetime authentication 2015-09-03 08:56:52 +08:00
Max Lv e686d6594f fix iv cache 2015-09-02 19:41:41 +08:00
Max Lv a50e00c240 refine conn cache 2015-08-30 11:03:23 +08:00
Syrone Wong a8059f4e6f Fix typo in encrypt.c
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
2015-08-10 19:26:01 +08:00
Max Lv ac186749ee clean up 2015-08-01 14:23:47 +08:00