Commit graph

22976 commits

Author SHA1 Message Date
Jerry Yu
9a12df022e Add tests for time rountine
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-03 15:31:28 +08:00
Jerry Yu
8049346989 Add change log entry for mbedtls_ms_time
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-03 11:19:07 +08:00
Jerry Yu
f181e54968 Revert minimal integer requests
Roll back to 64bits

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-23 17:16:26 +08:00
Jerry Yu
029e659bbb Return seconds when clock_gettime error
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-23 11:25:36 +08:00
Jerry Yu
05bc87866e Improve documents about ms_time
And fix typo error

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-23 11:20:45 +08:00
Jerry Yu
3bfe133832 Improve readability
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-22 15:01:05 +08:00
Jerry Yu
10ce540a8c Put *MS_TIME* into together.
If MS_TIME_TYPE is changed, the printf fmt string should be changed also.
Otherwise, compiler might report fmt warning

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-21 15:39:02 +08:00
Jerry Yu
1ae2b2f034 Improve code style
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-21 15:37:12 +08:00
Jerry Yu
041c8c10f9 Add std PRI macro for printing milliseconds
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-07 16:14:40 +08:00
Jerry Yu
67bf677bad fix comments issues
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-02-03 11:16:13 +08:00
Jerry Yu
eb30684d55 Change type of mbedtls_ms_time_t
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-31 12:59:26 +08:00
Jerry Yu
b1d3015e27 Add more comment for mbedtls_ms_time
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-31 12:48:07 +08:00
Jerry Yu
947fd3d6ea Implement ms time with GetSystemTimeAsFile time.
There's a potential race condition with calling time(NULL) after
GetSystemTime().

See
https://learn.microsoft.com/en-us/archive/msdn-magazine/2004/march/implementing-a-high-resolution-time-provider-for-windows

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-30 15:45:25 +08:00
Jerry Yu
38257491aa Add milliseconds time function
We provide windows and posix implementation for it.
With MBEDTLS_PLATFORM_MS_TIME_ALT, user can provide
their own implementation.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-12 18:01:14 +08:00
Jerry Yu
eba0ab5db2 Add million seconds time type.
From RFC8446, the unit of ticket age is million seconds

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-12 18:01:14 +08:00
Gilles Peskine
6b4cb63aed
Merge pull request #6907 from Mbed-TLS/features/new-code-style/development
Switch to new code style: development
2023-01-11 19:26:55 +01:00
Gilles Peskine
c848d226bf Switch code style check to enforcement mode
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-11 14:50:14 +01:00
Gilles Peskine
449bd8303e Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-11 14:50:10 +01:00
Gilles Peskine
fd13a0f851
Merge pull request #6905 from gilles-peskine-arm/code-style-casts-psa-headers-more
Remove redundant error code definitions
2023-01-11 14:40:42 +01:00
Gilles Peskine
c55c343670
Merge pull request #6884 from gilles-peskine-arm/check-files-unicode
Reject bad characters in source code
2023-01-11 13:46:59 +01:00
Gilles Peskine
03e99cf14d Remove redundant error code definitions
We're including psa/crypto_values.h, which defines the necessary error
codes. Remove redundant definitions, which hurt because they need to be
styled in exactly the same way (same presence/absence of spaces between
tokens).

