Commit Graph

3406 Commits

Author SHA1 Message Date
Jonathan Leroy
b76e43651e Fix boolean values according to DER specs
In BER encoding, any boolean with a non-zero value is considered as
TRUE. However, DER encoding require a value of 255 (0xFF) for TRUE.

This commit makes `mbedtls_asn1_write_bool` function uses `255` instead
of `1` for BOOLEAN values.

With this fix, boolean values are now reconized by OS X keychain (tested
on OS X 10.11).

Fixes #318.
2015-10-27 15:12:39 +01:00
Manuel Pégourié-Gonnard
c4baf98ce6 Fix typo in an OID name
fixes #314
2015-10-27 15:12:39 +01:00
Manuel Pégourié-Gonnard
7bbabeae8f Disable reportedly broken assembly of Sparc(64)
fixes #292
2015-10-27 15:12:39 +01:00
Manuel Pégourié-Gonnard
c094a97223 ECHDE-PSK does not use a certificate
fixes #270
2015-10-27 15:12:39 +01:00
Manuel Pégourié-Gonnard
0aaefcebc0 Actually ignore most non-fatal alerts
fixes #308
2015-10-27 15:12:39 +01:00
Manuel Pégourié-Gonnard
5ca3640fa7 Fix other int casts in bounds checking
Not a security issue as here we know the buffer is large enough (unless
something else if badly wrong in the code), and the value cast to int is less
than 2^16 (again, unless issues elsewhere).

Still changing to a more correct check as a matter of principle

backport of bc5e508
2015-10-27 11:47:37 +01:00
Manuel Pégourié-Gonnard
8abc22dde5 Fix other occurrences of same bounds check issue
Security impact is the same: not triggerrable remotely except in very specific
use cases

backport of 4dc9b39
2015-10-27 11:47:37 +01:00
Manuel Pégourié-Gonnard
758f490c90 Fix potential buffer overflow in asn1write
Ref: IOTSSL-519

backport of 22c3b7b
2015-10-27 11:47:37 +01:00
Manuel Pégourié-Gonnard
215a14bf29 Fix potential heap corruption on Windows
If len is large enough, when cast to an int it will be negative and then the
test if( len > MAX_PATH - 3 ) will not behave as expected.

Ref: IOTSSL-518

backport of 261faed725
2015-10-27 11:47:37 +01:00
Manuel Pégourié-Gonnard
9c52176776 Fix potential double-free in ssl_set_psk()
Internal ref: IOTSSL-517
2015-10-27 11:47:37 +01:00
Manuel Pégourié-Gonnard
ad9c68ab21 Fix typo in documenation 2015-10-20 09:38:10 +02:00
Simon Butcher
9b52b804c7 Corrected misleading fn description in ssl_cache.h
Mistake in comments spotted by Andris Mednis
2015-10-19 19:35:04 +01:00
Manuel Pégourié-Gonnard
f093bde91e Bump version to 1.3.14 2015-10-05 19:06:46 +01:00
Manuel Pégourié-Gonnard
c5934272fc Merge branch 'mbedtls-1.3' into mbedtls-1.3-restricted
* mbedtls-1.3:
  Fix spurious #endif from previous cherry-pick
  Fix macroization of inline in C++
  Add missing warning in doc
  Fix compile error in net.c with musl libc
2015-10-05 17:06:24 +01:00
Simon Butcher
36abef4c5c Merge multiple backported vulnerability fixes 2015-10-05 16:44:59 +01:00
Manuel Pégourié-Gonnard
fa647a75a1 Fix references to non-standard SIZE_T_MAX
Turns out C99 doesn't define SIZE_T_MAX, so let's not use it.
2015-10-05 15:29:48 +01:00
Manuel Pégourié-Gonnard
cf1db3cf1c Fix spurious #endif from previous cherry-pick 2015-10-05 14:57:01 +01:00
Manuel Pégourié-Gonnard
20607bb0fa Fix macroization of inline in C++
When compiling as C++, MSVC complains about our macroization of a keyword.
Stop doing that as we know inline is always available in C++
2015-10-05 14:28:17 +01:00
Manuel Pégourié-Gonnard
ded3ae500b Add missing warning in doc
Found by Nicholas Wilson

fixes #288
2015-10-05 14:18:16 +01:00
Manuel Pégourié-Gonnard
614624790d Fix compile error in net.c with musl libc
fixes #278
2015-10-05 14:15:46 +01:00
Manuel Pégourié-Gonnard
de9c8a5734 Fix potential overflow in CertificateRequest 2015-10-02 12:04:20 +02:00
Manuel Pégourié-Gonnard
f3e6e4badb Add extra check before integer conversion
end < p should never happen, but just be extra sure
2015-10-02 09:53:52 +02:00
Manuel Pégourié-Gonnard
c7e61a2e3f Fix more typos in ChangeLog 2015-10-01 18:22:54 +02:00
Manuel Pégourié-Gonnard
6d6018383e Fix typos in ChangeLog and comments 2015-10-01 18:20:55 +02:00
Manuel Pégourié-Gonnard
48ec2c7b5e Fix potential overflow in base64_encode 2015-10-01 10:07:28 +02:00
Manuel Pégourié-Gonnard
5aff029f9d Fix potential double-free in ssl_set_psk() 2015-10-01 09:58:50 +02:00
Simon Butcher
643a922c56 Reordered extension fields and added to ChangeLog
Reordered the transmission sequence of TLS extension fields in client hello
and added to ChangeLog.
2015-10-01 01:17:10 +01:00
Simon Butcher
b1e325d6b2 Added bounds checking for TLS extensions
IOTSSL-478 - Added checks to prevent buffer overflows.
2015-10-01 00:24:36 +01:00
Manuel Pégourié-Gonnard
9bf29bee22 Fix potential random malloc in pem_read() 2015-09-30 17:01:35 +02:00
Manuel Pégourié-Gonnard
59efb6a1b9 Fix potential buffer overflow in mpi_read_string()
Found by Guido Vranken.

