Andrzej Kurek
d7073d9290
Merge pull request #3979 from AndrzejKurek/coverity-seg-fault-context
...
Fix the usage of ssl context after its nullified
2021-01-05 12:47:41 +01:00
Andrzej Kurek
42ed2d3c59
Fix the usage of ssl context after its nullified
...
Previously, it was possible to access a null pointer
even though the given configuration should work.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2021-01-04 09:36:53 -05:00
Andrzej Kurek
17c3531b4b
Add missing volatile identifiers before fi-related variables
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-31 09:56:42 -05:00
Andrzej Kurek
ad3c4ffb56
Add an "SSL" infix to MBEDTLS_DELAYED_SERVER_CERT_VERIFICATION
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-21 08:11:36 -05:00
Andrzej Kurek
4f5549f595
Add an "SSL" infix to MBEDTLS_IMMEDIATE_TRANSMISSION
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-21 07:56:57 -05:00
Andrzej Kurek
0719b3c129
Add output flushing after each message transmission
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-19 17:15:52 -05:00
Andrzej Kurek
e2134ed4b1
Fix certificate management when freeing handshake
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-18 11:23:19 -05:00
Andrzej Kurek
38c7f2d32f
Refactor the immediate transmission feature
...
The original way or handling it did not cover
message fragmentation or retransmission.
Now, the messages are always appended
to the flight and sent immediately, using
the same function as normal flight
transmission.
Moreover, epoch handling is different for this feature,
with a possibility to perform the usual retransmission
using previous methods.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-15 18:17:31 -05:00
Andrzej Kurek
d886d9f93c
Fix freeing uninitialized fields from the ssl context
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-15 15:43:12 -05:00
Andrzej Kurek
c3dde3f2f9
Fix unreachable code error
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-15 15:43:12 -05:00
Andrzej Kurek
52e08cbcb2
Fix unused parameters and ifdefs
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-15 15:43:12 -05:00
Andrzej Kurek
777d4217f1
Fix define and function names to conform to Mbed TLS rules
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-15 15:43:12 -05:00
Andrzej Kurek
131512440e
Move the new config optimization defines to be optional
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-15 15:43:12 -05:00
Hannes Tschofenig
c162895030
Add call to mbedtls_x509_crt_free()
2020-12-07 11:04:09 +01:00
Hannes Tschofenig
2279ffd2a0
Adding immediate message transmission
2020-12-03 15:52:35 +01:00
Hannes Tschofenig
cb6410c67d
Wrapper function for calling parse_certificate_verify
2020-12-03 15:48:55 +01:00
Andrzej Kurek
1c448168b2
Merge pull request #3913 from jarvte/memfix_variablebuffer
...
Fix possible memory leak when MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH defined
2020-11-25 09:45:53 -05:00
Teppo Järvelin
b89cf99a57
Fix possible memory leak when MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is defined
...
Signed-off-by: Teppo Järvelin <teppo.jarvelin@arm.com>
2020-11-25 11:44:05 +02:00
Shelly Liberman
c5b0c6e8ae
fix uninitialized variables
...
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-11-19 20:01:21 +02:00
Shelly Liberman
560203ae01
Merge pull request #3853 from kjbracey-arm/m_narrowloop
...
[baremetal] Avoid narrow loop counters etc
2020-11-08 08:03:48 +02:00
Kevin Bracey
a967a58ed3
[baremetal] Avoid narrow loop counters etc
...
Use `uint_fast8_t` instead of `unsigned char` in various loop-type
situations. This avoids the need for a 16 or 32-bit system to insert
explicit narrow-to-8-bit instructions.
Not the result of an exhaustive source analysis, rather inspecting
the disassembly output for a cut-down Cortex-M0+ build looking for
UXTB etc instructions, so there could well be more in the complete
configuration.
Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
2020-11-06 10:56:16 +02:00
Kevin Bracey
585e9e0922
Add MBEDTLS_SSL_CONF_TRANSPORT
...
Follow the model of `MBEDTLS_SSL_CONF_ENDPOINT`. This saves a small
amount - most of the saving was already acheived via`
MBEDTLS_SSL_TRANSPORT_IS_TLS` but we can scrape out a little more by
totally eliminating `ssl->conf->transport` references.
Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
2020-11-04 15:16:22 +02:00
Kevin Bracey
d859db833c
Fix MBEDTLS_SSL_CONF_ENDPOINT flagging
...
Compilation failed if MBEDTLS_SSL_CONF_ENDPOINT was set - add necessary
conditions.
Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
2020-11-04 15:16:09 +02:00
Andrzej Kurek
8b0910a791
Merge pull request #3815 from AndrzejKurek/cipher-optim-mem-fix
...
ssl_tls.c: Fix unchecked memory allocation
2020-11-02 11:41:24 +01:00
Andrzej Kurek
28b3b29306
ssl_tls.c: Fix unchecked memory allocation
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-10-22 11:40:41 +02:00
Andrzej Kurek
2e49d079d6
Describe the behaviour of buffer resizing on an out-of-memory error
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-10-22 11:16:25 +02:00
Andrzej Kurek
cd9a6ff3c1
Introduce additional flags for buffer upsizing and downsizing
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-10-22 11:12:07 +02:00
Andrzej Kurek
79db2f14da
Refactor the buffer resize feature to reduce codesize
...
Extract a common part of the code to a function.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-10-20 17:11:54 +02:00
Andrzej Kurek
f384495972
Sideport the variable IO buffer size feature to baremetal
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-10-17 00:55:17 +02:00
Andrzej Kurek
ff51721e99
ssl_tls: reduce the complexity of encryption validation
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-09-20 00:29:43 +02:00
Andrzej Kurek
8ec9e136cf
ssl_tls: Add a flag indicating that encryption succeeded
...
Protect against encryption skipping by introducing a new flag.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-09-20 00:29:43 +02:00
Andrzej Kurek
69bafce7a3
Improve the FI resistance in ssl_tls.c key switching
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-09-19 12:45:20 +02:00
Andrzej Kurek
f7df0d37ab
Reduce the size of used constant in ssl_tls.c
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-09-19 12:00:57 +02:00
Andrzej Kurek
a793237998
Calculate hashes of ssl encryption and decryption keys
...
Optimize the key switching mechanism to set the key only if
a different operation is performed with the context.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-09-19 08:04:05 +02:00
Andrzej Kurek
1175044156
Merge enc/dec cipher contexts in ssl transforms
...
Store the raw encryption and decryption keys in transforms
to set them before each cipher operation. Add a config option
for this - MBEDTLS_SSL_TRANSFORM_OPTIMIZE_CIPHERS.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-09-17 23:51:58 +02:00
Piotr Nowicki
305a5ec496
Checking in critical places if secured memset() and memcpy() was successful
...
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-08-12 15:22:20 +02:00
Piotr Nowicki
a6348edc23
Checking in critical places if the mbedtls_platform_zeroize() was successful
...
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-08-12 15:12:20 +02:00
Piotr Nowicki
e3c4ee51b2
Rename mbedtls_platform_memcmp() to mbedtls_platform_memequal()
...
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-08-10 12:41:00 +02:00
Shelly Liberman
3799fc1578
Splitting buffers comment added
...
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-08-05 17:53:31 +03:00
Shelly Liberman
c6a7e6b0c4
Enhancement fixes
...
Co-authored-by: Andrzej Kurek <andrzej.kurek@arm.com>
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-08-05 15:40:15 +03:00
shelib01
4062d6ca68
Add user pointer and data size duplication to ssl context.
...
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-08-05 15:01:05 +03:00
Andrzej Kurek
afec8853c5
Revert a part of the sensitive information duplication changes
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-07-15 16:31:27 -04:00
Andrzej Kurek
c417c783e5
Merge pull request #3481 from AndrzejKurek/fi_duplicate_buffers_2
...
Duplicate sensitive buffer and buffer length information
2020-07-15 11:56:36 +02:00
Andrzej Kurek
45e719983f
Minor formatting and cosmetic changes
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-07-08 10:09:44 -04:00
Andrzej Kurek
0919b142b6
Formatting changes
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-07-06 15:28:59 -04:00
Andrzej Kurek
84bde419e1
Add FI countermeasures to the ssl module
...
This commit adds mainly buffer pointer and length duplication and checks,
but also some hamming distance and return values checking improvements.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-07-06 15:27:34 -04:00
Andrzej Kurek
74f7d0f03d
Duplicate sensitive buffer and buffer length information
...
Detect FI attacks on buffer pointers and buffer lengths.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-07-06 14:28:12 -04:00
Piotr Nowicki
78fc139121
Add FI countermeasures for sensitive switch instructions
...
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-06-30 14:11:52 +02:00
Andrzej Kurek
e5425a0944
Merge pull request #3408 from AndrzejKurek/hamming-distance-improvements
...
Hamming distance improvements
2020-06-22 08:28:55 +01:00
Piotr Nowicki
e048b91d25
Add returning a FAULT_DETECTED error on suspected FI attacks
...
The change applies to the places where we prevent double synchronous
FI attacks with random delay, and where we do not respond to their
detection. The response to such an attack should be to return the
appropriate error code.
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-06-09 12:00:42 +02:00