This completes the fix of https://github.com/Mbed-TLS/mbedtls/issues/6875.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-11 11:15:18 +01:00
Ronald Cron
83c5ad4873
Merge pull request #6787 from yuhaoth/pr/workaround-gnutls_anti_replay_fail
TLS 1.3: EarlyData: Workaround anti replay fail from GnuTLS
2023-01-11 09:05:36 +01:00
Gilles Peskine
3900bddd77
Merge pull request #6823 from mpg/unify-openssl-variables
Use OPENSSL everywhere, not OPENSSL_CMD
2023-01-10 22:10:19 +01:00
Gilles Peskine
f9c8d76db6
Merge pull request #6893 from tom-daubney-arm/modify_generate_errors_script
Make generate_errors.pl handle directory names containing spaces when opening files
2023-01-10 22:09:58 +01:00
Gilles Peskine
b4ffe781ed
Merge pull request #6878 from gilles-peskine-arm/code-style-casts-psa-headers
Don't restyle some PSA macros
2023-01-10 22:09:13 +01:00
Gilles Peskine
0770efe4e1
Merge pull request #6888 from daverodgman/iar-bignum-warning
Fix IAR warning
2023-01-10 22:08:37 +01:00
Dave Rodgman
bbbd803c2e Add Changelog
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-10 10:08:12 +00:00
Thomas Daubney
1efe4a874d Add ChangeLog entry
Add ChangeLog entry documenting bugfix.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-01-10 09:35:39 +00:00
Manuel Pégourié-Gonnard
28d4d43416
Merge pull request #6863 from valeriosetti/issue6830
Remove uses of mbedtls_ecp_curve_info in TLS (with USE_PSA)
2023-01-10 10:01:17 +01:00
Manuel Pégourié-Gonnard
6e666c2e79 Remove obsolete comment
Was explaining why we didn't use the OPENSSL name, but we are using it
now...

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-01-10 09:38:58 +01:00
Manuel Pégourié-Gonnard
3368724ade
Merge pull request #6870 from valeriosetti/issue6831
Document/test dependencies on ECP & Bignum
2023-01-10 09:25:41 +01:00
Jerry Yu
3e60cada5d Improve comment and changlog
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-10 14:58:08 +08:00
Thomas Daubney
33878ed30b Modify generate errors script
Modify generate_errors.pl such that it can now handle
opening files where the file path includes a directory
name containing spaces.

Raised in issue #6879. Fix provided by
@tom-cosgrove-arm in aforementioned issue.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-01-09 18:28:10 +00:00
Valerio Setti
a0b97bc803 fix wrong type in debug message
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-09 19:10:32 +01:00
Valerio Setti
2c12185b88 test: fix dependencies on function and data files
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-09 18:00:39 +01:00
Valerio Setti
1e868ccbac fix several typos and extra blank spaces
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-09 17:59:46 +01:00
Valerio Setti
2b5d3ded1f remove remaining occurencies of mbedtls_ecc_group_to_psa() from TLS
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-09 11:04:52 +01:00
Jerry Yu
99e902f479 Add changlog entry.
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-07 20:20:35 +08:00
Jerry Yu
bdb936b7a5 Workaround anti replay fail of GnuTLS
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-07 20:19:55 +08:00
Jerry Yu
a15af37867 Change time resolution of reco_delay from second to millionseconds
Per gnutls anti replay issue, it needs millionsecond time delay for
improve the fail rate.

From test result of #6712, this can improve the fail rate from 4%
to 92%.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-07 13:01:42 +08:00
Jerry Yu
f05b6eed0c Revert "Skip early data basic check temp"
This reverts commit 4e83173bb7.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-07 13:01:42 +08:00
Glenn Strauss
14db51224e Fix IAR warning
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-06 14:20:14 +00:00
Manuel Pégourié-Gonnard
b17803682e
Merge pull request #6873 from mpg/fix-derive-key-exercise
Fix test function derive_key_exercise()
2023-01-06 11:50:05 +01:00
Gilles Peskine
d11bb47fe0 Reject invalid UTF-8 and weird characters in text files
Reject "weird" characters in text files, especially control characters that
might be escape sequences or that might cause other text to appear garbled
(as in https://trojansource.codes/).

Also reject byte sequences that aren't valid UTF-8.

Accept only ASCII (except most control characters), letters, some non-ASCII
punctuation and some mathematical and technical symbols. This covers
everything that's currently present in Mbed TLS ( §áèéëñóöüłŽ–—’“”…≥).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-05 20:31:14 +01:00
Gilles Peskine
b389743ace Pass line number to issue_with_line
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-05 20:28:30 +01:00
Gilles Peskine
0ed9e78bf7 Treat more *.bin files as binary
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-05 20:27:35 +01:00
Gilles Peskine
cd0a565644
Merge pull request #6703 from yuhaoth/pr/tls13-misc-from-prototype
TLS 1.3: Upstream misc fix from prototype
2023-01-05 14:35:54 +01:00
Gilles Peskine
f07ddde980
Merge pull request #6876 from davidhorstmann-arm/disable-code-style-for-bn-asm
Check for Uncrustify errors in `code_style.py`
2023-01-05 14:35:16 +01:00
David Horstmann
78d566b216 Fix pylint warnings about comparison to True
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-05 10:02:09 +00:00
David Horstmann
8d1d6edb0b Fix incorrect typing of function in code_style.py
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-05 09:59:35 +00:00