Commit graph

23 commits

Author SHA1 Message Date
Joe Subbiani c045dc14b0 Replace MBEDTLS_CHAR_x with MBEDTLS_BYTE_x
The CHAR macros casted to an unsigned char which in this project
is garunteed to be 8 bits - the same as uint8_t (which BYTE casts
to) therefore, instances of CHAR have been swapped with BYTE and
the number of macros have been cut down

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-03 14:08:06 +01:00
Joe Subbiani 6b897c930c Add Character byte reading macros
These cast to an unsigned char rather than a uint8_t
like with MBEDTLS_BYTE_x
These save alot of space and will improve maintence by
replacing the appropriate code with MBEDTLS_CHAR_x

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-03 14:01:51 +01:00
Hanno Becker 531fe3054c Comment on hardcoding of maximum HKDF key expansion of 255 Bytes
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-16 09:50:17 +01:00
Hanno Becker 61baae7c9f Minor fixes and improvements in TLS 1.3 key schedule documentation
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-16 09:47:47 +01:00
Hanno Becker 2dfe1327e5 Fix miscalculation of maximum TLS 1.3 HKDF label length
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-10 09:23:12 +01:00
Hanno Becker 0c42fd94bb Fix Doxygen documentation of mbedtls_ssl_tls1_3_derive_secret()
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-09 12:58:29 +01:00
Hanno Becker 97a21567df Move misplaced comment
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-09 12:57:16 +01:00
Hanno Becker 1413bd8ae9 Simplify identification of TLS 1.3 labels in unit test suite
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-09 12:46:09 +01:00
Hanno Becker 59b50a1997 Don't use _xxx naming for local variables in ssl_tls13_keys.c
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-09 10:58:52 +01:00
Hanno Becker 70d7fb0c2d Don't hardcode TLS 1.3 labels in test cases
ssl_tls1_3_keys.c exports a structure containing all labels used
in the TLS 1.3 key schedule, but the TLS 1.3 key scheduling unit
tests so far replicated those labels in the test file. In particular,
wrong label values in ssl_tls1_3_keys.c wouldn't have been caught
by the unit tests.

This commit modifies the TLS 1.3 key schedule unit tests to use
the TLS 1.3 labels as exported by ssl_tls1_3_keys.c. This not only
makes sure that those labels are correct, but also avoids hardcoding
their hex-encoding in the test file.

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-09 10:17:37 +01:00
Hanno Becker a3a5a4e1f9 Please check-names.sh
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 11:33:48 +01:00
Hanno Becker 815869ac9c Improve documentation of ssl_tls1_3_hkdf_encode_label()
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 11:16:16 +01:00
Hanno Becker 00debc734b Minor improvement in ssl_tls13_keys.c
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 11:12:24 +01:00
Hanno Becker 493ea7f4ae Remove instances of camelCase in TLS 1.3 key schedule
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 11:08:06 +01:00
Hanno Becker 939bb4d8f6 Initialize TLS 1.3 label prefix with string literal
This is in line with how the entries of the TLS 1.3 label
structure `mbedtls_ssl_tls1_3_labels` are initialized.

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:48:55 +01:00
Hanno Becker 9cb0a146f1 Remove duplicated computation of TLS 1.3 HKDF label length
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:48:14 +01:00
Hanno Becker e4435ea777 Introduce TLS 1.3 labels in a single place
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:43:52 +01:00
Hanno Becker 1981cb2972 Use uniform naming for TLS 1.3 label fields
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:36:29 +01:00
Hanno Becker 58c5cea73b Include common.h from ssl_tls13_keys.c
`common.h` takes care of the logic of chosing the correct
configuration file, so we don't need to replicate it in
each source file.

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:31:33 +01:00
Hanno Becker e9cccb440c Implement TLS 1.3 key evolution function
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:28:28 +01:00
Hanno Becker b35d52240b Implement TLS 1.3 key derivation function Derive-Secret
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:28:28 +01:00
Hanno Becker 3385a4d5cf Implement TLS 1.3 traffic key generation
See the documentation in library/ssl_tls13_keys.h.

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:28:28 +01:00
Hanno Becker be9d6648f8 Implement TLS 1.3 key derivation function HKDF-Expand-Label
This commit introduces a new file library/ssl_tls13_key.c
which will subsequently be populated with functionality relating
to the TLS 1.3 key schedule.

Those functions are expected to be internal and are documented
in the internal header library/ssl_tls13_keys.h.

The first function to be implemented is the key expansion
function `HKDF-Expand-Label`. See the documentation in
library/ssl_tls13_keys.h for more information.

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2020-09-08 10:28:06 +01:00