Two possible integer overflows (during << 2 or addition in BITS_TO_LIMB())
could result in far too few memory to be allocated, then overflowing the
buffer in the subsequent for loop.

Both integer overflows happen when slen is close to or greater than
SIZE_T_MAX >> 2 (ie 2^30 on a 32 bit system).

Note: one could also avoid those overflows by changing BITS_TO_LIMB(s << 2) to
CHARS_TO_LIMB(s >> 1) but the solution implemented looks more robust with
respect to future code changes.
2015-09-30 16:50:31 +02:00
Manuel Pégourié-Gonnard
7b4b2ac378 Fix stack buffer overflow in pkcs12 2015-09-30 16:46:07 +02:00
Simon Butcher
c988f32add Added max length checking of hostname 2015-09-29 23:27:20 +01:00
Simon Butcher
21823f9a69 Refined credits in ChangeLog for fuzzing issue
Changed GDS to Gotham Digital Science
2015-09-22 10:20:58 +01:00
Manuel Pégourié-Gonnard
df048c59cf Bump version to 1.3.13 2015-09-17 11:53:14 +02:00
Manuel Pégourié-Gonnard
c54931aa4b Fix GNUism in bump_version.sh 2015-09-17 11:51:55 +02:00
Manuel Pégourié-Gonnard
a701d2f5e9 Fix bug in server parsing point formats extension
There is only one length byte but for some reason we skipped two, resulting in
reading one byte past the end of the extension. Fortunately, even if that
extension is at the very end of the ClientHello, it can't be at the end of the
buffer since the ClientHello length is at most SSL_MAX_CONTENT_LEN and the
buffer has some more room after that for MAC and so on. So there is no
buffer overread.

Possible consequences are:
- nothing, if the next byte is 0x00, which is a comment first byte for other
  extensions, which is why the bug remained unnoticed
- using a point format that was not offered by the peer if next byte is 0x01.
  In that case the peer will reject our ServerKeyExchange message and the
handshake will fail.
- thinking that we don't have a common point format even if we do, which will
  cause us to immediately abort the handshake.
None of these are a security issue.

The same bug was fixed client-side in fd35af15

Backport of f7022d1
2015-09-17 11:46:56 +02:00
Simon Butcher
9c4859ff15 Merge pull request #295 from ARMmbed/mbedtls-1.3-restricted
Merge of mbedtls-1.3-restricted
2015-09-17 00:46:07 +01:00
Manuel Pégourié-Gonnard
a1cdcd2364 Add counter-measure against RSA-CRT attack
https://securityblog.redhat.com/2015/09/02/factoring-rsa-keys-with-tls-perfect-forward-secrecy/

backport of 5f50104
2015-09-09 12:23:47 +02:00
Manuel Pégourié-Gonnard
bb564e0fb4 Fix possible client crash on API misuse 2015-09-03 10:44:32 +02:00
Manuel Pégourié-Gonnard
b0282eaf14 More deprecated removal in all.sh 2015-09-02 12:12:44 +02:00
Manuel Pégourié-Gonnard
4d9e36a086 Rm deprecated things full config test 2015-09-02 11:26:55 +02:00
Manuel Pégourié-Gonnard
5f6b2b67c4 Changelog entry for the previous commits 2015-09-01 19:40:02 +02:00
Manuel Pégourié-Gonnard
8f63e95dae Fix typos that made tests be skipped 2015-09-01 18:44:47 +02:00
Manuel Pégourié-Gonnard
1c38550bbd Skip to trusted certs early in the chain
This helps in the case where an intermediate certificate is directly trusted.
In that case we want to ignore what comes after it in the chain, not only for
performance but also to avoid false negatives (eg an old root being no longer
trusted while the newer intermediate is directly trusted).

see #220

backport of fdbdd72
2015-09-01 18:34:15 +02:00
Manuel Pégourié-Gonnard
15f1088ef6 Add tests for verify callback
As we're about to change the chain construction logic, we want to make sure
the callback will still be called exactly when it should, and not on the
(upcoming) ignored certs in the chain.

backport of 560fea3
2015-09-01 18:29:59 +02:00
Manuel Pégourié-Gonnard
8fbb5a32c6 Fix snprintf usage again
Sigh, switching between branches is error-prone
2015-08-31 12:38:12 +02:00
Manuel Pégourié-Gonnard
c728f9486b Fix snprintf usage on windows
Introduced in 6432c7e
2015-08-31 12:30:16 +02:00
Manuel Pégourié-Gonnard
6512554f42 Fix handling of long PSK identities
backport from c3b5d83

see #238
2015-08-31 11:43:47 +02:00
Manuel Pégourié-Gonnard
ee7db9cb6d Fix hash buffer size in pkey programs
backport from 102a620
2015-08-31 11:32:03 +02:00
Manuel Pégourié-Gonnard
6432c7e782 Fix memory corruption in rsa sign/verify programs
backport from d74c697

see #210
2015-08-31 11:30:07 +02:00