Commit Graph

3224 Commits

Author SHA1 Message Date
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
6b5c9a3744 Add an "SSL" infix to MBEDTLS_EARLY_KEY_COMPUTATION
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-12-21 08:02:59 -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
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
9627202d3a Move MBEDTLS_DELAYED_SERVER_CERT_VERIFICATION to baremetal config
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
32846c62ac Moving the ecdhe_computed variable into the handshake structure 2020-12-15 12:50:37 +01:00
Hannes Tschofenig
c34d9cf37a Adding storage for public key to handshake_params 2020-12-03 17:37:06 +01:00
Hannes Tschofenig
77cddb3ef7 Adding early key computation config option 2020-12-03 17:36:00 +01:00
Hannes Tschofenig
3cb3db7961 Adding early key computation config check 2020-12-03 17:35:50 +01:00
Hannes Tschofenig
dfa4bae320 Adding immediate transmission option 2020-12-03 15:49:35 +01:00
Hannes Tschofenig
4f8c88312c Adding wrapper function for certificate verification function 2020-12-03 15:48:12 +01:00
Hannes Tschofenig
f336c7ea71 Adding delayed server cert verification config option 2020-12-03 15:47:47 +01:00
Hannes Tschofenig
c7f6d7f75c Making sure that keep peer certificate option is set when server cert verification is used. 2020-12-03 15:47:31 +01:00
Shelly Liberman
7326c62efb Add flow control to platform rnd buf
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-12-01 14:04:51 +02:00
Shelly Liberman
26bea33674
Merge pull request #3899 from shelib01/masked-aes
Masked AES 128 bit, encrypt only (boolean mask technique)
2020-11-27 17:17:23 +02:00
Shelly Liberman
11c64885a6 After review fixes
1. Formating
2. Check config added
3. Dependency description fixed

Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-11-26 23:58:41 +02:00
Andrzej Kurek
7d0a6864d3 Make CCM shuffling and masking optional
Add a define for CCM shuffling and masking operations.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-11-26 06:35:04 -05:00
Shelly Liberman
44b4229352 masked-aes CI problems fixes
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-11-26 10:54:19 +02:00
Shelly Liberman
c907c81a3b aes boolean masking
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-11-25 20:58:25 +02:00
Shelly Liberman
88da3c245b
Merge branch 'baremetal' into masked-aes 2020-11-25 18:32:19 +02:00
Shelly Liberman
cdebcfe1a3 aes boolean masking
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-11-25 18:14:59 +02:00
Andrzej Kurek
7f81c86a0d Add a callback for platform faults in platform_util.c
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-11-25 06:53:59 -05:00
Andrzej Kurek
5eba1d82a2
Merge pull request #3841 from AndrzejKurek/baremetal-rnd-in-range-fix
Move size checks outside of mbedtls_platform_random_in_range
2020-11-25 11:41:40 +01:00
Andrzej Kurek
a138c0a0b0
Move size checks outside of mbedtls_platform_random_in_range
Update the documentation to mention that calling it with zero
as an argument will result in an undefined behavior.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-11-12 17:05:51 +01:00
Kevin Bracey
57d9bdc5f9 Reorder structures
Place smallest items first, as this makes them most easily addressable
in Thumb architecture. 16-bit access instructions have a 5-bit offset
field, which is interpreted as bytes, halfwords, or words depending
on access size, so smaller fields have smaller range. Range is 0-31
times the access size.

The mbedtls_ssl_context structure is too large to be fully easily
accessed even for words, so reorder functional blocks to put more
frequently-referenced fields in the first 128 bytes, reducing
total code size.

Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
2020-11-04 15:16:22 +02:00
Kevin Bracey
1d53ce33c4 Avoid bitfields
Bitfields in context structures do not have sufficient (if any) RAM
payoff for the ROM complexity to manipulate them. Replace with
plain uint8_t.

On the smallest targets, the configuration options mean that there
are 4 or fewer members anyway, so a bitfield saves no RAM compared
to uint8_t.

ROM saving will be further increased if the uint8_t members are at the
start of the structure (when compiling for Thumb).

Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
2020-11-04 15:16:22 +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
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
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
db0e50ea70
Introduce MBEDTLS_OPTIMIZE_TINYCRYPT_ASM
Make the ASM optimizations in tinycrypt optional.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-10-14 14:32:50 +02:00
Kevin Bracey
f40c79272f tinycrypt: use fast integer types
Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
2020-10-07 14:13:41 +03: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
73680ad5a2
Merge pull request #3694 from AndrzejKurek/transform-cipher-optimization
Merge enc/dec cipher contexts in ssl transforms
2020-09-23 14:06:43 +01: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
Shelly Liberman
05beb9ac70 replace user rand by platform rand in ecc delays
Signed-off-by: Shelly Liberman <shelly.liberman@arm.com>
2020-09-16 18:58:50 +03:00
Andrzej Kurek
9539f831b2
Swap out CRC calculation in AES in favour of a simple hash
XOR the key bytes upon setting and re-check hash during each use.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-08-10 20:46:48 -04:00
Andrzej Kurek
e6d8db0f41
Change the tinycrypt return values to be below 256
Thanks to this change the produced ASM does not need an additional instruction
to place the constant value in a register, but can compare it directly.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-08-10 02:54:56 -04:00
Andrzej Kurek
8bb0839555
Add a deprecated version of mbedtls_platform_memcmp.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2020-08-09 02:18:12 -04:00
Andrzej Kurek
c87e91ce2b
Merge pull request #3553 from AndrzejKurek/crc-calculation-base
Validate AES keys after each use checking CRC
2020-08-13 12:42:54 +02:00
Piotr Nowicki
ea8e846fdc Add flow monitor for mbedtls_platform_memcpy() and mbedtls_platform_memmove()
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-08-12 15:22:06 +02:00
Piotr Nowicki
ed840dbcd8 Add flow montitor to the mbedtls_platform_memset()
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-08-12 15:12:20 +02:00
Piotr Nowicki
057daa3b28 Random delay can be disabled in configuration
Use random delay depending on whether MBEDTLS_FI_COUNTERMEASURES is defined

Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-08-11 16:41:34 +02:00
Piotr Nowicki
77b7a7754c Expanded the random number generator in the platform_util.c file
The earlier implementation had two problems: the random generator always
returned 0 if the MBEDTLS_ENTROPY_HARDWARE_ALT flag was not defined and there
was no protection needed if the HW RNG was malfunctioning. Both these problems
have been solved in this commit by adding the linear congruential generator algorithm.

Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-08-11 16:41:34 +02:00
Piotr Nowicki
8656fc6525 Change the value type in the mbedtls_platform_random_in_range()
Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
2020-08-11 16:38:25 +02:00
Piotr Nowicki
fa635dfaa1
Merge pull request #3448 from piotr-now/platform_util
Renamed mbedtls_platform_memcmp() to mbedtls_platform_memequal()
2020-08-11 14:30:35 +02:00
Andrzej Kurek
8fba6e99ce
Merge pull request #3532 from AndrzejKurek/fi-hmac-drbg-fixes
Fi-related hmac_drbg fixes
2020-08-10 19:02:25 +02:00
Andrzej Kurek
0305753d7a
Merge pull request #3477 from AndrzejKurek/aes-fake-key
Use a fake random key in AES calculations
2020-08-10 13:05:46 +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